Skip to content

Commit 95fe64b

Browse files
committed
update artifacts
1 parent a27ab75 commit 95fe64b

39 files changed

+418
-440
lines changed

README.md

Lines changed: 136 additions & 162 deletions
Large diffs are not rendered by default.

src/Actions/Factory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public static function actions()
2626
{
2727

2828
return [
29-
"client_credentials_login" => ClientCredentialsLogin::class,
29+
"get_callbacks" => GetCallbacks::class,
30+
"payment_reset" => PaymentReset::class,
31+
"payment_update" => PaymentUpdate::class,
3032
"delete_payment_order" => DeletePaymentOrder::class,
3133
"get_payment_order" => GetPaymentOrder::class,
3234
"get_payment_orders" => GetPaymentOrders::class,
3335
"create_payment_order" => CreatePaymentOrder::class,
34-
"get_callbacks" => GetCallbacks::class,
35-
"payment_reset" => PaymentReset::class,
36-
"payment_update" => PaymentUpdate::class,
36+
"client_credentials_login" => ClientCredentialsLogin::class,
3737

3838
];
3939

src/Actions/GetPaymentOrders.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ public function __construct(Context $context)
3131

3232
/**
3333
*
34-
* @param string $status
34+
* @param integer $pageSize
3535
* @return $this
3636
*/
37-
public function setStatus($status) {
38-
$this->addQueryParameter('status', $status);
37+
public function setPageSize($pageSize) {
38+
$this->addQueryParameter('page_size', $pageSize);
3939
return $this;
4040
}/**
4141
*
42-
* @param string $sortBy
42+
* @param integer $page
4343
* @return $this
4444
*/
45-
public function setSortBy($sortBy) {
46-
$this->addQueryParameter('sort_by', $sortBy);
45+
public function setPage($page) {
46+
$this->addQueryParameter('page', $page);
4747
return $this;
4848
}/**
4949
*
@@ -55,19 +55,19 @@ public function setSortOrder($sortOrder) {
5555
return $this;
5656
}/**
5757
*
58-
* @param integer $page
58+
* @param string $sortBy
5959
* @return $this
6060
*/
61-
public function setPage($page) {
62-
$this->addQueryParameter('page', $page);
61+
public function setSortBy($sortBy) {
62+
$this->addQueryParameter('sort_by', $sortBy);
6363
return $this;
6464
}/**
6565
*
66-
* @param integer $pageSize
66+
* @param string $status
6767
* @return $this
6868
*/
69-
public function setPageSize($pageSize) {
70-
$this->addQueryParameter('page_size', $pageSize);
69+
public function setStatus($status) {
70+
$this->addQueryParameter('status', $status);
7171
return $this;
7272
}
7373

src/ChainsideCallbacksHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
use SDK\Boilerplate\Callbacks\CallbacksHandler;
66
use Chainside\SDK\WebPos\Exceptions\CallbackParseException;
77
use Chainside\SDK\WebPos\Exceptions\UnknownCallbackException;
8-
use Chainside\SDK\WebPos\Objects\PaymentOverpaidCallback;
98
use Chainside\SDK\WebPos\Objects\PaymentCompletedCallback;
109
use Chainside\SDK\WebPos\Objects\PaymentDisputeStartCallback;
11-
use Chainside\SDK\WebPos\Objects\PaymentChargebackCallback;
10+
use Chainside\SDK\WebPos\Objects\PaymentOverpaidCallback;
1211
use Chainside\SDK\WebPos\Objects\PaymentCancelledCallback;
1312
use Chainside\SDK\WebPos\Objects\PaymentDisputeEndCallback;
1413
use Chainside\SDK\WebPos\Objects\PaymentExpiredCallback;
14+
use Chainside\SDK\WebPos\Objects\PaymentChargebackCallback;
1515

1616

1717
class ChainsideCallbacksHandler extends CallbacksHandler
1818
{
1919

2020
protected $callbacks = [
21-
'payment.overpaid' => PaymentOverpaidCallback::class,
2221
'payment.completed' => PaymentCompletedCallback::class,
2322
'payment.dispute.start' => PaymentDisputeStartCallback::class,
24-
'payment.chargeback' => PaymentChargebackCallback::class,
23+
'payment.overpaid' => PaymentOverpaidCallback::class,
2524
'payment.cancelled' => PaymentCancelledCallback::class,
2625
'payment.dispute.end' => PaymentDisputeEndCallback::class,
2726
'payment.expired' => PaymentExpiredCallback::class,
27+
'payment.chargeback' => PaymentChargebackCallback::class,
2828
];
2929

3030
/**

src/Client.php

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
use Psr\SimpleCache\CacheInterface;
66
use Chainside\SDK\WebPos\Actions\Factory;
7-
use Chainside\SDK\WebPos\Objects\ClientCredentials;
8-
use Chainside\SDK\WebPos\Objects\PaymentOrderCreation;
97
use Chainside\SDK\WebPos\Objects\PaymentUpdateObject;
8+
use Chainside\SDK\WebPos\Objects\PaymentOrderCreation;
9+
use Chainside\SDK\WebPos\Objects\ClientCredentials;
1010

1111

1212
class Client
@@ -26,156 +26,156 @@ public function __construct(array $config, CacheInterface $cache = null)
2626

2727

2828
/**
29-
* Endpoint to sign in the system
29+
* Endpoint to retrieve the possible sent callbacks based on legal payment's state transitions
3030
*
31-
* @param \Chainside\SDK\WebPos\Objects\ClientCredentials $clientCredentialsLogin
31+
* @param string $paymentOrderUuid
3232
*
33-
* @return \Chainside\SDK\WebPos\Objects\ClientCredentialsLoginResponse
33+
* @return \Chainside\SDK\WebPos\Objects\CallbackList
3434
* @throws \SDK\Boilerplate\Exceptions\SdkException
3535
*/
36-
public function clientCredentialsLogin(ClientCredentials $clientCredentialsLogin)
36+
public function getCallbacks($paymentOrderUuid)
3737
{
3838

39-
$action = $this->factory->make('client_credentials_login');
39+
$action = $this->factory->make('get_callbacks');
4040

4141

42-
$action->setClientcredentials($clientCredentialsLogin);
42+
$action->setPaymentOrderUuid($paymentOrderUuid);
4343
return $action->run();
4444
}
4545

4646
/**
47-
* Endpoint to cancel a payment order
47+
* Endpoint to reset a payment order to its initial state
4848
*
4949
* @param string $paymentOrderUuid
5050
*
51-
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderDeletionResponse
51+
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
5252
* @throws \SDK\Boilerplate\Exceptions\SdkException
5353
*/
54-
public function deletePaymentOrder($paymentOrderUuid)
54+
public function paymentReset($paymentOrderUuid)
5555
{
5656

57-
$action = $this->factory->make('delete_payment_order');
57+
$action = $this->factory->make('payment_reset');
5858

5959

6060
$action->setPaymentOrderUuid($paymentOrderUuid);
6161
return $action->run();
6262
}
6363

6464
/**
65-
* Endpoint to retrieve a payment order
65+
* Endpoint to change a payment order status and trigger callbacks
6666
*
6767
* @param string $paymentOrderUuid
68+
* @param \Chainside\SDK\WebPos\Objects\PaymentUpdateObject $paymentUpdate
6869
*
69-
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
70+
* @return mixed
7071
* @throws \SDK\Boilerplate\Exceptions\SdkException
7172
*/
72-
public function getPaymentOrder($paymentOrderUuid)
73+
public function paymentUpdate($paymentOrderUuid, PaymentUpdateObject $paymentUpdate)
7374
{
7475

75-
$action = $this->factory->make('get_payment_order');
76+
$action = $this->factory->make('payment_update');
7677

7778

7879
$action->setPaymentOrderUuid($paymentOrderUuid);
80+
81+
$action->setPaymentupdateobject($paymentUpdate);
7982
return $action->run();
8083
}
8184

8285
/**
83-
* Endpoint to retrieve all business' payment orders
86+
* Endpoint to cancel a payment order
8487
*
85-
* @param string $status
86-
* @param string $sortBy
87-
* @param string $sortOrder
88-
* @param integer $page
89-
* @param integer $pageSize
88+
* @param string $paymentOrderUuid
9089
*
91-
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderList
90+
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderDeletionResponse
9291
* @throws \SDK\Boilerplate\Exceptions\SdkException
9392
*/
94-
public function getPaymentOrders($status = null, $sortBy = null, $sortOrder = null, $page = null, $pageSize = null)
93+
public function deletePaymentOrder($paymentOrderUuid)
9594
{
9695

97-
$action = $this->factory->make('get_payment_orders');
96+
$action = $this->factory->make('delete_payment_order');
9897

99-
if(!is_null($status)) $action->setStatus($status);
100-
if(!is_null($sortBy)) $action->setSortBy($sortBy);
101-
if(!is_null($sortOrder)) $action->setSortOrder($sortOrder);
102-
if(!is_null($page)) $action->setPage($page);
103-
if(!is_null($pageSize)) $action->setPageSize($pageSize);
98+
99+
$action->setPaymentOrderUuid($paymentOrderUuid);
104100
return $action->run();
105101
}
106102

107103
/**
108-
* Endpoint to create a new payment order
104+
* Endpoint to retrieve a payment order
109105
*
110-
* @param \Chainside\SDK\WebPos\Objects\PaymentOrderCreation $createPaymentOrder
106+
* @param string $paymentOrderUuid
111107
*
112-
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderCreationResponse
108+
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
113109
* @throws \SDK\Boilerplate\Exceptions\SdkException
114110
*/
115-
public function createPaymentOrder(PaymentOrderCreation $createPaymentOrder)
111+
public function getPaymentOrder($paymentOrderUuid)
116112
{
117113

118-
$action = $this->factory->make('create_payment_order');
114+
$action = $this->factory->make('get_payment_order');
119115

120116

121-
$action->setPaymentordercreation($createPaymentOrder);
117+
$action->setPaymentOrderUuid($paymentOrderUuid);
122118
return $action->run();
123119
}
124120

125121
/**
126-
* Endpoint to retrieve the possible sent callbacks based on legal payment's state transitions
122+
* Endpoint to retrieve all business' payment orders
127123
*
128-
* @param string $paymentOrderUuid
124+
* @param integer $pageSize
125+
* @param integer $page
126+
* @param string $sortOrder
127+
* @param string $sortBy
128+
* @param string $status
129129
*
130-
* @return \Chainside\SDK\WebPos\Objects\CallbackList
130+
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderList
131131
* @throws \SDK\Boilerplate\Exceptions\SdkException
132132
*/
133-
public function getCallbacks($paymentOrderUuid)
133+
public function getPaymentOrders($pageSize = null, $page = null, $sortOrder = null, $sortBy = null, $status = null)
134134
{
135135

136-
$action = $this->factory->make('get_callbacks');
136+
$action = $this->factory->make('get_payment_orders');
137137

138-
139-
$action->setPaymentOrderUuid($paymentOrderUuid);
138+
if(!is_null($pageSize)) $action->setPageSize($pageSize);
139+
if(!is_null($page)) $action->setPage($page);
140+
if(!is_null($sortOrder)) $action->setSortOrder($sortOrder);
141+
if(!is_null($sortBy)) $action->setSortBy($sortBy);
142+
if(!is_null($status)) $action->setStatus($status);
140143
return $action->run();
141144
}
142145

143146
/**
144-
* Endpoint to reset a payment order to its initial state
147+
* Endpoint to create a new payment order
145148
*
146-
* @param string $paymentOrderUuid
149+
* @param \Chainside\SDK\WebPos\Objects\PaymentOrderCreation $createPaymentOrder
147150
*
148-
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
151+
* @return \Chainside\SDK\WebPos\Objects\PaymentOrderCreationResponse
149152
* @throws \SDK\Boilerplate\Exceptions\SdkException
150153
*/
151-
public function paymentReset($paymentOrderUuid)
154+
public function createPaymentOrder(PaymentOrderCreation $createPaymentOrder)
152155
{
153156

154-
$action = $this->factory->make('payment_reset');
157+
$action = $this->factory->make('create_payment_order');
155158

156159

157-
$action->setPaymentOrderUuid($paymentOrderUuid);
160+
$action->setPaymentordercreation($createPaymentOrder);
158161
return $action->run();
159162
}
160163

161164
/**
162-
* Endpoint to change a payment order status and trigger callbacks
165+
* Endpoint to sign in the system
163166
*
164-
* @param string $paymentOrderUuid
165-
* @param \Chainside\SDK\WebPos\Objects\PaymentUpdateObject $paymentUpdate
167+
* @param \Chainside\SDK\WebPos\Objects\ClientCredentials $clientCredentialsLogin
166168
*
167-
* @return mixed
169+
* @return \Chainside\SDK\WebPos\Objects\ClientCredentialsLoginResponse
168170
* @throws \SDK\Boilerplate\Exceptions\SdkException
169171
*/
170-
public function paymentUpdate($paymentOrderUuid, PaymentUpdateObject $paymentUpdate)
172+
public function clientCredentialsLogin(ClientCredentials $clientCredentialsLogin)
171173
{
172174

173-
$action = $this->factory->make('payment_update');
175+
$action = $this->factory->make('client_credentials_login');
174176

175177

176-
$action->setPaymentOrderUuid($paymentOrderUuid);
177-
178-
$action->setPaymentupdateobject($paymentUpdate);
178+
$action->setClientcredentials($clientCredentialsLogin);
179179
return $action->run();
180180
}
181181

src/Exceptions/ChainsideError.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55
class ChainsideError
66
{
77

8-
const VALIDATION_ERROR = '0001';
9-
const INVALID_CALLBACK_ERROR = '0013';
10-
const UNAUTHORIZED_CLIENT_ERROR = '1001';
11-
const INVALID_GRANT_TYPE_ERROR = '1002';
12-
const ACCESS_TOKEN_EXPIRED_ERROR = '1004';
8+
const RATE_UNAVAILABLE_ERROR = '4003';
9+
const INVALID_CONTENT_TYPE_HEADER_ERROR = '3012';
1310
const INVALID_REFRESH_TOKEN_ERROR = '1006';
14-
const INVALID_ACCESS_TOKEN_ERROR = '1007';
15-
const FORBIDDEN_ERROR = '1012';
16-
const INVALID_SCOPE_ERROR = '1013';
17-
const INVALID_REALM_ERROR = '1018';
18-
const TOO_MANY_REQUESTS_ERROR = '2000';
11+
const INVALID_GRANT_TYPE_ERROR = '1002';
12+
const FUNCTIONALITY_DOWN_ERROR = '4006';
1913
const INVALID_AUTHORIZATION_HEADER_ERROR = '3007';
20-
const INVALID_CONTENT_TYPE_HEADER_ERROR = '3012';
14+
const ACCESS_TOKEN_EXPIRED_ERROR = '1004';
2115
const INVALID_ACCEPT_HEADER_ERROR = '3013';
22-
const INTERNAL_SERVER_ERROR = '4000';
2316
const NOT_FOUND_ERROR = '3001';
17+
const UNAUTHORIZED_CLIENT_ERROR = '1001';
18+
const TOO_MANY_REQUESTS_ERROR = '2000';
19+
const INVALID_CALLBACK_ERROR = '0013';
20+
const INVALID_SCOPE_ERROR = '1013';
21+
const FORBIDDEN_ERROR = '1012';
22+
const INVALID_REALM_ERROR = '1018';
2423
const METHOD_NOT_ALLOWED_ERROR = '3003';
25-
const RATE_UNAVAILABLE_ERROR = '4003';
26-
const FUNCTIONALITY_DOWN_ERROR = '4006';
24+
const INTERNAL_SERVER_ERROR = '4000';
25+
const INVALID_ACCESS_TOKEN_ERROR = '1007';
26+
const VALIDATION_ERROR = '0001';
2727

2828
}

0 commit comments

Comments
 (0)