@@ -13,7 +13,7 @@ |
||
13 | 13 | public function getData() |
14 | 14 | { |
15 | 15 | $data = parent::getData(); |
16 | - $data['QAResultStatus']='000'; |
|
16 | + $data['QAResultStatus'] = '000'; |
|
17 | 17 | $data['TransactionId'] = $this->getTransactionReference(); |
18 | 18 | return $data; |
19 | 19 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | //The parameter name in the confirmation JSON is UniqueKey because in case there is no UserKey (was not sent in the initial JSON) you can perform confirmation using TransactionId instead. |
27 | 27 | $request = [ |
28 | 28 | "ConfirmationKey" => $this->data['ResultData']['ConfirmationKey'], |
29 | - "UniqueKey" => $this->request->getTransactionId()?$this->request->getTransactionId():$this->data['ResultData']['TransactionId'], |
|
29 | + "UniqueKey" => $this->request->getTransactionId() ? $this->request->getTransactionId() : $this->data['ResultData']['TransactionId'], |
|
30 | 30 | "TotalX100" => $this->data['ResultData']['DebitTotal'] |
31 | 31 | ]; |
32 | 32 | $httpClient = new HttpClient('', array( |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | |
61 | 61 | public function getTransactionReference() |
62 | 62 | { |
63 | - if (isset($this->data['URL']) && ! empty($this->data['URL'])) { |
|
63 | + if (isset($this->data['URL']) && !empty($this->data['URL'])) { |
|
64 | 64 | $url = parse_url($this->data['URL']); |
65 | - if (! empty($url['query'])) { |
|
65 | + if (!empty($url['query'])) { |
|
66 | 66 | parse_str($url['query'], $query); |
67 | - if (! empty($query['transactionId'])) { |
|
67 | + if (!empty($query['transactionId'])) { |
|
68 | 68 | return $query['transactionId']; |
69 | 69 | } |
70 | 70 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | public function isRedirect() |
83 | 83 | { |
84 | - if (isset($this->data['URL']) && ! empty($this->data['URL'])) { |
|
84 | + if (isset($this->data['URL']) && !empty($this->data['URL'])) { |
|
85 | 85 | return true; |
86 | 86 | } |
87 | 87 | return false; |
@@ -41,8 +41,9 @@ |
||
41 | 41 | ], json_encode($request)); |
42 | 42 | $httpResponse = $httpRequest->send(); |
43 | 43 | return $httpResponse->json() == 1; |
44 | - } else |
|
45 | - return false; |
|
44 | + } else { |
|
45 | + return false; |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | public function isCancelled() |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | $data['ErrorURL'] = $this->getReturnUrl(); |
20 | 20 | $data['CancelURL'] = $this->getCancelUrl(); |
21 | 21 | $data['CardHolderName'] = $this->getCard()->getName(); |
22 | - $data['CustomerAddressField'] = implode(' ',[$this->getCard()->getAddress1(),$this->getCard()->getAddress2()]); |
|
22 | + $data['CustomerAddressField'] = implode(' ', [$this->getCard()->getAddress1(), $this->getCard()->getAddress2()]); |
|
23 | 23 | $data['CustomerCityField'] = $this->getCard()->getCity(); |
24 | 24 | $data['CustomerIndexField'] = $this->getCard()->getPostcode(); |
25 | 25 | $data['CustomerCountryField'] = $this->getCard()->getCountry(); |
26 | 26 | $data['EmailField'] = $this->getCard()->getEmail(); |
27 | - if($this->getParameter('Language')) $data['Language'] = $this->getParameter('Language'); |
|
28 | - if($this->getParameter('QAResultStatus')) $data['QAResultStatus'] = $this->getParameter('QAResultStatus'); |
|
27 | + if ($this->getParameter('Language')) $data['Language'] = $this->getParameter('Language'); |
|
28 | + if ($this->getParameter('QAResultStatus')) $data['QAResultStatus'] = $this->getParameter('QAResultStatus'); |
|
29 | 29 | return $data; |
30 | 30 | } |
31 | 31 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ($value !== null) { |
63 | 63 | $value = strtoupper($value); |
64 | 64 | } |
65 | - if(!in_array($value, ['HE','EN','RU'])) { |
|
65 | + if (!in_array($value, ['HE', 'EN', 'RU'])) { |
|
66 | 66 | throw new RuntimeException('Unknown language'); |
67 | 67 | } |
68 | 68 | return $this->setParameter('Language', $value); |
@@ -24,8 +24,12 @@ |
||
24 | 24 | $data['CustomerIndexField'] = $this->getCard()->getPostcode(); |
25 | 25 | $data['CustomerCountryField'] = $this->getCard()->getCountry(); |
26 | 26 | $data['EmailField'] = $this->getCard()->getEmail(); |
27 | - if($this->getParameter('Language')) $data['Language'] = $this->getParameter('Language'); |
|
28 | - if($this->getParameter('QAResultStatus')) $data['QAResultStatus'] = $this->getParameter('QAResultStatus'); |
|
27 | + if($this->getParameter('Language')) { |
|
28 | + $data['Language'] = $this->getParameter('Language'); |
|
29 | + } |
|
30 | + if($this->getParameter('QAResultStatus')) { |
|
31 | + $data['QAResultStatus'] = $this->getParameter('QAResultStatus'); |
|
32 | + } |
|
29 | 33 | return $data; |
30 | 34 | } |
31 | 35 |
@@ -23,12 +23,12 @@ |
||
23 | 23 | public function getData() |
24 | 24 | { |
25 | 25 | $this->request = array(); |
26 | - if($this->getTestMode()){ |
|
26 | + if ($this->getTestMode()) { |
|
27 | 27 | $this->request['user'] = 'testpelecard3'; |
28 | 28 | $this->request['password'] = 'Q3EJB8Ah'; |
29 | 29 | $this->request['terminal'] = '0962210'; |
30 | 30 | } |
31 | - else{ |
|
31 | + else { |
|
32 | 32 | $this->request['user'] = $this->getParameter('user'); |
33 | 33 | $this->request['password'] = $this->getParameter('password'); |
34 | 34 | $this->request['terminal'] = $this->getParameter('terminal'); |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | $this->request['user'] = 'testpelecard3'; |
28 | 28 | $this->request['password'] = 'Q3EJB8Ah'; |
29 | 29 | $this->request['terminal'] = '0962210'; |
30 | - } |
|
31 | - else{ |
|
30 | + } else{ |
|
32 | 31 | $this->request['user'] = $this->getParameter('user'); |
33 | 32 | $this->request['password'] = $this->getParameter('password'); |
34 | 33 | $this->request['terminal'] = $this->getParameter('terminal'); |
@@ -141,12 +140,15 @@ discard block |
||
141 | 140 | if ($value !== null) { |
142 | 141 | $value = strtoupper($value); |
143 | 142 | } |
144 | - if ($value == 'NIS') |
|
145 | - return $this->setParameter('currency', 1); |
|
146 | - if ($value == 'USD') |
|
147 | - return $this->setParameter('currency', 2); |
|
148 | - if ($value == 'EUR') |
|
149 | - return $this->setParameter('currency', 978); |
|
143 | + if ($value == 'NIS') { |
|
144 | + return $this->setParameter('currency', 1); |
|
145 | + } |
|
146 | + if ($value == 'USD') { |
|
147 | + return $this->setParameter('currency', 2); |
|
148 | + } |
|
149 | + if ($value == 'EUR') { |
|
150 | + return $this->setParameter('currency', 978); |
|
151 | + } |
|
150 | 152 | throw new RuntimeException('Unknown currency'); |
151 | 153 | } |
152 | 154 |