Completed
Push — master ( 8a6a7b...efede1 )
by Leith
02:16
created
src/Message/CompletePurchaseResponse.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -90,6 +90,7 @@
 block discarded – undo
90 90
     /**
91 91
      * Helper method to get a specific merchant parameter if available.
92 92
      *
93
+     * @param string $key
93 94
      * @return null|mixed
94 95
      */
95 96
     protected function getKey($key)
Please login to merge, or discard this patch.
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,123 +10,123 @@
 block discarded – undo
10 10
  */
11 11
 class CompletePurchaseResponse extends AbstractResponse
12 12
 {
13
-    /** @var array */
14
-    protected $merchantParameters;
15
-    /** @var string */
16
-    protected $returnSignature;
17
-    /** @var boolean */
18
-    protected $usingUpcaseParameters = false;
19
-    /** @var boolean */
20
-    protected $usingUpcaseResponse   = false;
13
+	/** @var array */
14
+	protected $merchantParameters;
15
+	/** @var string */
16
+	protected $returnSignature;
17
+	/** @var boolean */
18
+	protected $usingUpcaseParameters = false;
19
+	/** @var boolean */
20
+	protected $usingUpcaseResponse   = false;
21 21
 
22
-    /**
23
-     * Constructor
24
-     *
25
-     * @param RequestInterface $request the initiating request.
26
-     * @param mixed $data
27
-     *
28
-     * @throws InvalidResponseException If order number is missing or signature does not match
29
-     */
30
-    public function __construct(RequestInterface $request, $data)
31
-    {
32
-        parent::__construct($request, $data);
22
+	/**
23
+	 * Constructor
24
+	 *
25
+	 * @param RequestInterface $request the initiating request.
26
+	 * @param mixed $data
27
+	 *
28
+	 * @throws InvalidResponseException If order number is missing or signature does not match
29
+	 */
30
+	public function __construct(RequestInterface $request, $data)
31
+	{
32
+		parent::__construct($request, $data);
33 33
 
34
-        if (!empty($data['Ds_MerchantParameters'])) {
35
-            $this->merchantParameters = $this->decodeMerchantParameters($data['Ds_MerchantParameters']);
36
-        } elseif (!empty($data['DS_MERCHANTPARAMETERS'])) {
37
-            $this->merchantParameters = $this->decodeMerchantParameters($data['DS_MERCHANTPARAMETERS']);
38
-            $this->usingUpcaseResponse = true;
39
-        } else {
40
-            throw new InvalidResponseException('Invalid response from payment gateway (no data)');
41
-        }
34
+		if (!empty($data['Ds_MerchantParameters'])) {
35
+			$this->merchantParameters = $this->decodeMerchantParameters($data['Ds_MerchantParameters']);
36
+		} elseif (!empty($data['DS_MERCHANTPARAMETERS'])) {
37
+			$this->merchantParameters = $this->decodeMerchantParameters($data['DS_MERCHANTPARAMETERS']);
38
+			$this->usingUpcaseResponse = true;
39
+		} else {
40
+			throw new InvalidResponseException('Invalid response from payment gateway (no data)');
41
+		}
42 42
 
43
-        if (!empty($this->merchantParameters['Ds_Order'])) {
44
-            $order = $this->merchantParameters['Ds_Order'];
45
-        } elseif (!empty($this->merchantParameters['DS_ORDER'])) {
46
-            $order = $this->merchantParameters['DS_ORDER'];
47
-            $this->usingUpcaseParameters = true;
48
-        } else {
49
-            throw new InvalidResponseException();
50
-        }
43
+		if (!empty($this->merchantParameters['Ds_Order'])) {
44
+			$order = $this->merchantParameters['Ds_Order'];
45
+		} elseif (!empty($this->merchantParameters['DS_ORDER'])) {
46
+			$order = $this->merchantParameters['DS_ORDER'];
47
+			$this->usingUpcaseParameters = true;
48
+		} else {
49
+			throw new InvalidResponseException();
50
+		}
51 51
 
52
-        $this->returnSignature = $this->createReturnSignature(
53
-            $data[$this->usingUpcaseResponse ? 'DS_MERCHANTPARAMETERS' : 'Ds_MerchantParameters'],
54
-            $order,
55
-            base64_decode($this->request->getHmacKey())
56
-        );
52
+		$this->returnSignature = $this->createReturnSignature(
53
+			$data[$this->usingUpcaseResponse ? 'DS_MERCHANTPARAMETERS' : 'Ds_MerchantParameters'],
54
+			$order,
55
+			base64_decode($this->request->getHmacKey())
56
+		);
57 57
 
58
-        if ($this->returnSignature != $data[$this->usingUpcaseResponse ? 'DS_SIGNATURE' : 'Ds_Signature']) {
59
-            throw new InvalidResponseException('Invalid response from payment gateway (signature mismatch)');
60
-        }
61
-    }
58
+		if ($this->returnSignature != $data[$this->usingUpcaseResponse ? 'DS_SIGNATURE' : 'Ds_Signature']) {
59
+			throw new InvalidResponseException('Invalid response from payment gateway (signature mismatch)');
60
+		}
61
+	}
62 62
 
63
-    /**
64
-     * Is the response successful?
65
-     *
66
-     * @return boolean
67
-     */
68
-    public function isSuccessful()
69
-    {
70
-        $key = $this->usingUpcaseParameters ? 'DS_RESPONSE' : 'Ds_Response';
71
-        return isset($this->merchantParameters[$key])
72
-            && is_numeric($this->merchantParameters[$key])
73
-            && 0 <= $this->merchantParameters[$key]
74
-            && 100 > $this->merchantParameters[$key];
75
-    }
63
+	/**
64
+	 * Is the response successful?
65
+	 *
66
+	 * @return boolean
67
+	 */
68
+	public function isSuccessful()
69
+	{
70
+		$key = $this->usingUpcaseParameters ? 'DS_RESPONSE' : 'Ds_Response';
71
+		return isset($this->merchantParameters[$key])
72
+			&& is_numeric($this->merchantParameters[$key])
73
+			&& 0 <= $this->merchantParameters[$key]
74
+			&& 100 > $this->merchantParameters[$key];
75
+	}
76 76
 
77
-    /**
78
-     * Get the response data, included the decoded merchant parameters if available.
79
-     *
80
-     * @return mixed
81
-     */
82
-    public function getData()
83
-    {
84
-        $data = parent::getData();
85
-        return is_array($data) && is_array($this->merchantParameters)
86
-            ? array_merge($data, $this->merchantParameters)
87
-            : $data;
88
-    }
77
+	/**
78
+	 * Get the response data, included the decoded merchant parameters if available.
79
+	 *
80
+	 * @return mixed
81
+	 */
82
+	public function getData()
83
+	{
84
+		$data = parent::getData();
85
+		return is_array($data) && is_array($this->merchantParameters)
86
+			? array_merge($data, $this->merchantParameters)
87
+			: $data;
88
+	}
89 89
 
90
-    /**
91
-     * Helper method to get a specific merchant parameter if available.
92
-     *
93
-     * @return null|mixed
94
-     */
95
-    protected function getKey($key)
96
-    {
97
-        if ($this->usingUpcaseParameters) {
98
-            $key = strtoupper($key);
99
-        }
100
-        return isset($this->merchantParameters[$key]) ? $this->merchantParameters[$key] : null;
101
-    }
90
+	/**
91
+	 * Helper method to get a specific merchant parameter if available.
92
+	 *
93
+	 * @return null|mixed
94
+	 */
95
+	protected function getKey($key)
96
+	{
97
+		if ($this->usingUpcaseParameters) {
98
+			$key = strtoupper($key);
99
+		}
100
+		return isset($this->merchantParameters[$key]) ? $this->merchantParameters[$key] : null;
101
+	}
102 102
 
103
-    /**
104
-     * Get the authorisation code if available.
105
-     *
106
-     * @return null|string
107
-     */
108
-    public function getTransactionReference()
109
-    {
110
-        return $this->getKey('Ds_AuthorisationCode');
111
-    }
103
+	/**
104
+	 * Get the authorisation code if available.
105
+	 *
106
+	 * @return null|string
107
+	 */
108
+	public function getTransactionReference()
109
+	{
110
+		return $this->getKey('Ds_AuthorisationCode');
111
+	}
112 112
 
113
-    /**
114
-     * Get the merchant response message if available.
115
-     *
116
-     * @return null|string
117
-     */
118
-    public function getMessage()
119
-    {
120
-        return $this->getKey('Ds_Response');
121
-    }
113
+	/**
114
+	 * Get the merchant response message if available.
115
+	 *
116
+	 * @return null|string
117
+	 */
118
+	public function getMessage()
119
+	{
120
+		return $this->getKey('Ds_Response');
121
+	}
122 122
 
123
-    /**
124
-     * Get the card type if available.
125
-     *
126
-     * @return null|string
127
-     */
128
-    public function getCardType()
129
-    {
130
-        return $this->getKey('Ds_Card_Type');
131
-    }
123
+	/**
124
+	 * Get the card type if available.
125
+	 *
126
+	 * @return null|string
127
+	 */
128
+	public function getCardType()
129
+	{
130
+		return $this->getKey('Ds_Card_Type');
131
+	}
132 132
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Redsys Complete Purchase Response
10 10
  */
11
-class CompletePurchaseResponse extends AbstractResponse
12
-{
11
+class CompletePurchaseResponse extends AbstractResponse {
13 12
     /** @var array */
14 13
     protected $merchantParameters;
15 14
     /** @var string */
@@ -27,8 +26,7 @@  discard block
 block discarded – undo
27 26
      *
28 27
      * @throws InvalidResponseException If order number is missing or signature does not match
29 28
      */
30
-    public function __construct(RequestInterface $request, $data)
31
-    {
29
+    public function __construct(RequestInterface $request, $data) {
32 30
         parent::__construct($request, $data);
33 31
 
34 32
         if (!empty($data['Ds_MerchantParameters'])) {
@@ -65,8 +63,7 @@  discard block
 block discarded – undo
65 63
      *
66 64
      * @return boolean
67 65
      */
68
-    public function isSuccessful()
69
-    {
66
+    public function isSuccessful() {
70 67
         $key = $this->usingUpcaseParameters ? 'DS_RESPONSE' : 'Ds_Response';
71 68
         return isset($this->merchantParameters[$key])
72 69
             && is_numeric($this->merchantParameters[$key])
@@ -79,8 +76,7 @@  discard block
 block discarded – undo
79 76
      *
80 77
      * @return mixed
81 78
      */
82
-    public function getData()
83
-    {
79
+    public function getData() {
84 80
         $data = parent::getData();
85 81
         return is_array($data) && is_array($this->merchantParameters)
86 82
             ? array_merge($data, $this->merchantParameters)
@@ -92,8 +88,7 @@  discard block
 block discarded – undo
92 88
      *
93 89
      * @return null|mixed
94 90
      */
95
-    protected function getKey($key)
96
-    {
91
+    protected function getKey($key) {
97 92
         if ($this->usingUpcaseParameters) {
98 93
             $key = strtoupper($key);
99 94
         }
@@ -105,8 +100,7 @@  discard block
 block discarded – undo
105 100
      *
106 101
      * @return null|string
107 102
      */
108
-    public function getTransactionReference()
109
-    {
103
+    public function getTransactionReference() {
110 104
         return $this->getKey('Ds_AuthorisationCode');
111 105
     }
112 106
 
@@ -115,8 +109,7 @@  discard block
 block discarded – undo
115 109
      *
116 110
      * @return null|string
117 111
      */
118
-    public function getMessage()
119
-    {
112
+    public function getMessage() {
120 113
         return $this->getKey('Ds_Response');
121 114
     }
122 115
 
@@ -125,8 +118,7 @@  discard block
 block discarded – undo
125 118
      *
126 119
      * @return null|string
127 120
      */
128
-    public function getCardType()
129
-    {
121
+    public function getCardType() {
130 122
         return $this->getKey('Ds_Card_Type');
131 123
     }
132 124
 }
Please login to merge, or discard this patch.
src/Gateway.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -13,69 +13,69 @@
 block discarded – undo
13 13
  */
14 14
 class Gateway extends AbstractGateway
15 15
 {
16
-    public function getName()
17
-    {
18
-        return 'Redsys';
19
-    }
16
+	public function getName()
17
+	{
18
+		return 'Redsys';
19
+	}
20 20
 
21
-    public function getDefaultParameters()
22
-    {
23
-        return array(
24
-            'merchantId' => '',
25
-            'merchantName' => '',
26
-            'terminalId' => '',
27
-            'hmacKey' => '',
28
-            'testMode' => false,
29
-        );
30
-    }
21
+	public function getDefaultParameters()
22
+	{
23
+		return array(
24
+			'merchantId' => '',
25
+			'merchantName' => '',
26
+			'terminalId' => '',
27
+			'hmacKey' => '',
28
+			'testMode' => false,
29
+		);
30
+	}
31 31
 
32
-    public function getMerchantId()
33
-    {
34
-        return $this->getParameter('merchantId');
35
-    }
32
+	public function getMerchantId()
33
+	{
34
+		return $this->getParameter('merchantId');
35
+	}
36 36
 
37
-    public function setMerchantId($value)
38
-    {
39
-        return $this->setParameter('merchantId', $value);
40
-    }
37
+	public function setMerchantId($value)
38
+	{
39
+		return $this->setParameter('merchantId', $value);
40
+	}
41 41
 
42
-    public function getMerchantName()
43
-    {
44
-        return $this->getParameter('merchantName');
45
-    }
42
+	public function getMerchantName()
43
+	{
44
+		return $this->getParameter('merchantName');
45
+	}
46 46
 
47
-    public function setMerchantName($value)
48
-    {
49
-        return $this->setParameter('merchantName', $value);
50
-    }
47
+	public function setMerchantName($value)
48
+	{
49
+		return $this->setParameter('merchantName', $value);
50
+	}
51 51
 
52
-    public function getTerminalId()
53
-    {
54
-        return $this->getParameter('terminalId');
55
-    }
52
+	public function getTerminalId()
53
+	{
54
+		return $this->getParameter('terminalId');
55
+	}
56 56
 
57
-    public function setTerminalId($value)
58
-    {
59
-        return $this->setParameter('terminalId', $value);
60
-    }
57
+	public function setTerminalId($value)
58
+	{
59
+		return $this->setParameter('terminalId', $value);
60
+	}
61 61
 
62
-    public function getHmacKey()
63
-    {
64
-        return $this->getParameter('hmacKey');
65
-    }
62
+	public function getHmacKey()
63
+	{
64
+		return $this->getParameter('hmacKey');
65
+	}
66 66
 
67
-    public function setHmacKey($value)
68
-    {
69
-        return $this->setParameter('hmacKey', $value);
70
-    }
67
+	public function setHmacKey($value)
68
+	{
69
+		return $this->setParameter('hmacKey', $value);
70
+	}
71 71
 
72
-    public function purchase(array $parameters = array())
73
-    {
74
-        return $this->createRequest('\Omnipay\Redsys\Message\PurchaseRequest', $parameters);
75
-    }
72
+	public function purchase(array $parameters = array())
73
+	{
74
+		return $this->createRequest('\Omnipay\Redsys\Message\PurchaseRequest', $parameters);
75
+	}
76 76
 
77
-    public function completePurchase(array $parameters = array())
78
-    {
79
-        return $this->createRequest('\Omnipay\Redsys\Message\CompletePurchaseRequest', $parameters);
80
-    }
77
+	public function completePurchase(array $parameters = array())
78
+	{
79
+		return $this->createRequest('\Omnipay\Redsys\Message\CompletePurchaseRequest', $parameters);
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,15 +11,12 @@  discard block
 block discarded – undo
11 11
  *
12 12
  * @link http://www.redsys.es/
13 13
  */
14
-class Gateway extends AbstractGateway
15
-{
16
-    public function getName()
17
-    {
14
+class Gateway extends AbstractGateway {
15
+    public function getName() {
18 16
         return 'Redsys';
19 17
     }
20 18
 
21
-    public function getDefaultParameters()
22
-    {
19
+    public function getDefaultParameters() {
23 20
         return array(
24 21
             'merchantId' => '',
25 22
             'merchantName' => '',
@@ -29,53 +26,43 @@  discard block
 block discarded – undo
29 26
         );
30 27
     }
31 28
 
32
-    public function getMerchantId()
33
-    {
29
+    public function getMerchantId() {
34 30
         return $this->getParameter('merchantId');
35 31
     }
36 32
 
37
-    public function setMerchantId($value)
38
-    {
33
+    public function setMerchantId($value) {
39 34
         return $this->setParameter('merchantId', $value);
40 35
     }
41 36
 
42
-    public function getMerchantName()
43
-    {
37
+    public function getMerchantName() {
44 38
         return $this->getParameter('merchantName');
45 39
     }
46 40
 
47
-    public function setMerchantName($value)
48
-    {
41
+    public function setMerchantName($value) {
49 42
         return $this->setParameter('merchantName', $value);
50 43
     }
51 44
 
52
-    public function getTerminalId()
53
-    {
45
+    public function getTerminalId() {
54 46
         return $this->getParameter('terminalId');
55 47
     }
56 48
 
57
-    public function setTerminalId($value)
58
-    {
49
+    public function setTerminalId($value) {
59 50
         return $this->setParameter('terminalId', $value);
60 51
     }
61 52
 
62
-    public function getHmacKey()
63
-    {
53
+    public function getHmacKey() {
64 54
         return $this->getParameter('hmacKey');
65 55
     }
66 56
 
67
-    public function setHmacKey($value)
68
-    {
57
+    public function setHmacKey($value) {
69 58
         return $this->setParameter('hmacKey', $value);
70 59
     }
71 60
 
72
-    public function purchase(array $parameters = array())
73
-    {
61
+    public function purchase(array $parameters = array()) {
74 62
         return $this->createRequest('\Omnipay\Redsys\Message\PurchaseRequest', $parameters);
75 63
     }
76 64
 
77
-    public function completePurchase(array $parameters = array())
78
-    {
65
+    public function completePurchase(array $parameters = array()) {
79 66
         return $this->createRequest('\Omnipay\Redsys\Message\CompletePurchaseRequest', $parameters);
80 67
     }
81 68
 }
Please login to merge, or discard this patch.
src/Message/AbstractResponse.php 3 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -13,74 +13,74 @@
 block discarded – undo
13 13
  */
14 14
 abstract class AbstractResponse extends BaseAbstractResponse
15 15
 {
16
-    /**
17
-     * Encode merchant parameters
18
-     *
19
-     * @param array $data  The parameters to encode
20
-     *
21
-     * @return string Encoded data
22
-     */
23
-    protected function encodeMerchantParameters($data)
24
-    {
25
-        return base64_encode(json_encode($data));
26
-    }
16
+	/**
17
+	 * Encode merchant parameters
18
+	 *
19
+	 * @param array $data  The parameters to encode
20
+	 *
21
+	 * @return string Encoded data
22
+	 */
23
+	protected function encodeMerchantParameters($data)
24
+	{
25
+		return base64_encode(json_encode($data));
26
+	}
27 27
 
28
-    /**
29
-     * Decode merchant parameters
30
-     *
31
-     * @param string $data  The encoded string of parameters
32
-     *
33
-     * @return array Decoded data
34
-     */
35
-    protected function decodeMerchantParameters($data)
36
-    {
37
-        return (array)json_decode(base64_decode(strtr($data, '-_', '+/')));
38
-    }
28
+	/**
29
+	 * Decode merchant parameters
30
+	 *
31
+	 * @param string $data  The encoded string of parameters
32
+	 *
33
+	 * @return array Decoded data
34
+	 */
35
+	protected function decodeMerchantParameters($data)
36
+	{
37
+		return (array)json_decode(base64_decode(strtr($data, '-_', '+/')));
38
+	}
39 39
 
40
-    /**
41
-     * Encrypt message with given key and default IV
42
-     *
43
-     * @todo function_exists() vs extension_loaded()?
44
-     *
45
-     * @param string $message  The message to encrypt
46
-     * @param string $key      The key used to encrypt the message
47
-     *
48
-     * @return string Encrypted message
49
-     *
50
-     * @throws RuntimeException
51
-     */
52
-    protected function encryptMessage($message, $key)
53
-    {
54
-        $iv = implode(array_map("chr", array(0, 0, 0, 0, 0, 0, 0, 0)));
40
+	/**
41
+	 * Encrypt message with given key and default IV
42
+	 *
43
+	 * @todo function_exists() vs extension_loaded()?
44
+	 *
45
+	 * @param string $message  The message to encrypt
46
+	 * @param string $key      The key used to encrypt the message
47
+	 *
48
+	 * @return string Encrypted message
49
+	 *
50
+	 * @throws RuntimeException
51
+	 */
52
+	protected function encryptMessage($message, $key)
53
+	{
54
+		$iv = implode(array_map("chr", array(0, 0, 0, 0, 0, 0, 0, 0)));
55 55
 
56
-        if (function_exists('mcrypt_encrypt')) {
57
-            $ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv);
58
-        } else {
59
-            throw new RuntimeException('No valid encryption extension installed');
60
-        }
56
+		if (function_exists('mcrypt_encrypt')) {
57
+			$ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv);
58
+		} else {
59
+			throw new RuntimeException('No valid encryption extension installed');
60
+		}
61 61
 
62
-        return $ciphertext;
63
-    }
62
+		return $ciphertext;
63
+	}
64 64
 
65
-    /**
66
-     * Create signature hash used to verify messages
67
-     *
68
-     * @todo Add if-check on algorithm to match against signature version as new param?
69
-     *
70
-     * @param string $message  The message to encrypt
71
-     * @param string $salt     Unique salt used to generate the ciphertext
72
-     * @param string $key      The key used to encrypt the message
73
-     *
74
-     * @return string Generated signature
75
-     */
76
-    protected function createSignature($message, $salt, $key)
77
-    {
78
-        $ciphertext = $this->encryptMessage($salt, $key);
79
-        return base64_encode(hash_hmac('sha256', $message, $ciphertext, true));
80
-    }
65
+	/**
66
+	 * Create signature hash used to verify messages
67
+	 *
68
+	 * @todo Add if-check on algorithm to match against signature version as new param?
69
+	 *
70
+	 * @param string $message  The message to encrypt
71
+	 * @param string $salt     Unique salt used to generate the ciphertext
72
+	 * @param string $key      The key used to encrypt the message
73
+	 *
74
+	 * @return string Generated signature
75
+	 */
76
+	protected function createSignature($message, $salt, $key)
77
+	{
78
+		$ciphertext = $this->encryptMessage($salt, $key);
79
+		return base64_encode(hash_hmac('sha256', $message, $ciphertext, true));
80
+	}
81 81
 
82
-    protected function createReturnSignature($message, $salt, $key)
83
-    {
84
-        return strtr($this->createSignature($message, $salt, $key), '+/', '-_');
85
-    }
82
+	protected function createReturnSignature($message, $salt, $key)
83
+	{
84
+		return strtr($this->createSignature($message, $salt, $key), '+/', '-_');
85
+	}
86 86
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     protected function decodeMerchantParameters($data)
36 36
     {
37
-        return (array)json_decode(base64_decode(strtr($data, '-_', '+/')));
37
+        return (array) json_decode(base64_decode(strtr($data, '-_', '+/')));
38 38
     }
39 39
 
40 40
     /**
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
  * This abstract class extends the base Omnipay AbstractResponse in order
12 12
  * to provide some common encoding and decoding functions.
13 13
  */
14
-abstract class AbstractResponse extends BaseAbstractResponse
15
-{
14
+abstract class AbstractResponse extends BaseAbstractResponse {
16 15
     /**
17 16
      * Encode merchant parameters
18 17
      *
@@ -20,8 +19,7 @@  discard block
 block discarded – undo
20 19
      *
21 20
      * @return string Encoded data
22 21
      */
23
-    protected function encodeMerchantParameters($data)
24
-    {
22
+    protected function encodeMerchantParameters($data) {
25 23
         return base64_encode(json_encode($data));
26 24
     }
27 25
 
@@ -32,8 +30,7 @@  discard block
 block discarded – undo
32 30
      *
33 31
      * @return array Decoded data
34 32
      */
35
-    protected function decodeMerchantParameters($data)
36
-    {
33
+    protected function decodeMerchantParameters($data) {
37 34
         return (array)json_decode(base64_decode(strtr($data, '-_', '+/')));
38 35
     }
39 36
 
@@ -49,8 +46,7 @@  discard block
 block discarded – undo
49 46
      *
50 47
      * @throws RuntimeException
51 48
      */
52
-    protected function encryptMessage($message, $key)
53
-    {
49
+    protected function encryptMessage($message, $key) {
54 50
         $iv = implode(array_map("chr", array(0, 0, 0, 0, 0, 0, 0, 0)));
55 51
 
56 52
         if (function_exists('mcrypt_encrypt')) {
@@ -73,14 +69,12 @@  discard block
 block discarded – undo
73 69
      *
74 70
      * @return string Generated signature
75 71
      */
76
-    protected function createSignature($message, $salt, $key)
77
-    {
72
+    protected function createSignature($message, $salt, $key) {
78 73
         $ciphertext = $this->encryptMessage($salt, $key);
79 74
         return base64_encode(hash_hmac('sha256', $message, $ciphertext, true));
80 75
     }
81 76
 
82
-    protected function createReturnSignature($message, $salt, $key)
83
-    {
77
+    protected function createReturnSignature($message, $salt, $key) {
84 78
         return strtr($this->createSignature($message, $salt, $key), '+/', '-_');
85 79
     }
86 80
 }
Please login to merge, or discard this patch.
src/Message/CompletePurchaseRequest.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
  */
8 8
 class CompletePurchaseRequest extends PurchaseRequest
9 9
 {
10
-    public function getData()
11
-    {
12
-        return $this->httpRequest->request->all();
13
-    }
10
+	public function getData()
11
+	{
12
+		return $this->httpRequest->request->all();
13
+	}
14 14
 
15
-    public function sendData($data)
16
-    {
17
-        return $this->response = new CompletePurchaseResponse($this, $data);
18
-    }
15
+	public function sendData($data)
16
+	{
17
+		return $this->response = new CompletePurchaseResponse($this, $data);
18
+	}
19 19
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,15 +5,12 @@
 block discarded – undo
5 5
 /**
6 6
  * Redsys Complete Purchase Request
7 7
  */
8
-class CompletePurchaseRequest extends PurchaseRequest
9
-{
10
-    public function getData()
11
-    {
8
+class CompletePurchaseRequest extends PurchaseRequest {
9
+    public function getData() {
12 10
         return $this->httpRequest->request->all();
13 11
     }
14 12
 
15
-    public function sendData($data)
16
-    {
13
+    public function sendData($data) {
17 14
         return $this->response = new CompletePurchaseResponse($this, $data);
18 15
     }
19 16
 }
Please login to merge, or discard this patch.
src/Message/PurchaseRequest.php 3 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -9,159 +9,159 @@
 block discarded – undo
9 9
  */
10 10
 class PurchaseRequest extends AbstractRequest
11 11
 {
12
-    protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago';
13
-    protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago';
14
-    protected static $consumerLanguages = array(
15
-        'es' => '001', // Spanish
16
-        'en' => '002', // English
17
-        'ca' => '003', // Catalan - same as Valencian (010)
18
-        'fr' => '004', // French
19
-        'de' => '005', // German
20
-        'nl' => '006', // Dutch
21
-        'it' => '007', // Italian
22
-        'sv' => '008', // Swedish
23
-        'pt' => '009', // Portuguese
24
-        'pl' => '011', // Polish
25
-        'gl' => '012', // Galician
26
-        'eu' => '013', // Basque
27
-    );
28
-
29
-    public function getCardholder()
30
-    {
31
-        return $this->getParameter('cardholder');
32
-    }
33
-
34
-    public function setCardholder($value)
35
-    {
36
-        return $this->setParameter('cardholder', $value);
37
-    }
38
-
39
-    public function getConsumerLanguage()
40
-    {
41
-        return $this->getParameter('consumerLanguage');
42
-    }
43
-
44
-    /**
45
-     * Set the language presented to the consumer
46
-     *
47
-     * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code
48
-     */
49
-    public function setConsumerLanguage($value)
50
-    {
51
-        if (is_int($value)) {
52
-            if ($value < 0 || $value > 13) {
53
-                $value = 1;
54
-            }
55
-            $value = str_pad($value, 3, '0', STR_PAD_LEFT);
56
-        } elseif (!is_numeric($value)) {
57
-            $value = isset(self::$consumerLanguages[$value]) ? self::$consumerLanguages[$value] : '001';
58
-        }
59
-
60
-        return $this->setParameter('consumerLanguage', $value);
61
-    }
62
-
63
-    public function getHmacKey()
64
-    {
65
-        return $this->getParameter('hmacKey');
66
-    }
67
-
68
-    public function setHmacKey($value)
69
-    {
70
-        return $this->setParameter('hmacKey', $value);
71
-    }
72
-
73
-    public function getMerchantData()
74
-    {
75
-        return $this->getParameter('merchantData');
76
-    }
77
-
78
-    public function setMerchantData($value)
79
-    {
80
-        return $this->setParameter('merchantData', $value);
81
-    }
82
-
83
-    public function getMerchantId()
84
-    {
85
-        return $this->getParameter('merchantId');
86
-    }
87
-
88
-    public function setMerchantId($value)
89
-    {
90
-        return $this->setParameter('merchantId', $value);
91
-    }
92
-
93
-    public function getMerchantName()
94
-    {
95
-        return $this->getParameter('merchantName');
96
-    }
97
-
98
-    public function setMerchantName($value)
99
-    {
100
-        return $this->setParameter('merchantName', $value);
101
-    }
102
-
103
-    public function getTerminalId()
104
-    {
105
-        return $this->getParameter('terminalId');
106
-    }
107
-
108
-    public function setTerminalId($value)
109
-    {
110
-        return $this->setParameter('terminalId', $value);
111
-    }
112
-
113
-    /**
114
-     * Override the abstract method to add requirement that it must start with 4 numeric characters
115
-     *
116
-     * @param string|int $value The transaction ID (merchant order) to set for the transaction
117
-     */
118
-    public function setTransactionId($value)
119
-    {
120
-        $start = substr($value, 0, 4);
121
-        $numerics = 0;
122
-        foreach (str_split($start) as $char) {
123
-            if (is_numeric($char)) {
124
-                $numerics++;
125
-            } else {
126
-                break;
127
-            }
128
-        }
129
-        $value = str_pad(substr($start, 0, $numerics), 4, 0, STR_PAD_LEFT).substr($value, $numerics);
130
-
131
-        parent::setTransactionId($value);
132
-    }
133
-
134
-    public function getData()
135
-    {
136
-        $this->validate('merchantId', 'terminalId', 'amount', 'currency');
137
-
138
-        return array(
139
-            // mandatory fields
140
-            'Ds_Merchant_MerchantCode'       => $this->getMerchantId(),
141
-            'Ds_Merchant_Terminal'           => $this->getTerminalId(),
142
-            'Ds_Merchant_TransactionType'    => '0',                          // Authorisation
143
-            'Ds_Merchant_Amount'             => $this->getAmountInteger(),
144
-            'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(),  // uses ISO-4217 codes
145
-            'Ds_Merchant_Order'              => $this->getTransactionId(),
146
-            'Ds_Merchant_MerchantUrl'        => $this->getNotifyUrl(),
147
-            // optional fields
148
-            'Ds_Merchant_ProductDescription' => $this->getDescription(),
149
-            'Ds_Merchant_Cardholder'         => $this->getCardholder(),
150
-            'Ds_Merchant_UrlOK'              => $this->getReturnUrl(),
151
-            'Ds_Merchant_UrlKO'              => $this->getReturnUrl(),
152
-            'Ds_Merchant_MerchantName'       => $this->getMerchantName(),
153
-            'Ds_Merchant_ConsumerLanguage'   => $this->getConsumerLanguage(),
154
-            'Ds_Merchant_MerchantData'       => $this->getMerchantData(),
155
-        );
156
-    }
157
-
158
-    public function sendData($data)
159
-    {
160
-        return $this->response = new PurchaseResponse($this, $data);
161
-    }
162
-
163
-    public function getEndpoint()
164
-    {
165
-        return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
166
-    }
12
+	protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago';
13
+	protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago';
14
+	protected static $consumerLanguages = array(
15
+		'es' => '001', // Spanish
16
+		'en' => '002', // English
17
+		'ca' => '003', // Catalan - same as Valencian (010)
18
+		'fr' => '004', // French
19
+		'de' => '005', // German
20
+		'nl' => '006', // Dutch
21
+		'it' => '007', // Italian
22
+		'sv' => '008', // Swedish
23
+		'pt' => '009', // Portuguese
24
+		'pl' => '011', // Polish
25
+		'gl' => '012', // Galician
26
+		'eu' => '013', // Basque
27
+	);
28
+
29
+	public function getCardholder()
30
+	{
31
+		return $this->getParameter('cardholder');
32
+	}
33
+
34
+	public function setCardholder($value)
35
+	{
36
+		return $this->setParameter('cardholder', $value);
37
+	}
38
+
39
+	public function getConsumerLanguage()
40
+	{
41
+		return $this->getParameter('consumerLanguage');
42
+	}
43
+
44
+	/**
45
+	 * Set the language presented to the consumer
46
+	 *
47
+	 * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code
48
+	 */
49
+	public function setConsumerLanguage($value)
50
+	{
51
+		if (is_int($value)) {
52
+			if ($value < 0 || $value > 13) {
53
+				$value = 1;
54
+			}
55
+			$value = str_pad($value, 3, '0', STR_PAD_LEFT);
56
+		} elseif (!is_numeric($value)) {
57
+			$value = isset(self::$consumerLanguages[$value]) ? self::$consumerLanguages[$value] : '001';
58
+		}
59
+
60
+		return $this->setParameter('consumerLanguage', $value);
61
+	}
62
+
63
+	public function getHmacKey()
64
+	{
65
+		return $this->getParameter('hmacKey');
66
+	}
67
+
68
+	public function setHmacKey($value)
69
+	{
70
+		return $this->setParameter('hmacKey', $value);
71
+	}
72
+
73
+	public function getMerchantData()
74
+	{
75
+		return $this->getParameter('merchantData');
76
+	}
77
+
78
+	public function setMerchantData($value)
79
+	{
80
+		return $this->setParameter('merchantData', $value);
81
+	}
82
+
83
+	public function getMerchantId()
84
+	{
85
+		return $this->getParameter('merchantId');
86
+	}
87
+
88
+	public function setMerchantId($value)
89
+	{
90
+		return $this->setParameter('merchantId', $value);
91
+	}
92
+
93
+	public function getMerchantName()
94
+	{
95
+		return $this->getParameter('merchantName');
96
+	}
97
+
98
+	public function setMerchantName($value)
99
+	{
100
+		return $this->setParameter('merchantName', $value);
101
+	}
102
+
103
+	public function getTerminalId()
104
+	{
105
+		return $this->getParameter('terminalId');
106
+	}
107
+
108
+	public function setTerminalId($value)
109
+	{
110
+		return $this->setParameter('terminalId', $value);
111
+	}
112
+
113
+	/**
114
+	 * Override the abstract method to add requirement that it must start with 4 numeric characters
115
+	 *
116
+	 * @param string|int $value The transaction ID (merchant order) to set for the transaction
117
+	 */
118
+	public function setTransactionId($value)
119
+	{
120
+		$start = substr($value, 0, 4);
121
+		$numerics = 0;
122
+		foreach (str_split($start) as $char) {
123
+			if (is_numeric($char)) {
124
+				$numerics++;
125
+			} else {
126
+				break;
127
+			}
128
+		}
129
+		$value = str_pad(substr($start, 0, $numerics), 4, 0, STR_PAD_LEFT).substr($value, $numerics);
130
+
131
+		parent::setTransactionId($value);
132
+	}
133
+
134
+	public function getData()
135
+	{
136
+		$this->validate('merchantId', 'terminalId', 'amount', 'currency');
137
+
138
+		return array(
139
+			// mandatory fields
140
+			'Ds_Merchant_MerchantCode'       => $this->getMerchantId(),
141
+			'Ds_Merchant_Terminal'           => $this->getTerminalId(),
142
+			'Ds_Merchant_TransactionType'    => '0',                          // Authorisation
143
+			'Ds_Merchant_Amount'             => $this->getAmountInteger(),
144
+			'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(),  // uses ISO-4217 codes
145
+			'Ds_Merchant_Order'              => $this->getTransactionId(),
146
+			'Ds_Merchant_MerchantUrl'        => $this->getNotifyUrl(),
147
+			// optional fields
148
+			'Ds_Merchant_ProductDescription' => $this->getDescription(),
149
+			'Ds_Merchant_Cardholder'         => $this->getCardholder(),
150
+			'Ds_Merchant_UrlOK'              => $this->getReturnUrl(),
151
+			'Ds_Merchant_UrlKO'              => $this->getReturnUrl(),
152
+			'Ds_Merchant_MerchantName'       => $this->getMerchantName(),
153
+			'Ds_Merchant_ConsumerLanguage'   => $this->getConsumerLanguage(),
154
+			'Ds_Merchant_MerchantData'       => $this->getMerchantData(),
155
+		);
156
+	}
157
+
158
+	public function sendData($data)
159
+	{
160
+		return $this->response = new PurchaseResponse($this, $data);
161
+	}
162
+
163
+	public function getEndpoint()
164
+	{
165
+		return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
166
+	}
167 167
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@
 block discarded – undo
139 139
             // mandatory fields
140 140
             'Ds_Merchant_MerchantCode'       => $this->getMerchantId(),
141 141
             'Ds_Merchant_Terminal'           => $this->getTerminalId(),
142
-            'Ds_Merchant_TransactionType'    => '0',                          // Authorisation
142
+            'Ds_Merchant_TransactionType'    => '0', // Authorisation
143 143
             'Ds_Merchant_Amount'             => $this->getAmountInteger(),
144
-            'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(),  // uses ISO-4217 codes
144
+            'Ds_Merchant_Currency'           => $this->getCurrencyNumeric(), // uses ISO-4217 codes
145 145
             'Ds_Merchant_Order'              => $this->getTransactionId(),
146 146
             'Ds_Merchant_MerchantUrl'        => $this->getNotifyUrl(),
147 147
             // optional fields
Please login to merge, or discard this patch.
Braces   +19 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Redsys Purchase Request
9 9
  */
10
-class PurchaseRequest extends AbstractRequest
11
-{
10
+class PurchaseRequest extends AbstractRequest {
12 11
     protected $liveEndpoint = 'https://sis.redsys.es/sis/realizarPago';
13 12
     protected $testEndpoint = 'https://sis-t.redsys.es:25443/sis/realizarPago';
14 13
     protected static $consumerLanguages = array(
@@ -26,18 +25,15 @@  discard block
 block discarded – undo
26 25
         'eu' => '013', // Basque
27 26
     );
28 27
 
29
-    public function getCardholder()
30
-    {
28
+    public function getCardholder() {
31 29
         return $this->getParameter('cardholder');
32 30
     }
33 31
 
34
-    public function setCardholder($value)
35
-    {
32
+    public function setCardholder($value) {
36 33
         return $this->setParameter('cardholder', $value);
37 34
     }
38 35
 
39
-    public function getConsumerLanguage()
40
-    {
36
+    public function getConsumerLanguage() {
41 37
         return $this->getParameter('consumerLanguage');
42 38
     }
43 39
 
@@ -46,8 +42,7 @@  discard block
 block discarded – undo
46 42
      *
47 43
      * @param string|int Either the ISO 639-1 code to be converted, or the gateway's own numeric language code
48 44
      */
49
-    public function setConsumerLanguage($value)
50
-    {
45
+    public function setConsumerLanguage($value) {
51 46
         if (is_int($value)) {
52 47
             if ($value < 0 || $value > 13) {
53 48
                 $value = 1;
@@ -60,53 +55,43 @@  discard block
 block discarded – undo
60 55
         return $this->setParameter('consumerLanguage', $value);
61 56
     }
62 57
 
63
-    public function getHmacKey()
64
-    {
58
+    public function getHmacKey() {
65 59
         return $this->getParameter('hmacKey');
66 60
     }
67 61
 
68
-    public function setHmacKey($value)
69
-    {
62
+    public function setHmacKey($value) {
70 63
         return $this->setParameter('hmacKey', $value);
71 64
     }
72 65
 
73
-    public function getMerchantData()
74
-    {
66
+    public function getMerchantData() {
75 67
         return $this->getParameter('merchantData');
76 68
     }
77 69
 
78
-    public function setMerchantData($value)
79
-    {
70
+    public function setMerchantData($value) {
80 71
         return $this->setParameter('merchantData', $value);
81 72
     }
82 73
 
83
-    public function getMerchantId()
84
-    {
74
+    public function getMerchantId() {
85 75
         return $this->getParameter('merchantId');
86 76
     }
87 77
 
88
-    public function setMerchantId($value)
89
-    {
78
+    public function setMerchantId($value) {
90 79
         return $this->setParameter('merchantId', $value);
91 80
     }
92 81
 
93
-    public function getMerchantName()
94
-    {
82
+    public function getMerchantName() {
95 83
         return $this->getParameter('merchantName');
96 84
     }
97 85
 
98
-    public function setMerchantName($value)
99
-    {
86
+    public function setMerchantName($value) {
100 87
         return $this->setParameter('merchantName', $value);
101 88
     }
102 89
 
103
-    public function getTerminalId()
104
-    {
90
+    public function getTerminalId() {
105 91
         return $this->getParameter('terminalId');
106 92
     }
107 93
 
108
-    public function setTerminalId($value)
109
-    {
94
+    public function setTerminalId($value) {
110 95
         return $this->setParameter('terminalId', $value);
111 96
     }
112 97
 
@@ -115,8 +100,7 @@  discard block
 block discarded – undo
115 100
      *
116 101
      * @param string|int $value The transaction ID (merchant order) to set for the transaction
117 102
      */
118
-    public function setTransactionId($value)
119
-    {
103
+    public function setTransactionId($value) {
120 104
         $start = substr($value, 0, 4);
121 105
         $numerics = 0;
122 106
         foreach (str_split($start) as $char) {
@@ -131,8 +115,7 @@  discard block
 block discarded – undo
131 115
         parent::setTransactionId($value);
132 116
     }
133 117
 
134
-    public function getData()
135
-    {
118
+    public function getData() {
136 119
         $this->validate('merchantId', 'terminalId', 'amount', 'currency');
137 120
 
138 121
         return array(
@@ -155,13 +138,11 @@  discard block
 block discarded – undo
155 138
         );
156 139
     }
157 140
 
158
-    public function sendData($data)
159
-    {
141
+    public function sendData($data) {
160 142
         return $this->response = new PurchaseResponse($this, $data);
161 143
     }
162 144
 
163
-    public function getEndpoint()
164
-    {
145
+    public function getEndpoint() {
165 146
         return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
166 147
     }
167 148
 }
Please login to merge, or discard this patch.
src/Message/PurchaseResponse.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,39 +9,39 @@
 block discarded – undo
9 9
  */
10 10
 class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
11 11
 {
12
-    protected $version = 'HMAC_SHA256_V1';
13
-
14
-    public function isSuccessful()
15
-    {
16
-        return false;
17
-    }
18
-
19
-    public function isRedirect()
20
-    {
21
-        return true;
22
-    }
23
-
24
-    public function getRedirectUrl()
25
-    {
26
-        return $this->getRequest()->getEndpoint();
27
-    }
28
-
29
-    public function getRedirectMethod()
30
-    {
31
-        return 'POST';
32
-    }
33
-
34
-    public function getRedirectData()
35
-    {
36
-        $redirect_data = array();
37
-        $redirect_data['Ds_SignatureVersion'] = $this->version;
38
-        $redirect_data['Ds_MerchantParameters'] = $this->encodeMerchantParameters($this->data);
39
-        $redirect_data['Ds_Signature'] = $this->createSignature(
40
-            $redirect_data['Ds_MerchantParameters'],
41
-            $this->data['Ds_Merchant_Order'],
42
-            base64_decode($this->request->getHmacKey())
43
-        );
44
-
45
-        return $redirect_data;
46
-    }
12
+	protected $version = 'HMAC_SHA256_V1';
13
+
14
+	public function isSuccessful()
15
+	{
16
+		return false;
17
+	}
18
+
19
+	public function isRedirect()
20
+	{
21
+		return true;
22
+	}
23
+
24
+	public function getRedirectUrl()
25
+	{
26
+		return $this->getRequest()->getEndpoint();
27
+	}
28
+
29
+	public function getRedirectMethod()
30
+	{
31
+		return 'POST';
32
+	}
33
+
34
+	public function getRedirectData()
35
+	{
36
+		$redirect_data = array();
37
+		$redirect_data['Ds_SignatureVersion'] = $this->version;
38
+		$redirect_data['Ds_MerchantParameters'] = $this->encodeMerchantParameters($this->data);
39
+		$redirect_data['Ds_Signature'] = $this->createSignature(
40
+			$redirect_data['Ds_MerchantParameters'],
41
+			$this->data['Ds_Merchant_Order'],
42
+			base64_decode($this->request->getHmacKey())
43
+		);
44
+
45
+		return $redirect_data;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,32 +7,26 @@
 block discarded – undo
7 7
 /**
8 8
  * Redsys Purchase Response
9 9
  */
10
-class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
11
-{
10
+class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface {
12 11
     protected $version = 'HMAC_SHA256_V1';
13 12
 
14
-    public function isSuccessful()
15
-    {
13
+    public function isSuccessful() {
16 14
         return false;
17 15
     }
18 16
 
19
-    public function isRedirect()
20
-    {
17
+    public function isRedirect() {
21 18
         return true;
22 19
     }
23 20
 
24
-    public function getRedirectUrl()
25
-    {
21
+    public function getRedirectUrl() {
26 22
         return $this->getRequest()->getEndpoint();
27 23
     }
28 24
 
29
-    public function getRedirectMethod()
30
-    {
25
+    public function getRedirectMethod() {
31 26
         return 'POST';
32 27
     }
33 28
 
34
-    public function getRedirectData()
35
-    {
29
+    public function getRedirectData() {
36 30
         $redirect_data = array();
37 31
         $redirect_data['Ds_SignatureVersion'] = $this->version;
38 32
         $redirect_data['Ds_MerchantParameters'] = $this->encodeMerchantParameters($this->data);
Please login to merge, or discard this patch.