@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if (empty($body['code']) || $body['code'] != -1) { |
83 | 83 | // error has happened |
84 | - throw new PurchaseFailedException($body['message'],$body['code']??0); |
|
84 | + throw new PurchaseFailedException($body['message'], $body['code'] ?? 0); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->invoice->transactionId($body['trans_id']); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (!isset($body['code']) || $body['code'] != 0) { |
138 | 138 | $message = $body['message'] ?? 'خطای ناشناخته ای رخت داده است'; |
139 | 139 | |
140 | - throw new InvalidPaymentException($message,$body['code']??0); |
|
140 | + throw new InvalidPaymentException($message, $body['code'] ?? 0); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $this->createReceipt($transactionId); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // some error has happened |
107 | 107 | $message = is_array($body) ? array_pop($body) : $this->convertStatusCodeToMessage($statusCode); |
108 | 108 | |
109 | - throw new PurchaseFailedException($message,is_numeric($statusCode)?$statusCode:0); |
|
109 | + throw new PurchaseFailedException($message, is_numeric($statusCode) ? $statusCode : 0); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $this->invoice->transactionId($body['code']); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ($statusCode !== 200) { |
165 | 165 | $message = is_array($body) ? array_pop($body) : $this->convertStatusCodeToMessage($statusCode); |
166 | 166 | |
167 | - $this->notVerified($message,is_numeric($statusCode)?$statusCode:0); |
|
167 | + $this->notVerified($message, is_numeric($statusCode) ? $statusCode : 0); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | return $this->createReceipt($refId); |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @throws InvalidPaymentException |
193 | 193 | */ |
194 | - private function notVerified($message,$status = 0) |
|
194 | + private function notVerified($message, $status = 0) |
|
195 | 195 | { |
196 | - throw new InvalidPaymentException($message,$status); |
|
196 | + throw new InvalidPaymentException($message, $status); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -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 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | $response = $soap->RequestToken($data['MID'], $data['ResNum'], $data['Amount'], $data['CellNumber']); |
70 | 70 | |
71 | - $status = (int)$response; |
|
71 | + $status = (int) $response; |
|
72 | 72 | |
73 | 73 | if ($status < 0) { // if something has done in a wrong way |
74 | 74 | $this->purchaseFailed($response); |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | $soap = new \SoapClient($this->settings->apiVerificationUrl); |
119 | - $status = (int)$soap->VerifyTransaction($data['RefNum'], $data['merchantId']); |
|
119 | + $status = (int) $soap->VerifyTransaction($data['RefNum'], $data['merchantId']); |
|
120 | 120 | |
121 | 121 | if ($status < 0) { |
122 | 122 | $this->notVerified($status); |
123 | 123 | } |
124 | 124 | |
125 | - $receipt = $this->createReceipt($data['RefNum']); |
|
125 | + $receipt = $this->createReceipt($data['RefNum']); |
|
126 | 126 | $receipt->detail([ |
127 | 127 | 'traceNo' => Request::input('TraceNo'), |
128 | 128 | 'referenceNo' => Request::input('RRN'), |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | if (array_key_exists($status, $translations)) { |
179 | - throw new PurchaseFailedException($translations[$status],is_numeric($status)?$status:0); |
|
179 | + throw new PurchaseFailedException($translations[$status], is_numeric($status) ? $status : 0); |
|
180 | 180 | } else { |
181 | - throw new PurchaseFailedException('خطای ناشناخته ای رخ داده است.',is_numeric($status)?$status:0); |
|
181 | + throw new PurchaseFailedException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | ); |
212 | 212 | |
213 | 213 | if (array_key_exists($status, $translations)) { |
214 | - throw new InvalidPaymentException($translations[$status],is_numeric($status)?$status:0); |
|
214 | + throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0); |
|
215 | 215 | } else { |
216 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.',is_numeric($status)?$status:0); |
|
216 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |
@@ -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 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $result = $result->RequestOperationResult; |
62 | 62 | if ($result[0] != '0') { |
63 | - $message = "خطای شماره " . $result . " رخ داده است."; |
|
63 | + $message = "خطای شماره ".$result." رخ داده است."; |
|
64 | 64 | throw new PurchaseFailedException($message); |
65 | 65 | } |
66 | 66 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $payGateTranID = $returningParams[5]; |
120 | 120 | |
121 | 121 | if ($resCode != '0' && $resCode != '00') { |
122 | - $message = "خطای شماره " . $resCode . " رخ داده و تراکنش ناموفق بوده است."; |
|
122 | + $message = "خطای شماره ".$resCode." رخ داده و تراکنش ناموفق بوده است."; |
|
123 | 123 | throw new InvalidPaymentException($message); |
124 | 124 | } |
125 | 125 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | |
161 | 161 | $result = $result->RequestVerificationResult; |
162 | 162 | if ($result != '500') { |
163 | - $message = "خطای شماره: " . $result . " در هنگام Verify"; |
|
164 | - throw new InvalidPaymentException($message,is_numeric($result)?$result:0); |
|
163 | + $message = "خطای شماره: ".$result." در هنگام Verify"; |
|
164 | + throw new InvalidPaymentException($message, is_numeric($result) ? $result : 0); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | |
183 | 183 | $result = $result->RequestReconciliationResult; |
184 | 184 | if ($result != '600') { |
185 | - $message = "خطای شماره: " . $result . " در هنگام Settlement"; |
|
186 | - throw new InvalidPaymentException($message,is_numeric($result)?$result:0); |
|
185 | + $message = "خطای شماره: ".$result." در هنگام Settlement"; |
|
186 | + throw new InvalidPaymentException($message, is_numeric($result) ? $result : 0); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 |
@@ -126,7 +126,7 @@ |
||
126 | 126 | |
127 | 127 | if ($result->Status != 100) { |
128 | 128 | $message = $this->translateStatus($result->Status); |
129 | - throw new InvalidPaymentException($message,is_numeric($result->Status)?$result->Status:0); |
|
129 | + throw new InvalidPaymentException($message, is_numeric($result->Status) ? $result->Status : 0); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $this->createReceipt($result->RefID); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | |
86 | 86 | if (is_numeric($body)) { |
87 | 87 | // some error has happened |
88 | - throw new PurchaseFailedException($this->translateStatus($body),$body); |
|
88 | + throw new PurchaseFailedException($this->translateStatus($body), $body); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $this->invoice->transactionId($body); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | if ($response->Code != 100) { |
96 | 96 | //"Request failed with Error code: $response->Code and Error message: $response->Description"; |
97 | - throw new PurchaseFailedException($response->Description,is_numeric($response->Code)?$response->Code:0); |
|
97 | + throw new PurchaseFailedException($response->Description, is_numeric($response->Code) ? $response->Code : 0); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $this->invoice->transactionId($response->Authority); |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | * @param $message |
164 | 164 | * @throws InvalidPaymentException |
165 | 165 | */ |
166 | - private function notVerified($message,$status=0) |
|
166 | + private function notVerified($message, $status = 0) |
|
167 | 167 | { |
168 | 168 | if ($message) { |
169 | - throw new InvalidPaymentException($message,is_numeric($status)?$status:0); |
|
169 | + throw new InvalidPaymentException($message, is_numeric($status) ? $status : 0); |
|
170 | 170 | } else { |
171 | - throw new InvalidPaymentException('payment failed',is_numeric($status)?$status:0); |
|
171 | + throw new InvalidPaymentException('payment failed', is_numeric($status) ? $status : 0); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function __construct(Invoice $invoice, $settings) |
40 | 40 | { |
41 | 41 | $this->invoice($invoice); |
42 | - $this->settings = (object)$settings; |
|
42 | + $this->settings = (object) $settings; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $mobile = ''; |
57 | 57 | //set CellNumber for get user cards |
58 | 58 | if (!empty($this->invoice->getDetails()['mobile'])) { |
59 | - $mobile = '&CellNumber=' . $this->invoice->getDetails()['mobile']; |
|
59 | + $mobile = '&CellNumber='.$this->invoice->getDetails()['mobile']; |
|
60 | 60 | } |
61 | 61 | |
62 | - $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; |
|
62 | + $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; |
|
63 | 63 | $address_service_token = $this->settings->apiGetToken; |
64 | 64 | |
65 | 65 | $token_array = $this->makeHttpChargeRequest('POST', $data_query, $address_service_token); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->notVerified($resp_code); |
113 | 113 | } |
114 | 114 | |
115 | - $data_query = 'digitalreceipt=' . Request::input('digitalreceipt') . '&Tid=' . $this->settings->terminalId; |
|
115 | + $data_query = 'digitalreceipt='.Request::input('digitalreceipt').'&Tid='.$this->settings->terminalId; |
|
116 | 116 | $advice_array = $this->makeHttpChargeRequest('POST', $data_query, $this->settings->apiVerificationUrl); |
117 | 117 | $decode_advice_array = json_decode($advice_array); |
118 | 118 | |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | ); |
189 | 189 | |
190 | 190 | if (array_key_exists($status, $translations)) { |
191 | - throw new InvalidPaymentException($translations[$status],is_numeric($status)?$status:0); |
|
191 | + throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0); |
|
192 | 192 | } else { |
193 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.',is_numeric($status)?$status:0); |
|
193 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 |
@@ -233,9 +233,9 @@ |
||
233 | 233 | "54" => "مدت زمان تایید پرداخت سپری شده است.", |
234 | 234 | ); |
235 | 235 | if (array_key_exists($status, $translations)) { |
236 | - throw new InvalidPaymentException($translations[$status],is_numeric($status)?$status:0); |
|
236 | + throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0); |
|
237 | 237 | } else { |
238 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.',is_numeric($status)?$status:0); |
|
238 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |