From 56a44a6db7cc8993b80125cb515b75179b1b696c Mon Sep 17 00:00:00 2001 From: Iman Date: Wed, 14 Feb 2018 13:38:13 -0600 Subject: [PATCH 1/3] Update Saman.php flatten code --- src/Saman/Saman.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Saman/Saman.php b/src/Saman/Saman.php index 596ee5ab..c89f067c 100644 --- a/src/Saman/Saman.php +++ b/src/Saman/Saman.php @@ -141,32 +141,32 @@ protected function verifyPayment() $response = intval($response); - if ($response != $this->amount) { - - //Reverse Transaction - if($response>0){ - try { - $soap = new SoapClient($this->serverUrl); - $response = $soap->ReverseTransaction($fields["RefNum"], $fields["merchantID"], $fields["password"], $response); - - } catch (\SoapFault $e) { - $this->transactionFailed(); - $this->newLog('SoapFault', $e->getMessage()); - throw $e; - } - } + if ($response == $this->amount) { + $this->transactionSucceed(); + return true; + } - // - $this->transactionFailed(); - $this->newLog($response, SamanException::$errors[$response]); - throw new SamanException($response); + //Reverse Transaction + if($response>0){ + try { + $soap = new SoapClient($this->serverUrl); + $response = $soap->ReverseTransaction($fields["RefNum"], $fields["merchantID"], $fields["password"], $response); + + } catch (\SoapFault $e) { + $this->transactionFailed(); + $this->newLog('SoapFault', $e->getMessage()); + throw $e; + } } + // + $this->transactionFailed(); + $this->newLog($response, SamanException::$errors[$response]); + throw new SamanException($response); + - $this->transactionSucceed(); - return true; } -} \ No newline at end of file +} From 3c28172a62de83079ca348fe02ce4c6f661ac9cc Mon Sep 17 00:00:00 2001 From: Iman Date: Wed, 14 Feb 2018 13:44:22 -0600 Subject: [PATCH 2/3] Create .styleci.yml --- .styleci.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .styleci.yml diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 00000000..c303f4e8 --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,6 @@ +preset: laravel + +linting: true + +disabled: + - single_class_element_per_statement From 094e2c7b166608c55c099b5772f01f2fa0d61a6b Mon Sep 17 00:00:00 2001 From: Iman Date: Wed, 14 Feb 2018 13:56:24 -0600 Subject: [PATCH 3/3] Update Sadad.php flatten code --- src/Sadad/Sadad.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Sadad/Sadad.php b/src/Sadad/Sadad.php index 73b6ed75..0de6c29d 100644 --- a/src/Sadad/Sadad.php +++ b/src/Sadad/Sadad.php @@ -188,15 +188,17 @@ protected function verifyPayment() private function getMessage($code, $message) { $result = SadadResult::codeResponse($code, $message); - if (!$result) { - $result = array( - 'code' => SadadResult::UNKNOWN_CODE, - 'message' => SadadResult::UNKNOWN_MESSAGE, - 'fa' => 'خطای ناشناخته', - 'en' => 'Unknown Error', - 'retry' => false - ); + if ($result) { + return $result; } + $result = array( + 'code' => SadadResult::UNKNOWN_CODE, + 'message' => SadadResult::UNKNOWN_MESSAGE, + 'fa' => 'خطای ناشناخته', + 'en' => 'Unknown Error', + 'retry' => false + ); + return $result; }