@@ -138,7 +138,7 @@ |
||
138 | 138 | $error_message = $r['errorMessage']; |
139 | 139 | throw new InvalidPaymentException($error_message); |
140 | 140 | } else { //success |
141 | - $receipt = $this->createReceipt($data['referenceNumber']); |
|
141 | + $receipt = $this->createReceipt($data['referenceNumber']); |
|
142 | 142 | $receipt->detail([ |
143 | 143 | 'referenceNo' => $params['referenceNumber'], |
144 | 144 | 'rrn' => Request::input('rrn'), |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | define('ATIPAY_URL', 'https://mipg.atipay.net/v1/'); |
4 | -define('ATIPAY_TOKEN_URL', ATIPAY_URL . 'get-token'); |
|
5 | -define('ATIPAY_REDIRECT_TO_PSP_URL', ATIPAY_URL . 'redirect-to-gateway'); |
|
6 | -define('ATIPAY_VERIFY_URL', ATIPAY_URL . 'verify-payment'); |
|
4 | +define('ATIPAY_TOKEN_URL', ATIPAY_URL.'get-token'); |
|
5 | +define('ATIPAY_REDIRECT_TO_PSP_URL', ATIPAY_URL.'redirect-to-gateway'); |
|
6 | +define('ATIPAY_VERIFY_URL', ATIPAY_URL.'verify-payment'); |
|
7 | 7 | |
8 | 8 | function fn_atipay_get_token($params) |
9 | 9 | { |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | if (isset($r['status']) && !empty($r['status'])) { |
15 | 15 | $status = $r['status']; |
16 | 16 | if ($status == 1) { |
17 | - $return['success']=1; |
|
18 | - $return['token']=$r['token']; |
|
17 | + $return['success'] = 1; |
|
18 | + $return['token'] = $r['token']; |
|
19 | 19 | } else { |
20 | - $return['success']=0; |
|
21 | - $return['errorMessage']=$r['errorDescription']; |
|
20 | + $return['success'] = 0; |
|
21 | + $return['errorMessage'] = $r['errorDescription']; |
|
22 | 22 | } |
23 | 23 | } else { |
24 | - $return['success']=0; |
|
24 | + $return['success'] = 0; |
|
25 | 25 | if (isset($r['faMessage']) && !empty($r['faMessage'])) { |
26 | 26 | $return['errorMessage'] = $r['faMessage']; |
27 | 27 | } else { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | } else { |
33 | - $return['success']=0; |
|
33 | + $return['success'] = 0; |
|
34 | 34 | $return['errorMessage'] = "خطا در دریافت اطلاعات توکن پرداخت"; |
35 | 35 | } |
36 | 36 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | function _fn_generate_get_token_form($params, $submit_text, $action) |
64 | 64 | { |
65 | - $form ="<form action='$action' method='POST' align='center' name='atipay_payment_form_token' id='atipay_payment_form_token' >"; |
|
65 | + $form = "<form action='$action' method='POST' align='center' name='atipay_payment_form_token' id='atipay_payment_form_token' >"; |
|
66 | 66 | foreach ($params as $k=>$v) { |
67 | 67 | $form .= "<input type='hidden' value='$v' name='$k' >"; |
68 | 68 | } |
@@ -79,39 +79,39 @@ discard block |
||
79 | 79 | if (isset($params['state']) && !empty($params['state'])) { |
80 | 80 | $state = $params['state']; |
81 | 81 | if ($state == 'OK') { |
82 | - $result['success']=1; |
|
83 | - $result['error']=""; |
|
82 | + $result['success'] = 1; |
|
83 | + $result['error'] = ""; |
|
84 | 84 | } else { |
85 | - $result['success']=0; |
|
86 | - $result['error']= _fn_return_state_text($state); |
|
85 | + $result['success'] = 0; |
|
86 | + $result['error'] = _fn_return_state_text($state); |
|
87 | 87 | } |
88 | 88 | } else { |
89 | - $result['success']=0; |
|
90 | - $result['error']="خطای نامشخص در پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
89 | + $result['success'] = 0; |
|
90 | + $result['error'] = "خطای نامشخص در پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $result; |
94 | 94 | } |
95 | 95 | |
96 | -function fn_atipay_verify_payment($params,$amount) |
|
96 | +function fn_atipay_verify_payment($params, $amount) |
|
97 | 97 | { |
98 | 98 | $r = wsRequestPost(ATIPAY_VERIFY_URL, $params); |
99 | 99 | $return = array(); |
100 | 100 | if ($r) { |
101 | 101 | if (isset($r['amount']) && !empty($r['amount'])) { |
102 | 102 | if ($r['amount'] == $amount) { |
103 | - $return['success']=1; |
|
104 | - $return['errorMessage']=""; |
|
103 | + $return['success'] = 1; |
|
104 | + $return['errorMessage'] = ""; |
|
105 | 105 | } else { |
106 | - $return['success']=0; |
|
107 | - $return['errorMessage']="خطا در تایید مبلغ پرداخت.در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
106 | + $return['success'] = 0; |
|
107 | + $return['errorMessage'] = "خطا در تایید مبلغ پرداخت.در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
108 | 108 | } |
109 | 109 | } else { |
110 | - $return['success']=0; |
|
111 | - $return['errorMessage']="خطا در تایید اطلاعات پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
110 | + $return['success'] = 0; |
|
111 | + $return['errorMessage'] = "خطا در تایید اطلاعات پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - $return['success']=0; |
|
114 | + $return['success'] = 0; |
|
115 | 115 | $return['errorMessage'] = "خطا در تایید نهایی پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود."; |
116 | 116 | } |
117 | 117 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if ($httpcode == "200") { |
186 | 186 | //nothing YET |
187 | 187 | } else { |
188 | - $json= json_encode(array('error'=>'Y')); |
|
188 | + $json = json_encode(array('error'=>'Y')); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | return $json; |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | curl_close($ch); |
208 | 208 | |
209 | 209 | if ($httpcode == "200") { |
210 | - return json_decode($json,true); |
|
210 | + return json_decode($json, true); |
|
211 | 211 | } else { |
212 | - $json = array('error'=>'Y','jsonError'=>$httpcode,'message'=>$httpcode); |
|
212 | + $json = array('error'=>'Y', 'jsonError'=>$httpcode, 'message'=>$httpcode); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | return $json; |