99/**
1010 * Class PaymentRequests
1111 * @package SettleApi\MerchantApi
12- * @link https://api.support.settle.eu/api/reference/rest/v1/ merchant. payment. request/
12+ * @link https://settleapi.stoplight.io/docs/settleapis/b3A6MTUzOTU0MTE- merchant- payment- request-list
1313 */
1414class PaymentRequests extends SettleApi
1515{
16+ const REQUEST_SHAPE = [
17+ 'customer ' => 'string ' ,
18+ 'action ' => 'required|string ' ,
19+ 'currency ' => 'string ' ,
20+ 'amount ' => 'numeric ' ,
21+ 'pos_id ' => 'string ' ,
22+ 'pos_tid ' => 'string ' ,
23+ 'additional_amount ' => 'numeric ' ,
24+ 'additional_edit ' => 'bool ' ,
25+ 'allow_credit ' => 'bool ' ,
26+ 'required_scope ' => 'string ' ,
27+ 'required_scope_text ' => 'string ' ,
28+ 'uri ' => 'string ' ,
29+ 'scope ' => 'string ' ,
30+ 'callback_uri ' => 'string ' ,
31+ 'success_return_uri ' => 'string ' ,
32+ 'failure_return_uri ' => 'string ' ,
33+ 'display_message_uri ' => 'string ' ,
34+ 'expires_in ' => 'numeric ' ,
35+ 'max_scan_age ' => 'numeric ' ,
36+ 'text ' => 'string ' ,
37+ 'refund_id ' => 'string ' ,
38+ 'capture_id ' => 'string ' ,
39+ 'line_items ' => 'any ' ,
40+ 'links ' => 'any ' ,
41+ ];
42+
1643 /**
1744 * @return array
1845 * @throws SettleApiException
1946 */
20- public function list ()
47+ public function list ($ query = [] )
2148 {
22- return $ this ->call ('GET ' , 'payment_request/ ' );
49+ return $ this ->call ('GET ' , 'payment_request/ ' , $ query );
2350 }
2451
2552 /**
@@ -39,7 +66,7 @@ public function get($payment_request_id)
3966 */
4067 public function create (array $ data )
4168 {
42- return $ this ->call ('POST ' , 'payment_request/ ' , $ data );
69+ return $ this ->call ('POST ' , 'payment_request/ ' , $ data, self :: REQUEST_SHAPE );
4370 }
4471
4572 /**
@@ -50,7 +77,9 @@ public function create(array $data)
5077 */
5178 public function update ($ payment_request_id , array $ data )
5279 {
53- return $ this ->call ('PUT ' , "payment_request/ {$ payment_request_id }/ " , $ data );
80+ $ path = "payment_request/ {$ payment_request_id }/ " ;
81+
82+ return $ this ->call ('PUT ' , $ path , $ data , self ::REQUEST_SHAPE );
5483 }
5584
5685 /**
@@ -119,20 +148,21 @@ public function refund($payment_request_id, $currency, $amount, $additional_amou
119148
120149 /**
121150 * @param string $payment_request_id
151+ * @param array $extraData
122152 * @return string
123153 */
124- public function getPaymentLink ($ payment_request_id )
154+ public function getLink ($ payment_request_id, $ extraData = [] )
125155 {
126- return $ this ->createLink (SettleApiClient::LINK_TEMPLATE_PAYMENT , compact ('payment_request_id ' ));
156+ return $ this ->createLink (SettleApiClient::LINK_TEMPLATE_PAYMENT , compact ('payment_request_id ' ), $ extraData );
127157 }
128158
129159 /**
130160 * @param string $payment_request_id
131- * @param array $socialData
161+ * @param array $extraData
132162 * @return string
133163 */
134- public function getDynamicLink ($ payment_request_id , $ socialData = [])
164+ public function getDeepLink ($ payment_request_id , $ extraData = [])
135165 {
136- return $ this ->createLink (SettleApiClient:: LINK_TEMPLATE_DYNAMIC , compact ( ' payment_request_id ' ) , $ socialData );
166+ return $ this ->createDeepLink ( $ this -> getLink ( $ payment_request_id , $ extraData ) );
137167 }
138168}
0 commit comments