Skip to content

Commit 801e656

Browse files
Handle encrypted credit card details where supplied #9
Eway already supports encryptedCardNumber as a paramter. However, that relies on the calling code 'knowing' whether the card has been encrypted - which would not happen if a script blocker was in play and is hard for the calling code to adapt to generically. However, at this point in the code we know that if it is following the eway format for being encrypted then it has been encrypted. I would note that it is supported by the Request object not the credit card class but a) that is already the case, this just makes it a bit simpler to use and b) the encryptedCardNumber does not hold sensitive data in the same way that the 'card' parameters do. The upstream plan appears to be to have another class to handle this - in which case this bit of handling code and the code that interacts with it could be updated later to reflect that
1 parent a2c5fb3 commit 801e656

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/RapidDirectGateway.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ public function setPassword($value)
135135
*/
136136
public function purchase(array $parameters = [])
137137
{
138+
if (is_array($parameters['card']) && isset($parameters['card']['number']) && substr($parameters['card']['number'], 0, 9) === 'eCrypted:') {
139+
$parameters['encryptedCardNumber'] = $parameters['card']['number'];
140+
}
138141
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
139142
}
140143

@@ -152,6 +155,9 @@ public function purchase(array $parameters = [])
152155
*/
153156
public function authorize(array $parameters = [])
154157
{
158+
if (isset($parameters['card']['number']) && substr($parameters['card']['number'], 0, 9) === 'eCrypted:') {
159+
$parameters['encryptedCardNumber'] = $parameters['card']['number'];
160+
}
155161
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectAuthorizeRequest', $parameters);
156162
}
157163

0 commit comments

Comments
 (0)