@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct(Invoice $invoice, $settings) |
| 33 | 33 | { |
| 34 | 34 | $this->invoice($invoice); |
| 35 | - $this->settings = (object)$settings; |
|
| 35 | + $this->settings = (object) $settings; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $result = $response['ConfirmPaymentResult']; |
| 118 | 118 | |
| 119 | 119 | if (!isset($result['Status']) || $result['Status'] != 0 || !isset($result['RRN']) || $result['RRN'] <= 0) { |
| 120 | - $message = 'خطا از سمت بانک با کد ' . $result['Status'] . ' رخ داده است.'; |
|
| 120 | + $message = 'خطا از سمت بانک با کد '.$result['Status'].' رخ داده است.'; |
|
| 121 | 121 | throw new InvalidPaymentException($message); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct(Invoice $invoice, $settings) |
| 33 | 33 | { |
| 34 | 34 | $this->invoice($invoice); |
| 35 | - $this->settings = (object)$settings; |
|
| 35 | + $this->settings = (object) $settings; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $soap = new \SoapClient($this->settings->apiVerificationUrl); |
| 118 | 118 | $response = $soap->KicccPaymentsVerification($data); |
| 119 | 119 | |
| 120 | - $status = (int)($response->KicccPaymentsVerificationResult); |
|
| 120 | + $status = (int) ($response->KicccPaymentsVerificationResult); |
|
| 121 | 121 | |
| 122 | 122 | if ($status != $data['amount']) { |
| 123 | 123 | $this->notVerified($status); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct(Invoice $invoice, $settings) |
| 33 | 33 | { |
| 34 | 34 | $this->invoice($invoice); |
| 35 | - $this->settings = (object)$settings; |
|
| 35 | + $this->settings = (object) $settings; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | throw new PurchaseFailedException($error); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $data = explode (',', $response); |
|
| 64 | + $data = explode(',', $response); |
|
| 65 | 65 | |
| 66 | 66 | // purchase was not successful |
| 67 | 67 | if ($data[0] != "0") { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function verify() : ReceiptInterface |
| 104 | 104 | { |
| 105 | - $resCode = request()->get('ResCode'); |
|
| 105 | + $resCode = request()->get('ResCode'); |
|
| 106 | 106 | if ($resCode != '0') { |
| 107 | 107 | $message = $resCode ?? 'تراکنش نا موفق بوده است.'; |
| 108 | 108 | throw new InvalidPaymentException($message); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function __construct(Invoice $invoice, $settings) |
| 41 | 41 | { |
| 42 | 42 | $this->invoice($invoice); |
| 43 | - $this->settings = (object)$settings; |
|
| 43 | + $this->settings = (object) $settings; |
|
| 44 | 44 | $this->client = new Client(); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $body = json_decode($response->getBody()->getContents(), true); |
| 89 | 89 | |
| 90 | - if ($body->ResCode!=0) { |
|
| 90 | + if ($body->ResCode != 0) { |
|
| 91 | 91 | throw new PurchaseFailedException($body->Description); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $resCode = request()->get('ResCode'); |
| 127 | 127 | $message = 'تراکنش نا موفق بود در صورت کسر مبلغ از حساب شما حداکثر پس از 72 ساعت مبلغ به حسابتان برمیگردد.'; |
| 128 | 128 | |
| 129 | - if ($resCode==0) { |
|
| 129 | + if ($resCode == 0) { |
|
| 130 | 130 | throw new InvalidPaymentException($message); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | public function encrypt_pkcs7($str, $key) |
| 190 | 190 | { |
| 191 | 191 | $key = base64_decode($key); |
| 192 | - $ciphertext = OpenSSL_encrypt($str,"DES-EDE3", $key, OPENSSL_RAW_DATA); |
|
| 192 | + $ciphertext = OpenSSL_encrypt($str, "DES-EDE3", $key, OPENSSL_RAW_DATA); |
|
| 193 | 193 | |
| 194 | 194 | return base64_encode($ciphertext); |
| 195 | 195 | } |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * $resMessage = $returningParams[4]; |
| 114 | 114 | * $rrn = $returningParams[6]; |
| 115 | 115 | * $lastFourDigitOfPAN = $returningParams[7]; |
| 116 | - **/ |
|
| 116 | + **/ |
|
| 117 | 117 | |
| 118 | 118 | $resCode = $returningParams[3]; |
| 119 | 119 | $payGateTranID = $returningParams[5]; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct(Invoice $invoice, $settings) |
| 33 | 33 | { |
| 34 | 34 | $this->invoice($invoice); |
| 35 | - $this->settings = (object)$settings; |
|
| 35 | + $this->settings = (object) $settings; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | 'verify_peer_name' => false |
| 52 | 52 | ) |
| 53 | 53 | ); |
| 54 | - $configs = array ('stream_context' => stream_context_create($opts)); |
|
| 54 | + $configs = array('stream_context' => stream_context_create($opts)); |
|
| 55 | 55 | |
| 56 | 56 | $client = new \SoapClient($this->settings->apiPurchaseUrl, $configs); |
| 57 | 57 | |
| 58 | 58 | $params = $this->preparePurchaseData(); |
| 59 | 59 | $result = $client->RequestOperation($params); |
| 60 | 60 | |
| 61 | - if (! $result) { |
|
| 61 | + if (!$result) { |
|
| 62 | 62 | throw new PurchaseFailedException('خطای فراخوانی متد درخواست تراکنش.'); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | throw new PurchaseFailedException($message); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->invoice->transactionId(substr($result,2)); |
|
| 72 | + $this->invoice->transactionId(substr($result, 2)); |
|
| 73 | 73 | |
| 74 | 74 | // return the transaction's id |
| 75 | 75 | return $this->invoice->getTransactionId(); |
@@ -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 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | 'verify_peer_name' => false |
| 130 | 130 | ) |
| 131 | 131 | ); |
| 132 | - $configs = array ('stream_context' => stream_context_create($opts)); |
|
| 132 | + $configs = array('stream_context' => stream_context_create($opts)); |
|
| 133 | 133 | |
| 134 | 134 | $client = new \SoapClient($this->settings->apiVerificationUrl, $configs); |
| 135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // step1: verify |
| 139 | 139 | $result = $client->RequestVerification($params); |
| 140 | 140 | |
| 141 | - if (! $result) { |
|
| 141 | + if (!$result) { |
|
| 142 | 142 | throw new InvalidPaymentException("خطای فراخوانی متد وريفای رخ داده است."); |
| 143 | 143 | } |
| 144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // step2: settle |
| 152 | 152 | $result = $client->RequestReconciliation($params); |
| 153 | 153 | |
| 154 | - if(! $result) { |
|
| 154 | + if (!$result) { |
|
| 155 | 155 | throw new InvalidPaymentException('خطای فراخوانی متد تسويه رخ داده است.'); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function __construct(Invoice $invoice, $settings) |
| 41 | 41 | { |
| 42 | 42 | $this->invoice($invoice); |
| 43 | - $this->settings = (object)$settings; |
|
| 43 | + $this->settings = (object) $settings; |
|
| 44 | 44 | $this->client = new Client(); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if (strtolower($this->getMode()) == 'zaringate') { |
| 97 | 97 | $payUrl = str_replace(':authority', $transactionId, $paymentUrl); |
| 98 | 98 | } else { |
| 99 | - $payUrl = $paymentUrl . $transactionId; |
|
| 99 | + $payUrl = $paymentUrl.$transactionId; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // redirect using laravel logic |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | { |
| 194 | 194 | $mode = $this->getMode(); |
| 195 | 195 | |
| 196 | - switch($mode) { |
|
| 196 | + switch ($mode) { |
|
| 197 | 197 | case 'sandbox': |
| 198 | 198 | $url = $this->settings->sandboxApiPurchaseUrl; |
| 199 | 199 | break; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $mode = $this->getMode(); |
| 219 | 219 | |
| 220 | - switch($mode) { |
|
| 220 | + switch ($mode) { |
|
| 221 | 221 | case 'sandbox': |
| 222 | 222 | $url = $this->settings->sandboxApiPaymentUrl; |
| 223 | 223 | break; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | { |
| 242 | 242 | $mode = $this->getMode(); |
| 243 | 243 | |
| 244 | - switch($mode) { |
|
| 244 | + switch ($mode) { |
|
| 245 | 245 | case 'sandbox': |
| 246 | 246 | $url = $this->settings->sandboxApiVerificationUrl; |
| 247 | 247 | break; |
@@ -97,8 +97,8 @@ |
||
| 97 | 97 | */ |
| 98 | 98 | public function pay() |
| 99 | 99 | { |
| 100 | - $apiUrl = $this->settings->apiPaymentUrl; |
|
| 101 | - $payUrl = $apiUrl . $this->invoice->getTransactionId(); |
|
| 100 | + $apiUrl = $this->settings->apiPaymentUrl; |
|
| 101 | + $payUrl = $apiUrl.$this->invoice->getTransactionId(); |
|
| 102 | 102 | |
| 103 | 103 | // redirect using laravel logic |
| 104 | 104 | return redirect()->to($payUrl); |