We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit b49ea053 authored by cyattilakiss's avatar cyattilakiss Committed by Rik ter Beek

Save ccType in every case when it is available - fix for vault payments (#487)

parent e571a204
...@@ -32,6 +32,11 @@ class CheckoutResponseValidator extends AbstractValidator ...@@ -32,6 +32,11 @@ class CheckoutResponseValidator extends AbstractValidator
*/ */
private $adyenLogger; private $adyenLogger;
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/** /**
* GeneralResponseValidator constructor. * GeneralResponseValidator constructor.
* *
...@@ -40,9 +45,11 @@ class CheckoutResponseValidator extends AbstractValidator ...@@ -40,9 +45,11 @@ class CheckoutResponseValidator extends AbstractValidator
*/ */
public function __construct( public function __construct(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory, \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper
) { ) {
$this->adyenLogger = $adyenLogger; $this->adyenLogger = $adyenLogger;
$this->adyenHelper = $adyenHelper;
parent::__construct($resultFactory); parent::__construct($resultFactory);
} }
...@@ -80,6 +87,13 @@ class CheckoutResponseValidator extends AbstractValidator ...@@ -80,6 +87,13 @@ class CheckoutResponseValidator extends AbstractValidator
} }
} }
// Save cc_type if available in the response
if (!empty($response['additionalData']['paymentMethod'])) {
$ccType = $this->adyenHelper->getMagentoCreditCartType($response['additionalData']['paymentMethod']);
$payment->setAdditionalInformation('cc_type', $ccType);
$payment->setCcType($ccType);
}
$payment->setAdditionalInformation('pspReference', $response['pspReference']); $payment->setAdditionalInformation('pspReference', $response['pspReference']);
break; break;
case "Received": case "Received":
......
...@@ -32,6 +32,11 @@ class GeneralResponseValidator extends AbstractValidator ...@@ -32,6 +32,11 @@ class GeneralResponseValidator extends AbstractValidator
*/ */
private $adyenLogger; private $adyenLogger;
/**
* @var \Adyen\Payment\Helper\Data
*/
private $adyenHelper;
/** /**
* GeneralResponseValidator constructor. * GeneralResponseValidator constructor.
* *
...@@ -40,9 +45,11 @@ class GeneralResponseValidator extends AbstractValidator ...@@ -40,9 +45,11 @@ class GeneralResponseValidator extends AbstractValidator
*/ */
public function __construct( public function __construct(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory, \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Payment\Helper\Data $adyenHelper
) { ) {
$this->adyenLogger = $adyenLogger; $this->adyenLogger = $adyenLogger;
$this->adyenHelper = $adyenHelper;
parent::__construct($resultFactory); parent::__construct($resultFactory);
} }
...@@ -65,6 +72,14 @@ class GeneralResponseValidator extends AbstractValidator ...@@ -65,6 +72,14 @@ class GeneralResponseValidator extends AbstractValidator
switch ($response['resultCode']) { switch ($response['resultCode']) {
case "Authorised": case "Authorised":
$payment->setAdditionalInformation('pspReference', $response['pspReference']); $payment->setAdditionalInformation('pspReference', $response['pspReference']);
// Save cc_type if available in the response
if (!empty($response['additionalData']['paymentMethod'])) {
$ccType = $this->adyenHelper->getMagentoCreditCartType($response['additionalData']['paymentMethod']);
$payment->setAdditionalInformation('cc_type', $ccType);
$payment->setCcType($ccType);
}
break; break;
case "Received": case "Received":
$payment->setAdditionalInformation('pspReference', $response['pspReference']); $payment->setAdditionalInformation('pspReference', $response['pspReference']);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment