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 e469e3f5 authored by attilak's avatar attilak

Save transaction for 3DS and redirect payment methods in the cron job

parent 47d5b826
......@@ -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