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);