Guest User

Untitled

a guest
Nov 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. namespace CodOtpControllerIndex;
  4.  
  5. use MagentoQuoteApiCartManagementInterface;
  6. use MagentoQuoteModelQuote;
  7. use MagentoCheckoutModelTypeOnepage;
  8. use MagentoFrameworkControllerResultFactory;
  9.  
  10. class sotp extends MagentoFrameworkAppActionAction
  11. {
  12.  
  13. protected $cartManagement;
  14. protected $quote;
  15. protected $resultRedirect;
  16. protected $checkoutSession;
  17.  
  18. public function __construct(
  19. MagentoFrameworkAppActionContext $context,
  20. MagentoQuoteApiCartManagementInterface $cartManagement,
  21. MagentoQuoteModelQuote $quote,
  22. MagentoCheckoutModelSession $checkoutSession,
  23. MagentoFrameworkControllerResultFactory $resultPageFactory
  24.  
  25. ){
  26. parent::__construct($context);
  27. $this->cartManagement = $cartManagement;
  28. $this->quote = $quote;
  29. $this->resultRedirect = $context->getResultFactory();
  30. $this->_checkoutSession = $checkoutSession;
  31. }
  32. public function execute()
  33. {
  34.  
  35. $this->_view->loadLayout();
  36. $this->_view->getLayout()->initMessages();
  37. $this->_view->renderLayout();
  38. $this->quote = $this->checkoutSession->getQuote();
  39. $this->quote->getPayment()->setMethod('payfull');
  40. $this->cartManagement->placeOrder($this->quote->getId());
  41. $resultRedirect = $this->resultRedirect->create(ResultFactory::TYPE_REDIRECT);
  42. $resultRedirect->setPath('checkout/onepage/success', ['_secure' => true]);
  43. }
  44. }
Add Comment
Please, Sign In to add comment