47 private $paymentFailures;
61 \
Magento\Sales\Model\OrderFactory $orderFactory,
62 \
Magento\Paypal\Model\PayflowlinkFactory $payflowModelFactory,
63 \
Magento\Paypal\Helper\Checkout $checkoutHelper,
65 \
Magento\Sales\Api\PaymentFailuresInterface $paymentFailures =
null 67 parent::__construct($context);
69 $this->_checkoutSession = $checkoutSession;
70 $this->_orderFactory = $orderFactory;
72 $this->_payflowModelFactory = $payflowModelFactory;
73 $this->_checkoutHelper = $checkoutHelper;
74 $this->paymentFailures = $paymentFailures ?: $this->_objectManager->get(
75 \
Magento\Sales\Api\PaymentFailuresInterface::class
87 $errorMsg = trim(strip_tags($errorMsg));
88 $order = $this->_checkoutSession->getLastRealOrder();
90 $this->paymentFailures->handle((
int)
$order->getQuoteId(), $errorMsg);
94 $this->_checkoutHelper->cancelCurrentOrder($errorMsg);
95 if ($this->_checkoutSession->restoreQuote()) {
97 $gotoSection =
'paymentMethod';
_cancelPayment($errorMsg='')
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Paypal\Model\PayflowlinkFactory $payflowModelFactory, \Magento\Paypal\Helper\Checkout $checkoutHelper, \Psr\Log\LoggerInterface $logger, \Magento\Sales\Api\PaymentFailuresInterface $paymentFailures=null)