cancel
Showing results for 
Search instead for 
Did you mean: 

3DS Payment Redirection in Magento 2

3DS Payment Redirection in Magento 2

Hi, 
 
I am developing payment gateway for magento2. But I have a problem. After the 3D payment bank verification, we can not finalize the shopping at the success url.
 
For 3D payment, we created our own action icon except magento's own button action, We have redirected to our own end point instead of the magento end point and We proceeded separately from the magento system. Because our end point is a controller of the magento extended class is "magento\Framework\App\Action\Action". So that I can not use the capture method and InfoInterface payment object extended from CC class that Magenton used for normal payment The content of the Success.php file is as follows;
 
<?php
namespace Hepsipay\Payment\Controller\ThreeDSecure;
use Exception;
use Magento\Framework\App\Action\Action;
class Success extends Action
{
    /**
     * @var \Magento\Checkout\Model\Session
     */
    protected $_session;

    /**
     * @var \Magento\Checkout\Model\Session
     */
    protected $_quoteManagement;

    /**
     * @param \Magento\Framework\App\Action\Context $context
     */
    public function __construct(
        \Magento\Framework\App\Action\Context $context,
        \Magento\Quote\Model\QuoteManagement $quoteManagement,
\Magento\Checkout\Model\Session $session
    )
    {
$this->_session = $session;
        parent::__construct($context);
    }

    /**
     * Set redirect
     */
    public function execute()
    {
        $response = $this->getRequest()->getParams();

        // Create Order From Quote
        $order = $this->_quoteManagement->submit($this->_session->getQuote());
        $increment_id = $order->getRealOrderId();

        $response = $this->getRequest()->getParams();
        if ($response) {
            if (true) {
                $session = $this->_session;
                $session->getQuote()->setIsActive(false)->save();
                $this->_redirect('checkout/onepage/success');
            } else {
                $this->_cancel($response);
                $this->_redirect('checkout/cart');
            }
        } else {
            // redirect to checkout page
            $this->_redirect('checkout/cart');
        }
    }
}
Also, the $response content returned from the bank is as follows;
 
**Response : Array
(
    [Success] => True
    [MessageCode] => 0000
    [Message] => Your transaction has been successful.
    [UserMessage] => Your transaction has been successful.
    [TransactionId] => 947acc2df698ed3d39311d6fd2c3baeb1478702541
    [Installment] => 1
    [Currency] => USD
    [ApiKey] =>12345
    [Amount] => 4200
    [Signature] => 12345
    [TransactionTime] => 1478702533
)
PS: The magento used is v2.1.1.