@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | $context = stream_context_create( |
57 | 57 | [ |
58 | 58 | 'ssl' => array( |
59 | - 'verify_peer' => false, |
|
60 | - 'verify_peer_name' => false |
|
59 | + 'verify_peer' => false, |
|
60 | + 'verify_peer_name' => false |
|
61 | 61 | )] |
62 | 62 | ); |
63 | 63 | |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | $context = stream_context_create( |
131 | 131 | [ |
132 | 132 | 'ssl' => array( |
133 | - 'verify_peer' => false, |
|
134 | - 'verify_peer_name' => false |
|
133 | + 'verify_peer' => false, |
|
134 | + 'verify_peer_name' => false |
|
135 | 135 | )] |
136 | 136 | ); |
137 | 137 |
@@ -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 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function __construct(Invoice $invoice, $settings) |
59 | 59 | { |
60 | 60 | $this->invoice($invoice); |
61 | - $this->settings = (object)$settings; |
|
61 | + $this->settings = (object) $settings; |
|
62 | 62 | |
63 | 63 | //convert to rial |
64 | 64 | $this->invoice->amount($this->invoice->getAmount() * 10); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | 'localInvoiceId' => $this->invoice->getUuid(), |
200 | 200 | 'amountInRials' => $this->invoice->getAmount(), |
201 | 201 | 'localDate' => $this->getTime()['content'], |
202 | - 'callbackURL' => $this->settings->callbackUrl . "?" . http_build_query(['invoice' => $this->invoice->getUuid()]), |
|
202 | + 'callbackURL' => $this->settings->callbackUrl."?".http_build_query(['invoice' => $this->invoice->getUuid()]), |
|
203 | 203 | 'paymentId' => "0", |
204 | 204 | 'additionalData' => '', |
205 | 205 | ]); |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | public function reverse(): array |
214 | 214 | { |
215 | 215 | return $this->callApi('POST', self::ReverseURL, [ |
216 | - 'merchantConfigurationId' => (int)$this->settings->merchantConfigID, |
|
217 | - 'payGateTranId' => (int)$this->invoice->getUuid() |
|
216 | + 'merchantConfigurationId' => (int) $this->settings->merchantConfigID, |
|
217 | + 'payGateTranId' => (int) $this->invoice->getUuid() |
|
218 | 218 | ]); |
219 | 219 | } |
220 | 220 | |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | public function cancel(): array |
227 | 227 | { |
228 | 228 | return $this->callApi('POST', self::CancelURL, [ |
229 | - 'merchantConfigurationId' => (int)$this->settings->merchantConfigID, |
|
230 | - 'payGateTranId' => (int)$this->payGateTransactionId |
|
229 | + 'merchantConfigurationId' => (int) $this->settings->merchantConfigID, |
|
230 | + 'payGateTranId' => (int) $this->payGateTransactionId |
|
231 | 231 | ]); |
232 | 232 | } |
233 | 233 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | public function verifyTransaction(): array |
240 | 240 | { |
241 | 241 | return $this->callApi('POST', self::VerifyURL, [ |
242 | - 'merchantConfigurationId' => (int)$this->settings->merchantConfigID, |
|
243 | - 'payGateTranId' => (int)$this->payGateTransactionId |
|
242 | + 'merchantConfigurationId' => (int) $this->settings->merchantConfigID, |
|
243 | + 'payGateTranId' => (int) $this->payGateTransactionId |
|
244 | 244 | ]); |
245 | 245 | } |
246 | 246 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | public function settlement(): array |
253 | 253 | { |
254 | 254 | return $this->callApi('POST', self::SettlementURL, [ |
255 | - 'merchantConfigurationId' => (int)$this->settings->merchantConfigID, |
|
256 | - 'payGateTranId' => (int)$this->payGateTransactionId |
|
255 | + 'merchantConfigurationId' => (int) $this->settings->merchantConfigID, |
|
256 | + 'payGateTranId' => (int) $this->payGateTransactionId |
|
257 | 257 | ]); |
258 | 258 | } |
259 | 259 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function cardHash(): array |
266 | 266 | { |
267 | - return $this->callApi('GET', self::CardHashURL . '?merchantConfigurationId=' . $this->settings->merchantConfigID . '&localInvoiceId=' . $this->invoice->getTransactionId(), []); |
|
267 | + return $this->callApi('GET', self::CardHashURL.'?merchantConfigurationId='.$this->settings->merchantConfigID.'&localInvoiceId='.$this->invoice->getTransactionId(), []); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function transactionResult(): array |
276 | 276 | { |
277 | - return $this->callApi('GET', self::TranResultURL . '?merchantConfigurationId=' . $this->settings->merchantConfigID . '&localInvoiceId=' . $this->invoice->getTransactionId(), []); |
|
277 | + return $this->callApi('GET', self::TranResultURL.'?merchantConfigurationId='.$this->settings->merchantConfigID.'&localInvoiceId='.$this->invoice->getTransactionId(), []); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public function __construct(Invoice $invoice, $settings) |
44 | 44 | { |
45 | 45 | $this->invoice($invoice); |
46 | - $this->settings = (object)$settings; |
|
46 | + $this->settings = (object) $settings; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function pay(): RedirectionForm |
77 | 77 | { |
78 | - return $this->redirectWithForm($this->settings->apiPaymentUrl . $this->invoice->getTransactionId(), [], 'GET'); |
|
78 | + return $this->redirectWithForm($this->settings->apiPaymentUrl.$this->invoice->getTransactionId(), [], 'GET'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -120,7 +120,7 @@ |
||
120 | 120 | $transactionId = $this->invoice->getTransactionId(); |
121 | 121 | $paymentUrl = $this->getPaymentUrl(); |
122 | 122 | |
123 | - $payUrl = $paymentUrl . $transactionId; |
|
123 | + $payUrl = $paymentUrl.$transactionId; |
|
124 | 124 | |
125 | 125 | return $this->redirectWithForm($payUrl, [], 'GET'); |
126 | 126 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | public function __construct(Invoice $invoice, $settings) |
37 | 37 | { |
38 | 38 | $this->invoice($invoice); |
39 | - $this->settings = (object)$settings; |
|
39 | + $this->settings = (object) $settings; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->invoice($invoice); |
47 | 47 | $this->setUpHttpClient($settings->apiBaseUrl); |
48 | - $this->settings=$settings; |
|
48 | + $this->settings = $settings; |
|
49 | 49 | $this->accessToken = $this->getAccessToken(); |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function purchase(): string |
56 | 56 | { |
57 | 57 | $details = $this->invoice->getDetails(); |
58 | - $phone = $details['phone']??$details['mobile']??null; |
|
58 | + $phone = $details['phone'] ?? $details['mobile'] ?? null; |
|
59 | 59 | $data = [ |
60 | 60 | 'amount' => $this->invoice->getAmount(), |
61 | 61 | 'phone' => $phone, |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function verify(): ReceiptInterface |
89 | 89 | { |
90 | - $tracingId=Request::input("trackingCode"); |
|
91 | - $header =[ |
|
90 | + $tracingId = Request::input("trackingCode"); |
|
91 | + $header = [ |
|
92 | 92 | "Accept" => "application/json", |
93 | 93 | "Authorization" => "Bearer ".$this->accessToken |
94 | 94 | ]; |
@@ -130,7 +130,7 @@ |
||
130 | 130 | |
131 | 131 | $responseData = json_decode($response->getBody()->getContents(), true); |
132 | 132 | |
133 | - return $this->response($responseData??[], $response->getStatusCode()); |
|
133 | + return $this->response($responseData ?? [], $response->getStatusCode()); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -292,8 +292,8 @@ |
||
292 | 292 | */ |
293 | 293 | public function throwError(string $exception, string $message = null) |
294 | 294 | { |
295 | - if (! $this->isSuccess()) { |
|
296 | - throw new $exception($message??$this->getStatusMessages()); |
|
295 | + if (!$this->isSuccess()) { |
|
296 | + throw new $exception($message ?? $this->getStatusMessages()); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 |