@@ -33,11 +33,13 @@ public function __construct($user = null, $password = null, $endpoint = null, $d
33
33
$ this ->_debug = $ debug ;
34
34
$ this ->_user = Helper::notNull ($ user , self ::$ user );
35
35
$ this ->_password = Helper::notNull ($ password , self ::$ password );
36
+ $ this ->_logfile = $ logfile ;
36
37
$ url_parts = parse_url (Helper::notNull ($ endpoint , self ::$ endpoint ));
37
38
if (count ($ url_parts ) > 1 ) {
38
39
$ this ->_endpoint = $ url_parts ['scheme ' ] . ':// ' . $ url_parts ['host ' ] . (isset ($ url_parts ['port ' ]) ? ': ' . $ url_parts ['port ' ] : '' );
39
40
}
40
41
$ this ->_user_agent = Helper::notNull (self ::$ user_agent , 'cURL php ' . phpversion ());
42
+ $ this ->log (self ::class . " created! " );
41
43
}
42
44
43
45
public function isValidAuth ($ merchant = '' )
@@ -143,12 +145,27 @@ public function getMerchantPaymentMethods($merchant)
143
145
144
146
public function getPaymentMethods ($ uri , $ options = array ())
145
147
{
146
- if (!preg_match ('!^https?://! ' , $ uri )) {
147
- $ uri = $ this ->_endpoint . '/orders/ ' . $ uri ;
148
- }
149
- $ this ->initCurl ($ uri . '/payment_methods ' . (count ($ options ) > 0 ? '? ' . http_build_query ($ options ) : '' ));
148
+ $ this ->initCurl ($ this ->_endpoint . '/merchants/ ' );
150
149
curl_setopt ($ this ->ch , CURLOPT_CUSTOMREQUEST , 'GET ' );
151
- curl_setopt ($ this ->ch , CURLOPT_HTTPHEADER , array ('Accept: text/html ' ));
150
+ curl_setopt ($ this ->ch , CURLOPT_HTTPHEADER , array ('Accept: application/json ' ));
151
+ $ this ->sendRequest ();
152
+ $ this ->dealWithResponse ();
153
+ curl_close ($ this ->ch );
154
+ }
155
+
156
+ public function getAvailableDisbursements ($ merchant ) {
157
+ $ this ->initCurl ($ this ->_endpoint . '/merchants/ ' . $ merchant . '/disbursements ' );
158
+ curl_setopt ($ this ->ch , CURLOPT_CUSTOMREQUEST , 'GET ' );
159
+ curl_setopt ($ this ->ch , CURLOPT_HTTPHEADER , array ('Accept: application/json ' ));
160
+ $ this ->sendRequest ();
161
+ $ this ->dealWithResponse ();
162
+ curl_close ($ this ->ch );
163
+ }
164
+
165
+ public function getDisbursementDetails ($ path ) {
166
+ $ this ->initCurl ($ this ->_endpoint . $ path );
167
+ curl_setopt ($ this ->ch , CURLOPT_CUSTOMREQUEST , 'GET ' );
168
+ curl_setopt ($ this ->ch , CURLOPT_HTTPHEADER , array ('Accept: application/json ' ));
152
169
$ this ->sendRequest ();
153
170
$ this ->dealWithResponse ();
154
171
curl_close ($ this ->ch );
0 commit comments