|
23 | 23 |
|
24 | 24 | namespace figo; |
25 | 25 |
|
| 26 | +require_once("utils.php"); |
| 27 | + |
26 | 28 | use Psr\Log\LoggerInterface; |
27 | 29 | use Psr\Log\NullLogger; |
28 | 30 |
|
@@ -62,6 +64,7 @@ public function __construct($access_token, $apiEndpoint = null, array $fingerpri |
62 | 64 | if ($apiEndpoint) { |
63 | 65 | $this->apiEndpoint = $apiEndpoint; |
64 | 66 | } |
| 67 | + $this->apiUrl = parse_api_endpoint($this->apiEndpoint); |
65 | 68 |
|
66 | 69 | if ($fingerprints) { |
67 | 70 | $this->fingerprints = $fingerprints; |
@@ -93,8 +96,8 @@ public function query_api($path, array $data = null, $method = "GET") { |
93 | 96 | "Content-Type" => "application/json", |
94 | 97 | "Content-Length" => strlen($data)); |
95 | 98 |
|
96 | | - $request = new HttpsRequest($this->apiEndpoint, $this->fingerprints, $this->logger); |
97 | | - |
| 99 | + $request = new HttpsRequest($this->apiUrl['host'], $this->fingerprints, $this->logger); |
| 100 | + $path = $this->apiUrl['path'] . $path; |
98 | 101 | return $request->request($path, $data, $method, $headers); |
99 | 102 | } |
100 | 103 |
|
@@ -248,17 +251,6 @@ public function add_account($country, $credentials, $bank_code, $iban, $save_pin |
248 | 251 | return (is_null($response) ? null : new Account($this, $response)); |
249 | 252 | } |
250 | 253 |
|
251 | | - /** |
252 | | - * Modify an account |
253 | | - * |
254 | | - * @param Account the modified account to be saved |
255 | | - * @return Account 'Account' object for the updated account returned by server |
256 | | - */ |
257 | | - public function modify_account($account) { |
258 | | - $response = $this->query_api("/rest/accounts/".$account->account_id, $account->dump(), "PUT"); |
259 | | - return (is_null($response) ? null : new Account($this, $response)); |
260 | | - } |
261 | | - |
262 | 254 | /** |
263 | 255 | * Remove an account |
264 | 256 | * |
@@ -465,7 +457,7 @@ public function remove_bank_pin($bank_or_id) { |
465 | 457 | public function get_sync_url($redirect_uri, $state) { |
466 | 458 | $data = array("redirect_uri" => $redirect_uri, "state" => $state); |
467 | 459 | $response = $this->query_api("/rest/sync", $data, "POST"); |
468 | | - return "https://".Config::$API_ENDPOINT."/task/start?id=".$response["task_token"]; |
| 460 | + return $this->apiEndpoint."/task/start?id=".$response["task_token"]; |
469 | 461 | } |
470 | 462 |
|
471 | 463 |
|
@@ -717,7 +709,7 @@ public function submit_payment($payment, $tan_scheme_id, $state, $redirect_uri=n |
717 | 709 | if (is_null($response)) { |
718 | 710 | return null; |
719 | 711 | } else { |
720 | | - return "https://".Config::$API_ENDPOINT."/task/start?id=".$response["task_token"]; |
| 712 | + return $this->apiEndpoint."/task/start?id=".$response["task_token"]; |
721 | 713 | } |
722 | 714 | } |
723 | 715 | } |
|
0 commit comments