@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function __construct(Invoice $invoice, $settings) |
38 | 38 | { |
39 | 39 | $this->invoice($invoice); |
40 | - $this->settings = (object)$settings; |
|
40 | + $this->settings = (object) $settings; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $response = $soap->RequestToken($data['MID'], $data['ResNum'], $data['Amount'], $data['CellNumber']); |
79 | 79 | |
80 | - $status = (int)$response; |
|
80 | + $status = (int) $response; |
|
81 | 81 | |
82 | 82 | if ($status < 0) { // if something has done in a wrong way |
83 | 83 | $this->purchaseFailed($response); |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | ]), |
137 | 137 | ] |
138 | 138 | ); |
139 | - $status = (int)$soap->VerifyTransaction($data['RefNum'], $data['merchantId']); |
|
139 | + $status = (int) $soap->VerifyTransaction($data['RefNum'], $data['merchantId']); |
|
140 | 140 | |
141 | 141 | if ($status < 0) { |
142 | 142 | $this->notVerified($status); |
143 | 143 | } |
144 | 144 | |
145 | - $receipt = $this->createReceipt($data['RefNum']); |
|
145 | + $receipt = $this->createReceipt($data['RefNum']); |
|
146 | 146 | $receipt->detail([ |
147 | 147 | 'traceNo' => Request::input('TraceNo'), |
148 | 148 | 'referenceNo' => Request::input('RRN'), |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | ); |
233 | 233 | |
234 | 234 | if (array_key_exists($status, $translations)) { |
235 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
235 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
236 | 236 | } else { |
237 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
237 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
238 | 238 | } |
239 | 239 | } |
240 | 240 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function __construct(Invoice $invoice, $settings) |
46 | 46 | { |
47 | 47 | $this->invoice($invoice); // Set the invoice. |
48 | - $this->settings = (object)$settings; // Set settings. |
|
48 | + $this->settings = (object) $settings; // Set settings. |
|
49 | 49 | $this->client = new Client(); |
50 | 50 | } |
51 | 51 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function pay(): RedirectionForm |
106 | 106 | { |
107 | - $payUrl = $this->settings->apiPaymentUrl . $this->invoice->getTransactionId(); |
|
107 | + $payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId(); |
|
108 | 108 | |
109 | 109 | return $this->redirectWithForm($payUrl, [], 'GET'); |
110 | 110 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $response = $this->client->request( |
127 | 127 | 'POST', |
128 | - $this->settings->apiVerificationUrl . $paymentId, |
|
128 | + $this->settings->apiVerificationUrl.$paymentId, |
|
129 | 129 | [ |
130 | 130 | "http_errors" => false, |
131 | 131 | "headers" => [ |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | private function notVerified($message, $status) |
158 | 158 | { |
159 | 159 | if (empty($message)) { |
160 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
160 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
161 | 161 | } else { |
162 | - throw new InvalidPaymentException($message, (int)$status); |
|
162 | + throw new InvalidPaymentException($message, (int) $status); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $error_message = $r['errorMessage']; |
139 | 139 | throw new InvalidPaymentException($error_message); |
140 | 140 | } else { //success |
141 | - $receipt = $this->createReceipt($params['referenceNumber']); |
|
141 | + $receipt = $this->createReceipt($params['referenceNumber']); |
|
142 | 142 | $receipt->detail([ |
143 | 143 | 'referenceNo' => $params['referenceNumber'], |
144 | 144 | 'rrn' => Request::input('rrn'), |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | $error_message = $result['error']; |
152 | - throw new InvalidPaymentException($error_message, (int)$result['success']); |
|
152 | + throw new InvalidPaymentException($error_message, (int) $result['success']); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 |
@@ -126,7 +126,7 @@ |
||
126 | 126 | |
127 | 127 | if ($result->Status != 100) { |
128 | 128 | $message = $this->translateStatus($result->Status); |
129 | - throw new InvalidPaymentException($message, (int)$result->Status); |
|
129 | + throw new InvalidPaymentException($message, (int) $result->Status); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $this->createReceipt($result->RefID); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'sign' => |
82 | 82 | hash_hmac( |
83 | 83 | 'SHA512', |
84 | - $amount . '#' . $order_id . '#' . $callback, |
|
84 | + $amount.'#'.$order_id.'#'.$callback, |
|
85 | 85 | $this->settings->signKey |
86 | 86 | ), |
87 | 87 | ]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'headers' => [ |
96 | 96 | 'Content-Type' => 'application/json', |
97 | 97 | 'Accept' => 'application/json', |
98 | - 'Authorization' => 'Bearer ' . $this->settings->gatewayId, |
|
98 | + 'Authorization' => 'Bearer '.$this->settings->gatewayId, |
|
99 | 99 | ], |
100 | 100 | 'body' => json_encode($data), |
101 | 101 | ] |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'sign' => |
158 | 158 | hash_hmac( |
159 | 159 | 'SHA512', |
160 | - $amount . '#' . $refNum . '#' . $cardNumber . '#' . $trackingCode, |
|
160 | + $amount.'#'.$refNum.'#'.$cardNumber.'#'.$trackingCode, |
|
161 | 161 | $this->settings->signKey |
162 | 162 | ), |
163 | 163 | ]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | 'headers' => [ |
170 | 170 | 'Content-Type' => 'application/json', |
171 | 171 | 'Accept' => 'application/json', |
172 | - 'Authorization' => 'Bearer ' . $this->settings->gatewayId, |
|
172 | + 'Authorization' => 'Bearer '.$this->settings->gatewayId, |
|
173 | 173 | ], |
174 | 174 | 'body' => json_encode($data), |
175 | 175 | ] |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $body = json_decode($response->getBody()->getContents()); |
179 | 179 | |
180 | 180 | if ($body->status !== 1) { |
181 | - throw new InvalidPaymentException($this->translateStatus($body->status), (int)$body->status); |
|
181 | + throw new InvalidPaymentException($this->translateStatus($body->status), (int) $body->status); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return $this->createReceipt($refNum); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function __construct(Invoice $invoice, $settings) |
46 | 46 | { |
47 | 47 | $this->invoice($invoice); |
48 | - $this->settings = (object)$settings; |
|
48 | + $this->settings = (object) $settings; |
|
49 | 49 | $this->client = new Client(); |
50 | 50 | } |
51 | 51 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $responseBody = mb_strtolower($response->getBody()->getContents()); |
88 | 88 | $body = @json_decode($responseBody, true); |
89 | - $statusCode = (int)$body['status']; |
|
89 | + $statusCode = (int) $body['status']; |
|
90 | 90 | |
91 | 91 | if ($statusCode !== 200) { |
92 | 92 | // some error has happened |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | { |
143 | 143 | $basePayUrl = $this->settings->mode == 'normal' ? $this->settings->apiPaymentUrl |
144 | 144 | : $this->settings->apiDirectPaymentUrl; |
145 | - $payUrl = $basePayUrl . $this->invoice->getTransactionId(); |
|
145 | + $payUrl = $basePayUrl.$this->invoice->getTransactionId(); |
|
146 | 146 | |
147 | 147 | return $this->redirectWithForm($payUrl, [], 'GET'); |
148 | 148 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | $responseBody = mb_strtolower($response->getBody()->getContents()); |
179 | 179 | $body = @json_decode($responseBody, true); |
180 | - $statusCode = (int)$body['status']; |
|
180 | + $statusCode = (int) $body['status']; |
|
181 | 181 | |
182 | 182 | if ($statusCode !== 200) { |
183 | 183 | $message = $body['message'] ?? $this->convertStatusCodeToMessage($statusCode); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function notVerified($message, $status) |
205 | 205 | { |
206 | - throw new InvalidPaymentException($message, (int)$status); |
|
206 | + throw new InvalidPaymentException($message, (int) $status); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |