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 96bee34c authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #427 from Adyen/PW-1199

[PW-1199] 3DS cancellation bug
parents 47d5b826 e469e3f5
...@@ -58,7 +58,10 @@ class CancelResponseValidator extends AbstractValidator ...@@ -58,7 +58,10 @@ class CancelResponseValidator extends AbstractValidator
$isValid = true; $isValid = true;
$errorMessages = []; $errorMessages = [];
if ($response['response'] != '[cancelOrRefund-received]') { // The available response codes that the API can return in case of successfull cancellation
$expectedResponses = ['[cancelOrRefund-received]', '[cancel-received]'];
if (!in_array($response['response'], $expectedResponses)) {
$errorMsg = __('Error with cancellation'); $errorMsg = __('Error with cancellation');
$this->adyenLogger->error($errorMsg); $this->adyenLogger->error($errorMsg);
$errorMessages[] = $errorMsg; $errorMessages[] = $errorMsg;
......
...@@ -214,8 +214,14 @@ class Cron ...@@ -214,8 +214,14 @@ class Cron
*/ */
private $agreementResourceModel; private $agreementResourceModel;
/**
* @var \Magento\Sales\Model\Order\Payment\Transaction\Builder
*/
private $transactionBuilder;
/** /**
* Cron constructor. * Cron constructor.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param ResourceModel\Notification\CollectionFactory $notificationFactory * @param ResourceModel\Notification\CollectionFactory $notificationFactory
...@@ -235,6 +241,7 @@ class Cron ...@@ -235,6 +241,7 @@ class Cron
* @param SearchCriteriaBuilder $searchCriteriaBuilder * @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository * @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel * @param ResourceModel\Billing\Agreement $agreementResourceModel
* @param \Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
...@@ -255,7 +262,8 @@ class Cron ...@@ -255,7 +262,8 @@ class Cron
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection, \Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection,
SearchCriteriaBuilder $searchCriteriaBuilder, SearchCriteriaBuilder $searchCriteriaBuilder,
OrderRepository $orderRepository, OrderRepository $orderRepository,
\Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel \Adyen\Payment\Model\ResourceModel\Billing\Agreement $agreementResourceModel,
\Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
) { ) {
$this->_scopeConfig = $scopeConfig; $this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -276,6 +284,7 @@ class Cron ...@@ -276,6 +284,7 @@ class Cron
$this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository; $this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel; $this->agreementResourceModel = $agreementResourceModel;
$this->transactionBuilder = $transactionBuilder;
} }
/** /**
...@@ -1235,6 +1244,16 @@ class Cron ...@@ -1235,6 +1244,16 @@ class Cron
// set transaction // set transaction
$paymentObj->setTransactionId($this->_pspReference); $paymentObj->setTransactionId($this->_pspReference);
// Prepare transaction
$transaction = $this->transactionBuilder->setPayment($paymentObj)
->setOrder($this->_order)
->setTransactionId($this->_pspReference)
->build(\Magento\Sales\Api\Data\TransactionInterface::TYPE_AUTH);
$transaction->setIsClosed(false);
$transaction->save();
//capture mode //capture mode
if (!$this->_isAutoCapture()) { if (!$this->_isAutoCapture()) {
$this->_order->addStatusHistoryComment(__('Capture Mode set to Manual')); $this->_order->addStatusHistoryComment(__('Capture Mode set to Manual'));
......
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