From bed62764ffac00b6934105ea6a4e196928a63616 Mon Sep 17 00:00:00 2001 From: mahdi khanzadi Date: Fri, 27 Dec 2019 14:16:52 +0330 Subject: [PATCH] fix bugs --- src/Drivers/Zibal/Zibal.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Drivers/Zibal/Zibal.php b/src/Drivers/Zibal/Zibal.php index d5eb1f0..962a314 100644 --- a/src/Drivers/Zibal/Zibal.php +++ b/src/Drivers/Zibal/Zibal.php @@ -83,17 +83,13 @@ public function purchase() 'mobile' => $mobile, //optional for mpg ); - $json = json_encode($data, JSON_UNESCAPED_UNICODE); - $response = $this->client->request( 'POST', $this->settings->apiPurchaseUrl, - [ - "form_params" => $json, - "http_errors" => false, - ] + ["json" => $data, "http_errors" => false] ); - $body = json_decode($response->getBody()->getContents(), true); + + $body = json_decode($response->getBody()->getContents(), false); if ($body->result != 100) { // some error has happened @@ -133,7 +129,7 @@ public function verify() : ReceiptInterface $orderId = request()->input('orderId'); $transactionId = $this->invoice->getTransactionId() ?? request()->input('trackId'); - if (!$successFlag != 1) { + if ($successFlag != 1) { $this->notVerified('پرداخت با شکست مواجه شد'); } @@ -143,14 +139,13 @@ public function verify() : ReceiptInterface "trackId" => $transactionId, //required ); - $json = json_encode($data, JSON_UNESCAPED_LINE_TERMINATORS); - $response = $this->client->request( 'POST', $this->settings->apiVerificationUrl, - ["form_params" => $json, "http_errors" => false] + ["json" => $data, "http_errors" => false] ); - $body = json_decode($response->getBody()->getContents(), true); + + $body = json_decode($response->getBody()->getContents(), false); if ($body->result != 100) { $this->notVerified($body->message);