From 048d9a094a5efa68ff5ed921bcfe0f7017e011d6 Mon Sep 17 00:00:00 2001 From: Mohamed Oussama EL ABBASSI Date: Wed, 3 Nov 2021 15:21:35 +0100 Subject: [PATCH] DOT-4386: YouCan Pay > Fix bug when we generate an Token & documentation (#7) * DOT-4386: YouCan Pay > Fix bug when we generate an Token & documentation * DOT-4386: changing readme * DOT-4386: code review 1 --- README.md | 4 ++-- src/API/HTTPAdapter/CurlHTTPAdapter.php | 4 ++-- 2 files changed, 4 insertions(+), 4 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'); ``` diff --git a/src/API/HTTPAdapter/CurlHTTPAdapter.php b/src/API/HTTPAdapter/CurlHTTPAdapter.php index fb09ad8..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($this->getBaseUrl(), $endpoint)); + $curl = curl_init(sprintf('%s%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':