We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday 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
$isValid = true;
$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');
$this->adyenLogger->error($errorMsg);
$errorMessages[] = $errorMsg;
......
......@@ -214,8 +214,14 @@ class Cron
*/
private $agreementResourceModel;
/**
* @var \Magento\Sales\Model\Order\Payment\Transaction\Builder
*/
private $transactionBuilder;
/**
* Cron constructor.
*
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param ResourceModel\Notification\CollectionFactory $notificationFactory
......@@ -235,6 +241,7 @@ class Cron
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param OrderRepository $orderRepository
* @param ResourceModel\Billing\Agreement $agreementResourceModel
* @param \Magento\Sales\Model\Order\Payment\Transaction\Builder $transactionBuilder
*/
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
......@@ -255,7 +262,8 @@ class Cron
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $orderStatusCollection,
SearchCriteriaBuilder $searchCriteriaBuilder,
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->_adyenLogger = $adyenLogger;
......@@ -276,6 +284,7 @@ class Cron
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->orderRepository = $orderRepository;
$this->agreementResourceModel = $agreementResourceModel;
$this->transactionBuilder = $transactionBuilder;
}
/**
......@@ -1235,6 +1244,16 @@ class Cron
// set transaction
$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
if (!$this->_isAutoCapture()) {
$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