@@ -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 | /** |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | $mobile = ''; |
55 | 55 | //set CellNumber for get user cards |
56 | 56 | if (!empty($this->invoice->getDetails()['mobile'])) { |
57 | - $mobile = '&CellNumber=' . $this->invoice->getDetails()['mobile']; |
|
57 | + $mobile = '&CellNumber='.$this->invoice->getDetails()['mobile']; |
|
58 | 58 | } |
59 | 59 | |
60 | - $data_query = 'Amount=' . $this->test_input($amount) . '&callbackURL=' . $this->test_input($this->settings->callbackUrl) . '&InvoiceID=' . $this->test_input($this->invoice->getUuid()) . '&TerminalID=' . $this->test_input($this->settings->terminalId) . '&Payload=' . $this->test_input("") . $mobile; |
|
60 | + $data_query = 'Amount='.$this->test_input($amount).'&callbackURL='.$this->test_input($this->settings->callbackUrl).'&InvoiceID='.$this->test_input($this->invoice->getUuid()).'&TerminalID='.$this->test_input($this->settings->terminalId).'&Payload='.$this->test_input("").$mobile; |
|
61 | 61 | $address_service_token = $this->settings->apiGetToken; |
62 | 62 | |
63 | 63 | $token_array = $this->makeHttpChargeRequest('POST', $data_query, $address_service_token); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $this->notVerified($responseCode); |
111 | 111 | } |
112 | 112 | |
113 | - $data_query = 'digitalreceipt=' . Request::input('digitalreceipt') . '&Tid=' . $this->settings->terminalId; |
|
113 | + $data_query = 'digitalreceipt='.Request::input('digitalreceipt').'&Tid='.$this->settings->terminalId; |
|
114 | 114 | $advice_array = $this->makeHttpChargeRequest('POST', $data_query, $this->settings->apiVerificationUrl); |
115 | 115 | $decode_advice_array = json_decode($advice_array); |
116 | 116 | |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | ); |
187 | 187 | |
188 | 188 | if (array_key_exists($status, $translations)) { |
189 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
189 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
190 | 190 | } else { |
191 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
191 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | $this->base_url = $this->settings->base_url; |
35 | 35 | $this->shop_slug = $this->settings->shop_slug; |
36 | 36 | $this->auth_code = $this->settings->auth_code; |
37 | - $this->code = $this->shop_slug . ':' . $this->auth_code; |
|
38 | - $this->auth_token = base64_encode($this->code); |
|
37 | + $this->code = $this->shop_slug.':'.$this->auth_code; |
|
38 | + $this->auth_token = base64_encode($this->code); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // Purchase the invoice, save its transactionId and finaly return it. |
42 | 42 | public function purchase() |
43 | 43 | { |
44 | - $url = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals"; |
|
44 | + $url = $this->base_url."/users/me/shops/".$this->shop_slug."/deals"; |
|
45 | 45 | $data = $this->settings->data; |
46 | 46 | |
47 | - $response = Http::withHeaders([ |
|
47 | + $response = Http::withHeaders([ |
|
48 | 48 | 'Authorization' => "Basic {$this->auth_token}", |
49 | 49 | "Content-Type" => 'application/json' |
50 | 50 | ])->post($url, $data); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function pay(): RedirectionForm |
64 | 64 | { |
65 | 65 | $transactionId = $this->invoice->getTransactionId(); |
66 | - $redirect_url = $this->base_url . '/deals/' . $transactionId . '/redirect'; |
|
66 | + $redirect_url = $this->base_url.'/deals/'.$transactionId.'/redirect'; |
|
67 | 67 | |
68 | 68 | return $this->redirectWithForm($redirect_url, [], 'GET'); |
69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $state = Request::input('state'); |
75 | 75 | |
76 | 76 | $transactionId = $this->invoice->getTransactionId(); |
77 | - $verifyUrl = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals/" . $transactionId . "/verify"; |
|
77 | + $verifyUrl = $this->base_url."/users/me/shops/".$this->shop_slug."/deals/".$transactionId."/verify"; |
|
78 | 78 | |
79 | 79 | if ($state != 'funded') { |
80 | 80 | throw new InvalidPaymentException('پرداخت انجام نشد'); |