From a5439875db0c5155ab58f137df71f6803ed28d2f Mon Sep 17 00:00:00 2001 From: Mohamed Oussama EL ABBASSI Date: Wed, 3 Nov 2021 15:01:30 +0100 Subject: [PATCH 1/3] DOT-4386: YouCan Pay > Fix bug when we generate an Token & documentation --- src/API/HTTPAdapter/CurlHTTPAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/API/HTTPAdapter/CurlHTTPAdapter.php b/src/API/HTTPAdapter/CurlHTTPAdapter.php index fb09ad8..7d3387e 100644 --- a/src/API/HTTPAdapter/CurlHTTPAdapter.php +++ b/src/API/HTTPAdapter/CurlHTTPAdapter.php @@ -35,7 +35,7 @@ protected function parseHeaders($headers) public function request(string $method, string $endpoint, array $params = [], array $headers = []): Response { - $curl = curl_init(sprintf($this->getBaseUrl(), $endpoint)); + $curl = curl_init(sprintf('%1$s%2$s', $this->getBaseUrl(), $endpoint)); $headers["Content-Type"] = "application/json"; $headers["Accept"] = "application/json"; @@ -47,7 +47,7 @@ public function request(string $method, string $endpoint, array $params = [], ar switch (strtolower($method)) { case 'post': curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_POSTFIELDS, $httpBody); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params)); break; case 'get': From 1f3dfb32399b2c184658a285440007e1c54f4d72 Mon Sep 17 00:00:00 2001 From: Mohamed Oussama EL ABBASSI Date: Wed, 3 Nov 2021 15:03:06 +0100 Subject: [PATCH 2/3] DOT-4386: changing readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eed0107..d3ebc64 100755 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ You can specify which environment when initializing `YouCanPay` instance ```php use YouCan\Pay\YouCanPay; - -$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key'); // enable sandbox mode YouCanPay::setIsSandboxMode(true); + +$youCanPay = YouCanPay::instance()->useKeys('my-private-key', 'my-public-key'); ``` From a405ca770a72288323cecdca3609fb3af027fbd2 Mon Sep 17 00:00:00 2001 From: Mohamed Oussama EL ABBASSI Date: Wed, 3 Nov 2021 15:18:14 +0100 Subject: [PATCH 3/3] DOT-4386: code review 1 --- src/API/HTTPAdapter/CurlHTTPAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/API/HTTPAdapter/CurlHTTPAdapter.php b/src/API/HTTPAdapter/CurlHTTPAdapter.php index 7d3387e..0a80f32 100644 --- a/src/API/HTTPAdapter/CurlHTTPAdapter.php +++ b/src/API/HTTPAdapter/CurlHTTPAdapter.php @@ -35,7 +35,7 @@ protected function parseHeaders($headers) public function request(string $method, string $endpoint, array $params = [], array $headers = []): Response { - $curl = curl_init(sprintf('%1$s%2$s', $this->getBaseUrl(), $endpoint)); + $curl = curl_init(sprintf('%s%s', $this->getBaseUrl(), $endpoint)); $headers["Content-Type"] = "application/json"; $headers["Accept"] = "application/json";