4
4
5
5
use Psr \SimpleCache \CacheInterface ;
6
6
use Chainside \SDK \WebPos \Actions \Factory ;
7
- use Chainside \SDK \WebPos \Objects \ClientCredentials ;
8
- use Chainside \SDK \WebPos \Objects \PaymentOrderCreation ;
9
7
use Chainside \SDK \WebPos \Objects \PaymentUpdateObject ;
8
+ use Chainside \SDK \WebPos \Objects \PaymentOrderCreation ;
9
+ use Chainside \SDK \WebPos \Objects \ClientCredentials ;
10
10
11
11
12
12
class Client
@@ -26,156 +26,156 @@ public function __construct(array $config, CacheInterface $cache = null)
26
26
27
27
28
28
/**
29
- * Endpoint to sign in the system
29
+ * Endpoint to retrieve the possible sent callbacks based on legal payment's state transitions
30
30
*
31
- * @param \Chainside\SDK\WebPos\Objects\ClientCredentials $clientCredentialsLogin
31
+ * @param string $paymentOrderUuid
32
32
*
33
- * @return \Chainside\SDK\WebPos\Objects\ClientCredentialsLoginResponse
33
+ * @return \Chainside\SDK\WebPos\Objects\CallbackList
34
34
* @throws \SDK\Boilerplate\Exceptions\SdkException
35
35
*/
36
- public function clientCredentialsLogin ( ClientCredentials $ clientCredentialsLogin )
36
+ public function getCallbacks ( $ paymentOrderUuid )
37
37
{
38
38
39
- $ action = $ this ->factory ->make ('client_credentials_login ' );
39
+ $ action = $ this ->factory ->make ('get_callbacks ' );
40
40
41
41
42
- $ action ->setClientcredentials ( $ clientCredentialsLogin );
42
+ $ action ->setPaymentOrderUuid ( $ paymentOrderUuid );
43
43
return $ action ->run ();
44
44
}
45
45
46
46
/**
47
- * Endpoint to cancel a payment order
47
+ * Endpoint to reset a payment order to its initial state
48
48
*
49
49
* @param string $paymentOrderUuid
50
50
*
51
- * @return \Chainside\SDK\WebPos\Objects\PaymentOrderDeletionResponse
51
+ * @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
52
52
* @throws \SDK\Boilerplate\Exceptions\SdkException
53
53
*/
54
- public function deletePaymentOrder ($ paymentOrderUuid )
54
+ public function paymentReset ($ paymentOrderUuid )
55
55
{
56
56
57
- $ action = $ this ->factory ->make ('delete_payment_order ' );
57
+ $ action = $ this ->factory ->make ('payment_reset ' );
58
58
59
59
60
60
$ action ->setPaymentOrderUuid ($ paymentOrderUuid );
61
61
return $ action ->run ();
62
62
}
63
63
64
64
/**
65
- * Endpoint to retrieve a payment order
65
+ * Endpoint to change a payment order status and trigger callbacks
66
66
*
67
67
* @param string $paymentOrderUuid
68
+ * @param \Chainside\SDK\WebPos\Objects\PaymentUpdateObject $paymentUpdate
68
69
*
69
- * @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
70
+ * @return mixed
70
71
* @throws \SDK\Boilerplate\Exceptions\SdkException
71
72
*/
72
- public function getPaymentOrder ($ paymentOrderUuid )
73
+ public function paymentUpdate ($ paymentOrderUuid, PaymentUpdateObject $ paymentUpdate )
73
74
{
74
75
75
- $ action = $ this ->factory ->make ('get_payment_order ' );
76
+ $ action = $ this ->factory ->make ('payment_update ' );
76
77
77
78
78
79
$ action ->setPaymentOrderUuid ($ paymentOrderUuid );
80
+
81
+ $ action ->setPaymentupdateobject ($ paymentUpdate );
79
82
return $ action ->run ();
80
83
}
81
84
82
85
/**
83
- * Endpoint to retrieve all business' payment orders
86
+ * Endpoint to cancel a payment order
84
87
*
85
- * @param string $status
86
- * @param string $sortBy
87
- * @param string $sortOrder
88
- * @param integer $page
89
- * @param integer $pageSize
88
+ * @param string $paymentOrderUuid
90
89
*
91
- * @return \Chainside\SDK\WebPos\Objects\PaymentOrderList
90
+ * @return \Chainside\SDK\WebPos\Objects\PaymentOrderDeletionResponse
92
91
* @throws \SDK\Boilerplate\Exceptions\SdkException
93
92
*/
94
- public function getPaymentOrders ( $ status = null , $ sortBy = null , $ sortOrder = null , $ page = null , $ pageSize = null )
93
+ public function deletePaymentOrder ( $ paymentOrderUuid )
95
94
{
96
95
97
- $ action = $ this ->factory ->make ('get_payment_orders ' );
96
+ $ action = $ this ->factory ->make ('delete_payment_order ' );
98
97
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 );
104
100
return $ action ->run ();
105
101
}
106
102
107
103
/**
108
- * Endpoint to create a new payment order
104
+ * Endpoint to retrieve a payment order
109
105
*
110
- * @param \Chainside\SDK\WebPos\Objects\PaymentOrderCreation $createPaymentOrder
106
+ * @param string $paymentOrderUuid
111
107
*
112
- * @return \Chainside\SDK\WebPos\Objects\PaymentOrderCreationResponse
108
+ * @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
113
109
* @throws \SDK\Boilerplate\Exceptions\SdkException
114
110
*/
115
- public function createPaymentOrder ( PaymentOrderCreation $ createPaymentOrder )
111
+ public function getPaymentOrder ( $ paymentOrderUuid )
116
112
{
117
113
118
- $ action = $ this ->factory ->make ('create_payment_order ' );
114
+ $ action = $ this ->factory ->make ('get_payment_order ' );
119
115
120
116
121
- $ action ->setPaymentordercreation ( $ createPaymentOrder );
117
+ $ action ->setPaymentOrderUuid ( $ paymentOrderUuid );
122
118
return $ action ->run ();
123
119
}
124
120
125
121
/**
126
- * Endpoint to retrieve the possible sent callbacks based on legal payment's state transitions
122
+ * Endpoint to retrieve all business' payment orders
127
123
*
128
- * @param string $paymentOrderUuid
124
+ * @param integer $pageSize
125
+ * @param integer $page
126
+ * @param string $sortOrder
127
+ * @param string $sortBy
128
+ * @param string $status
129
129
*
130
- * @return \Chainside\SDK\WebPos\Objects\CallbackList
130
+ * @return \Chainside\SDK\WebPos\Objects\PaymentOrderList
131
131
* @throws \SDK\Boilerplate\Exceptions\SdkException
132
132
*/
133
- public function getCallbacks ( $ paymentOrderUuid )
133
+ public function getPaymentOrders ( $ pageSize = null , $ page = null , $ sortOrder = null , $ sortBy = null , $ status = null )
134
134
{
135
135
136
- $ action = $ this ->factory ->make ('get_callbacks ' );
136
+ $ action = $ this ->factory ->make ('get_payment_orders ' );
137
137
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 );
140
143
return $ action ->run ();
141
144
}
142
145
143
146
/**
144
- * Endpoint to reset a payment order to its initial state
147
+ * Endpoint to create a new payment order
145
148
*
146
- * @param string $paymentOrderUuid
149
+ * @param \Chainside\SDK\WebPos\Objects\PaymentOrderCreation $createPaymentOrder
147
150
*
148
- * @return \Chainside\SDK\WebPos\Objects\PaymentOrderRetrieval
151
+ * @return \Chainside\SDK\WebPos\Objects\PaymentOrderCreationResponse
149
152
* @throws \SDK\Boilerplate\Exceptions\SdkException
150
153
*/
151
- public function paymentReset ( $ paymentOrderUuid )
154
+ public function createPaymentOrder ( PaymentOrderCreation $ createPaymentOrder )
152
155
{
153
156
154
- $ action = $ this ->factory ->make ('payment_reset ' );
157
+ $ action = $ this ->factory ->make ('create_payment_order ' );
155
158
156
159
157
- $ action ->setPaymentOrderUuid ( $ paymentOrderUuid );
160
+ $ action ->setPaymentordercreation ( $ createPaymentOrder );
158
161
return $ action ->run ();
159
162
}
160
163
161
164
/**
162
- * Endpoint to change a payment order status and trigger callbacks
165
+ * Endpoint to sign in the system
163
166
*
164
- * @param string $paymentOrderUuid
165
- * @param \Chainside\SDK\WebPos\Objects\PaymentUpdateObject $paymentUpdate
167
+ * @param \Chainside\SDK\WebPos\Objects\ClientCredentials $clientCredentialsLogin
166
168
*
167
- * @return mixed
169
+ * @return \Chainside\SDK\WebPos\Objects\ClientCredentialsLoginResponse
168
170
* @throws \SDK\Boilerplate\Exceptions\SdkException
169
171
*/
170
- public function paymentUpdate ( $ paymentOrderUuid , PaymentUpdateObject $ paymentUpdate )
172
+ public function clientCredentialsLogin ( ClientCredentials $ clientCredentialsLogin )
171
173
{
172
174
173
- $ action = $ this ->factory ->make ('payment_update ' );
175
+ $ action = $ this ->factory ->make ('client_credentials_login ' );
174
176
175
177
176
- $ action ->setPaymentOrderUuid ($ paymentOrderUuid );
177
-
178
- $ action ->setPaymentupdateobject ($ paymentUpdate );
178
+ $ action ->setClientcredentials ($ clientCredentialsLogin );
179
179
return $ action ->run ();
180
180
}
181
181
0 commit comments