Skip to content

Commit

Permalink
Handle encrypted credit card details where supplied #9
Browse files Browse the repository at this point in the history
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
  • Loading branch information
eileenmcnaughton committed Nov 26, 2018
1 parent a2c5fb3 commit 724b023
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/RapidDirectGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public function setPassword($value)
*/
public function purchase(array $parameters = [])
{
if (isset($parameters['card']['number']) && substr($parameters['card']['number'], 0, 9) === 'eCrypted:') {
$parameters['encryptedCardNumber'] = $parameters['card']['number'];
}
return $this->createRequest('\Omnipay\Eway\Message\RapidDirectPurchaseRequest', $parameters);
}

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

Expand Down

0 comments on commit 724b023

Please sign in to comment.