@@ -93,7 +93,7 @@ |
||
| 93 | 93 | { |
| 94 | 94 | $strategy = static::$strategies[$this->getMode()] ?? null; |
| 95 | 95 | |
| 96 | - if (! $strategy) { |
|
| 96 | + if (!$strategy) { |
|
| 97 | 97 | $this->strategyNotFound(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $result = json_decode($response->getBody()->getContents(), true); |
| 102 | 102 | |
| 103 | 103 | // some error has happened |
| 104 | - if (! empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) { |
|
| 104 | + if (!empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) { |
|
| 105 | 105 | throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code']); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $result = json_decode($response->getBody()->getContents(), true); |
| 159 | 159 | |
| 160 | - if (empty($result['data']) || ! isset($result['data']['ref_id']) || $result['data']['code'] != 100) { |
|
| 160 | + if (empty($result['data']) || !isset($result['data']['ref_id']) || $result['data']['code'] != 100) { |
|
| 161 | 161 | $message = $result['errors']['message']; |
| 162 | 162 | $code = $result['errors']['code']; |
| 163 | 163 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function __construct(Invoice $invoice, $settings) |
| 39 | 39 | { |
| 40 | 40 | $this->invoice($invoice); |
| 41 | - $this->settings = (object)$settings; |
|
| 41 | + $this->settings = (object) $settings; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // purchase was not successful |
| 81 | 81 | if ($data[0] != "0") { |
| 82 | - throw new PurchaseFailedException($this->translateStatus($data[0]), (int)$data[0]); |
|
| 82 | + throw new PurchaseFailedException($this->translateStatus($data[0]), (int) $data[0]); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $this->invoice->transactionId($data[1]); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | // step1: verify request |
| 146 | - $verifyResponse = (int)$soap->bpVerifyRequest($data)->return; |
|
| 146 | + $verifyResponse = (int) $soap->bpVerifyRequest($data)->return; |
|
| 147 | 147 | if ($verifyResponse != 0) { |
| 148 | 148 | // rollback money and throw exception |
| 149 | 149 | // avoid rollback if request was already verified |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function __construct(Invoice $invoice, $settings) |
| 53 | 53 | { |
| 54 | 54 | $this->invoice($invoice); |
| 55 | - $this->settings=$settings; |
|
| 55 | + $this->settings = $settings; |
|
| 56 | 56 | $this->client = new Client(); |
| 57 | 57 | $this->oauthToken = $this->oauth(); |
| 58 | 58 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function verify(): ReceiptInterface |
| 115 | 115 | { |
| 116 | - $tracingId=Request::input("trackingCode"); |
|
| 116 | + $tracingId = Request::input("trackingCode"); |
|
| 117 | 117 | |
| 118 | 118 | $response = $this->client->request( |
| 119 | 119 | 'POST', |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | "grant_type" => 'password', |
| 156 | 156 | ] |
| 157 | 157 | ); |
| 158 | - if ($response->getStatusCode()!=200) { |
|
| 159 | - if ($response->getStatusCode()==401) { |
|
| 158 | + if ($response->getStatusCode() != 200) { |
|
| 159 | + if ($response->getStatusCode() == 401) { |
|
| 160 | 160 | throw new PurchaseFailedException("خطا نام کاربری یا رمز عبور شما اشتباه می باشد."); |
| 161 | 161 | } else { |
| 162 | 162 | throw new PurchaseFailedException("خطا در هنگام احراز هویت."); |