Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace CodOtpControllerIndex;
- use MagentoQuoteApiCartManagementInterface;
- use MagentoQuoteModelQuote;
- use MagentoCheckoutModelTypeOnepage;
- use MagentoFrameworkControllerResultFactory;
- class sotp extends MagentoFrameworkAppActionAction
- {
- protected $cartManagement;
- protected $quote;
- protected $resultRedirect;
- protected $checkoutSession;
- public function __construct(
- MagentoFrameworkAppActionContext $context,
- MagentoQuoteApiCartManagementInterface $cartManagement,
- MagentoQuoteModelQuote $quote,
- MagentoCheckoutModelSession $checkoutSession,
- MagentoFrameworkControllerResultFactory $resultPageFactory
- ){
- parent::__construct($context);
- $this->cartManagement = $cartManagement;
- $this->quote = $quote;
- $this->resultRedirect = $context->getResultFactory();
- $this->_checkoutSession = $checkoutSession;
- }
- public function execute()
- {
- $this->_view->loadLayout();
- $this->_view->getLayout()->initMessages();
- $this->_view->renderLayout();
- $this->quote = $this->checkoutSession->getQuote();
- $this->quote->getPayment()->setMethod('payfull');
- $this->cartManagement->placeOrder($this->quote->getId());
- $resultRedirect = $this->resultRedirect->create(ResultFactory::TYPE_REDIRECT);
- $resultRedirect->setPath('checkout/onepage/success', ['_secure' => true]);
- }
- }
Add Comment
Please, Sign In to add comment