@@ -236,7 +236,7 @@ |
||
| 236 | 236 | 'apiPaymentUrl' => 'https://pna.shaparak.ir/mhui/home/index/', |
| 237 | 237 | 'apiConfirmationUrl' => 'https://pna.shaparak.ir/mhipg/api/Payment/confirm', |
| 238 | 238 | 'CorporationPin' => '', |
| 239 | - 'currency' => 'R',//Can be R, T (Rial, Toman) |
|
| 239 | + 'currency' => 'R', //Can be R, T (Rial, Toman) |
|
| 240 | 240 | 'callbackUrl' => 'http://yoursite.com/path/to', |
| 241 | 241 | 'description' => 'payment using pna', |
| 242 | 242 | ], |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function __construct(Invoice $invoice, $settings) |
| 47 | 47 | { |
| 48 | 48 | $this->invoice($invoice); |
| 49 | - $this->settings = (object)$settings; |
|
| 49 | + $this->settings = (object) $settings; |
|
| 50 | 50 | $this->client = new Client(); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $data = [ |
| 69 | 69 | "CorporationPin" => $this->settings->CorporationPin, |
| 70 | 70 | "Amount" => $amount, |
| 71 | - "OrderId" => intval(1, time()) . crc32($this->invoice->getUuid()), |
|
| 71 | + "OrderId" => intval(1, time()).crc32($this->invoice->getUuid()), |
|
| 72 | 72 | "CallBackUrl" => $this->settings->callbackUrl, |
| 73 | 73 | "AdditionalData" => $description, |
| 74 | 74 | ]; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (isset($result['errors'])) { |
| 91 | 91 | throw new PurchaseFailedException($result['title'] ?? 'اطلاعات وارد شده اشتباه می باشد.', $result['status'] ?? 400); |
| 92 | 92 | } |
| 93 | - if (!isset($result['status']) || (string)$result['status'] !== '0') { |
|
| 93 | + if (!isset($result['status']) || (string) $result['status'] !== '0') { |
|
| 94 | 94 | throw new PurchaseFailedException($result['message'] ?? "خطای ناشناخته رخ داده است. در صورت کسر مبلغ از حساب حداکثر پس از 72 ساعت به حسابتان برمیگردد", $result['status'] ?? 400); |
| 95 | 95 | } |
| 96 | 96 | $this->invoice->transactionId($result['token']); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $transactionId = $this->invoice->getTransactionId(); |
| 109 | 109 | $paymentUrl = $this->settings->apiPaymentUrl; |
| 110 | 110 | |
| 111 | - $payUrl = $paymentUrl . $transactionId; |
|
| 111 | + $payUrl = $paymentUrl.$transactionId; |
|
| 112 | 112 | |
| 113 | 113 | return $this->redirectWithForm($payUrl, [], 'GET'); |
| 114 | 114 | } |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | ); |
| 139 | 139 | $result = json_decode($response->getBody()->getContents(), true); |
| 140 | 140 | if (!isset($result['status']) |
| 141 | - || ((string)$result['status'] !== '0' |
|
| 142 | - && (string)$result['status'] !== '2') |
|
| 143 | - || (string)$result['rrn'] === '0') { |
|
| 141 | + || ((string) $result['status'] !== '0' |
|
| 142 | + && (string) $result['status'] !== '2') |
|
| 143 | + || (string) $result['rrn'] === '0') { |
|
| 144 | 144 | throw new InvalidPaymentException("خطای ناشناخته رخ داده است. در صورت کسر مبلغ از حساب حداکثر پس از 72 ساعت به حسابتان برمیگردد", $result['status'] ?? 400); |
| 145 | 145 | } |
| 146 | 146 | $refId = $result['rrn']; |