23 if (!$this->_formKeyValidator->validate($this->getRequest())) {
24 return $this->resultRedirectFactory->create()->setPath(
'*/*/');
33 $agreementsValidator = $this->_objectManager->get(
34 \
Magento\CheckoutAgreements\Model\AgreementsValidator::class
36 if (!$agreementsValidator->isValid(array_keys($this->
getRequest()->getPost(
'agreement', [])))) {
37 $result->setData(
'success',
false);
38 $result->setData(
'error',
true);
42 "The order wasn't placed. " 43 .
"First, agree to the terms and conditions, then try placing your order again." 46 return $this->resultJsonFactory->create()->setData(
$result->getData());
64 $redirectUrl = $this->
getOnepage()->getCheckout()->getRedirectUrl();
65 $result->setData(
'success',
true);
66 $result->setData(
'error',
false);
72 $result->setData(
'goto_section',
'payment');
76 'name' =>
'payment-method',
81 $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
82 $this->_objectManager->get(\
Magento\Checkout\Helper\Data::class)
83 ->sendPaymentFailedEmail($this->
getOnepage()->getQuote(), $e->getMessage());
88 $result->setData(
'error',
true);
89 $result->setData(
'error_messages', $e->getMessage());
90 $gotoSection = $this->
getOnepage()->getCheckout()->getGotoSection();
92 $result->setData(
'goto_section', $gotoSection);
93 $this->
getOnepage()->getCheckout()->setGotoSection(
null);
96 $updateSection = $this->
getOnepage()->getCheckout()->getUpdateSection();
98 if (isset($this->_sectionUpdateFunctions[$updateSection])) {
99 $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
103 'name' => $updateSection,
104 'html' => $this->{$updateSectionFunction}(),
108 $this->
getOnepage()->getCheckout()->setUpdateSection(
null);
111 $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
112 $this->_objectManager->get(\
Magento\Checkout\Helper\Data::class)
113 ->sendPaymentFailedEmail($this->
getOnepage()->getQuote(), $e->getMessage());
114 $result->setData(
'success',
false);
115 $result->setData(
'error',
true);
118 __(
'Something went wrong while processing your order. Please try again later.')
125 if (isset($redirectUrl)) {
126 $result->setData(
'redirect', $redirectUrl);
129 $this->_eventManager->dispatch(
130 'checkout_controller_onepage_saveOrder',
137 return $this->resultJsonFactory->create()->setData(
$result->getData());
const CHECK_USE_FOR_CURRENCY
const CHECK_ORDER_TOTAL_MIN_MAX
const CHECK_USE_FOR_COUNTRY