27 private $cartManagement;
32 private $agreementsValidator;
37 private $customerSession;
42 private $checkoutHelper;
59 $this->agreementsValidator = $agreementsValidator;
60 $this->customerSession = $customerSession;
61 $this->checkoutHelper = $checkoutHelper;
74 if (!$this->agreementsValidator->isValid(
$agreement)) {
76 "The order wasn't placed. First, agree to the terms and conditions, then try placing your order again." 81 $this->prepareGuestQuote(
$quote);
87 $this->cartManagement->placeOrder(
$quote->getId());
98 if ($this->customerSession->isLoggedIn()) {
101 if (!
$quote->getCheckoutMethod()) {
102 if ($this->checkoutHelper->isAllowedGuestCheckout(
$quote)) {
109 return $quote->getCheckoutMethod();
118 private function prepareGuestQuote(Quote
$quote)
120 $quote->setCustomerId(
null)
121 ->setCustomerEmail(
$quote->getBillingAddress()->getEmail())
122 ->setCustomerIsGuest(
true)
disabledQuoteAddressValidation(Quote $quote)
__construct(CartManagementInterface $cartManagement, AgreementsValidatorInterface $agreementsValidator, Session $customerSession, Data $checkoutHelper)
execute(Quote $quote, array $agreement)