@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $result = $this->payment_request($amount, $callbackUrl); |
| 15 | 15 | |
| 16 | - if(isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result['status'] == 1) { |
|
| 16 | + if (isset($detail['auto_redirect']) && $detail['auto_redirect'] == false && $result['status'] == 1) { |
|
| 17 | 17 | $result['token'] = $result['invoice_key']; |
| 18 | 18 | $this->updateTransactionData($transaction->id, ['token' => $result['invoice_key']]); |
| 19 | 19 | $result['url'] = config('gateway.information')['poolam']['constructor']['api_url'] . "pay/" . $result['token']; |
| 20 | 20 | return $result; |
| 21 | 21 | |
| 22 | - } elseif($result['status'] == 1) { |
|
| 22 | + } elseif ($result['status'] == 1) { |
|
| 23 | 23 | $this->updateTransactionData($transaction->id, ['token' => $result['invoice_key']]); |
| 24 | - header( 'Location: ' . config('gateway.information')['poolam']['constructor']['api_url'] . "pay/" . $result['invoice_key']); |
|
| 24 | + header('Location: ' . config('gateway.information')['poolam']['constructor']['api_url'] . "pay/" . $result['invoice_key']); |
|
| 25 | 25 | die(); |
| 26 | 26 | |
| 27 | 27 | } |
@@ -38,32 +38,32 @@ discard block |
||
| 38 | 38 | $check['order'] = $transaction->parent; |
| 39 | 39 | if ($check['status'] == 1) { |
| 40 | 40 | $this->updateTransactionData($transaction->id, ['status' => 'successful', 'ref_no' => $check['bank_code']]); |
| 41 | - }else { |
|
| 41 | + } else { |
|
| 42 | 42 | $this->updateTransactionData($transaction->id, ['status' => 'failed', 'ref_no' => $check['errorCode'], 'description' => $check['errorDescription']]); |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | return $check; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - protected function check_payment($inv_key){ |
|
| 48 | + protected function check_payment($inv_key) { |
|
| 49 | 49 | $ch = curl_init(); |
| 50 | - curl_setopt($ch,CURLOPT_URL,config('gateway.information')['poolam']['constructor']['api_url'] . 'check/'.$inv_key); |
|
| 51 | - curl_setopt($ch,CURLOPT_POSTFIELDS,"api_key=" . config('gateway.information')['poolam']['constructor']['api_key']); |
|
| 50 | + curl_setopt($ch, CURLOPT_URL, config('gateway.information')['poolam']['constructor']['api_url'] . 'check/' . $inv_key); |
|
| 51 | + curl_setopt($ch, CURLOPT_POSTFIELDS, "api_key=" . config('gateway.information')['poolam']['constructor']['api_key']); |
|
| 52 | 52 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
| 53 | - curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); |
|
| 53 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 54 | 54 | $res = curl_exec($ch); |
| 55 | 55 | curl_close($ch); |
| 56 | - return json_decode($res,1); |
|
| 56 | + return json_decode($res, 1); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - protected function payment_request($amount,$redirect){ |
|
| 59 | + protected function payment_request($amount, $redirect) { |
|
| 60 | 60 | $ch = curl_init(); |
| 61 | - curl_setopt($ch,CURLOPT_URL,config('gateway.information')['poolam']['constructor']['api_url'] . 'request'); |
|
| 62 | - curl_setopt($ch,CURLOPT_POSTFIELDS,"api_key=" . config('gateway.information')['poolam']['constructor']['api_key'] . "&amount=$amount&return_url=$redirect"); |
|
| 63 | - curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, FALSE); |
|
| 64 | - curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); |
|
| 61 | + curl_setopt($ch, CURLOPT_URL, config('gateway.information')['poolam']['constructor']['api_url'] . 'request'); |
|
| 62 | + curl_setopt($ch, CURLOPT_POSTFIELDS, "api_key=" . config('gateway.information')['poolam']['constructor']['api_key'] . "&amount=$amount&return_url=$redirect"); |
|
| 63 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
| 64 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
| 65 | 65 | $res = curl_exec($ch); |
| 66 | 66 | curl_close($ch); |
| 67 | - return json_decode($res,1); |
|
| 67 | + return json_decode($res, 1); |
|
| 68 | 68 | } |
| 69 | 69 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | $check['order'] = $transaction->parent; |
| 39 | 39 | if ($check['status'] == 1) { |
| 40 | 40 | $this->updateTransactionData($transaction->id, ['status' => 'successful', 'ref_no' => $check['bank_code']]); |
| 41 | - }else { |
|
| 41 | + } else { |
|
| 42 | 42 | $this->updateTransactionData($transaction->id, ['status' => 'failed', 'ref_no' => $check['errorCode'], 'description' => $check['errorDescription']]); |
| 43 | 43 | } |
| 44 | 44 | } |