@@ -6,19 +6,19 @@ |
||
6 | 6 | public function encrypt($plainText, $key) { |
7 | 7 | $method = "AES-256-GCM"; |
8 | 8 | $initVector = openssl_random_pseudo_bytes(16); |
9 | - $openMode = openssl_encrypt( $plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag ); |
|
9 | + $openMode = openssl_encrypt($plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag); |
|
10 | 10 | |
11 | - return bin2hex( $initVector ).bin2hex( $openMode . $tag ); |
|
11 | + return bin2hex($initVector).bin2hex($openMode.$tag); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function decrypt($encryptedText, $key) { |
15 | 15 | $method = 'AES-256-GCM'; |
16 | - $encryptedText = hex2bin( $encryptedText ); |
|
16 | + $encryptedText = hex2bin($encryptedText); |
|
17 | 17 | $iv_len = $tag_length = 16; |
18 | - $iv = substr( $encryptedText, 0, $iv_len ); |
|
19 | - $tag = substr( $encryptedText, -$tag_length, $iv_len ); |
|
20 | - $ciphertext = substr( $encryptedText, $iv_len, -$tag_length ); |
|
18 | + $iv = substr($encryptedText, 0, $iv_len); |
|
19 | + $tag = substr($encryptedText, -$tag_length, $iv_len); |
|
20 | + $ciphertext = substr($encryptedText, $iv_len, -$tag_length); |
|
21 | 21 | |
22 | - return openssl_decrypt( $ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag ); |
|
22 | + return openssl_decrypt($ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -41,7 +41,7 @@ |
||
41 | 41 | throw new InvalidResponseException('Invalid response from payment gateway'); |
42 | 42 | } |
43 | 43 | |
44 | - if ( empty($decryptedString) ) { |
|
44 | + if (empty($decryptedString)) { |
|
45 | 45 | throw new InvalidResponseException('Invalid response from payment gateway'); |
46 | 46 | } |
47 | 47 |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $data['billing_tel'] = $this->getBillingTel(); |
227 | 227 | $data['customer_email'] = '[email protected]'; |
228 | 228 | |
229 | - if ( $this->getCard() ) { |
|
229 | + if ($this->getCard()) { |
|
230 | 230 | $data['card_number'] = $this->getCard()->getNumber(); |
231 | 231 | $data['expiry_month'] = $this->getCard()->getExpiryMonth(); |
232 | 232 | $data['expiry_year'] = $this->getCard()->getExpiryYear(); |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | { |
249 | 249 | $merchant_data = []; |
250 | 250 | |
251 | - foreach ( $this->getData() as $k => $v ) { |
|
252 | - if ( !empty($v) ) { |
|
251 | + foreach ($this->getData() as $k => $v) { |
|
252 | + if (!empty($v)) { |
|
253 | 253 | $merchant_data[$k] = urlencode($v); |
254 | 254 | } |
255 | 255 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | $encrypted_data = $cryto->encrypt(http_build_query($merchant_data), $this->getWorkingKey()); |
263 | 263 | |
264 | - $url = $this->getEndpoint() . '&encRequest=' . $encrypted_data . '&access_code=' . $this->getAccessCode(); |
|
264 | + $url = $this->getEndpoint().'&encRequest='.$encrypted_data.'&access_code='.$this->getAccessCode(); |
|
265 | 265 | |
266 | 266 | return $this->response = new PurchaseResponse($this, [ |
267 | 267 | 'url' => $url, |