From 3e74329f80ccbdcd2877e28fd87d5ac7e3e8cc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20J=C3=B3=C5=BAwiak?= Date: Wed, 19 Dec 2018 14:30:59 +0100 Subject: [PATCH] API calls with JSON format Changed parameters format from query to json in API calls --- Model/CardTransaction.php | 3 +-- composer.json | 2 +- etc/module.xml | 2 +- lib/Curl.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Model/CardTransaction.php b/Model/CardTransaction.php index 77b1252..f81b1f7 100644 --- a/Model/CardTransaction.php +++ b/Model/CardTransaction.php @@ -63,7 +63,6 @@ public function createCardTransaction($transactionData) $url = "{$this->urlApi}/{$this->apiKey}"; $transactionData['json'] = 1; - return (array)json_decode(Curl::doCurlRequest($url, $transactionData)); - + return json_decode(Curl::doCurlRequest($url, $transactionData), true); } } diff --git a/composer.json b/composer.json index cd9fdbe..45151c8 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "tpaycom/magento2cards", "description": "tpay.com card payments module", "type": "magento2-module", - "version": "1.3.1", + "version": "1.3.2", "license": [ "OSL-3.0" ], diff --git a/etc/module.xml b/etc/module.xml index a465bd7..d072fca 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -9,7 +9,7 @@ */ --> - + diff --git a/lib/Curl.php b/lib/Curl.php index c846b04..f8aec10 100644 --- a/lib/Curl.php +++ b/lib/Curl.php @@ -61,7 +61,7 @@ public static function doCurlRequest($url, $postData = []) curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_URL, $url);