diff --git a/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeAssignBillingAddress.php b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeAssignBillingAddress.php new file mode 100644 index 00000000000..e1184376f3a --- /dev/null +++ b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeAssignBillingAddress.php @@ -0,0 +1,73 @@ +checkoutHelper = $checkoutHelper; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; + $this->cartRepository = $cartRepository; + } + + /** + * Checks whether guest checkout is enabled before assigning billing address + * + * @param GuestBillingAddressManagementInterface $subject + * @param string $cartId + * @param AddressInterface $address + * @param bool $useForShipping + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeAssign( + GuestBillingAddressManagementInterface $subject, + $cartId, + AddressInterface $address, + $useForShipping = false + ): void { + /** @var $quoteIdMask QuoteIdMask */ + $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $quote = $this->cartRepository->get($quoteIdMask->getQuoteId()); + if (!$this->checkoutHelper->isAllowedGuestCheckout($quote)) { + throw new CouldNotSaveException(__('Sorry, guest checkout is not available.')); + } + } +} diff --git a/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforePlaceOrder.php b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforePlaceOrder.php new file mode 100644 index 00000000000..3691b25c308 --- /dev/null +++ b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforePlaceOrder.php @@ -0,0 +1,71 @@ +checkoutHelper = $checkoutHelper; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; + $this->cartRepository = $cartRepository; + } + + /** + * Checks whether guest checkout is enabled before placing order + * + * @param GuestCartManagementInterface $subject + * @param string $cartId + * @param PaymentInterface|null $paymentMethod + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforePlaceOrder( + GuestCartManagementInterface $subject, + $cartId, + PaymentInterface $paymentMethod = null + ): void { + /** @var $quoteIdMask QuoteIdMask */ + $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $quote = $this->cartRepository->get($quoteIdMask->getQuoteId()); + if (!$this->checkoutHelper->isAllowedGuestCheckout($quote)) { + throw new CouldNotSaveException(__('Sorry, guest checkout is not available.')); + } + } +} diff --git a/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSavePaymentInformation.php b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSavePaymentInformation.php new file mode 100644 index 00000000000..1644bf945cd --- /dev/null +++ b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSavePaymentInformation.php @@ -0,0 +1,76 @@ +checkoutHelper = $checkoutHelper; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; + $this->cartRepository = $cartRepository; + } + + /** + * Checks whether guest checkout is enabled before saving payment information + * + * @param GuestPaymentInformationManagementInterface $subject + * @param string $cartId + * @param string $email + * @param PaymentInterface $paymentMethod + * @param AddressInterface|null $billingAddress + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSavePaymentInformation( + GuestPaymentInformationManagementInterface $subject, + $cartId, + $email, + PaymentInterface $paymentMethod, + AddressInterface $billingAddress = null + ): void { + /** @var $quoteIdMask QuoteIdMask */ + $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $quote = $this->cartRepository->get($quoteIdMask->getQuoteId()); + if (!$this->checkoutHelper->isAllowedGuestCheckout($quote)) { + throw new CouldNotSaveException(__('Sorry, guest checkout is not available.')); + } + } +} diff --git a/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSaveShippingInformation.php b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSaveShippingInformation.php new file mode 100644 index 00000000000..6888fe0a3ff --- /dev/null +++ b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSaveShippingInformation.php @@ -0,0 +1,71 @@ +checkoutHelper = $checkoutHelper; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; + $this->cartRepository = $cartRepository; + } + + /** + * Checks whether guest checkout is enabled before saving shipping information + * + * @param GuestShippingInformationManagementInterface $subject + * @param string $cartId + * @param ShippingInformationInterface $addressInformation + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSaveAddressInformation( + GuestShippingInformationManagementInterface $subject, + $cartId, + ShippingInformationInterface $addressInformation + ): void { + /** @var $quoteIdMask QuoteIdMask */ + $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $quote = $this->cartRepository->get($quoteIdMask->getQuoteId()); + if (!$this->checkoutHelper->isAllowedGuestCheckout($quote)) { + throw new CouldNotSaveException(__('Sorry, guest checkout is not available.')); + } + } +} diff --git a/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSetPaymentMethod.php b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSetPaymentMethod.php new file mode 100644 index 00000000000..3a2fcd96119 --- /dev/null +++ b/vendor/magento/module-checkout/Plugin/Api/VerifyIsGuestCheckoutEnabledBeforeSetPaymentMethod.php @@ -0,0 +1,71 @@ +checkoutHelper = $checkoutHelper; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; + $this->cartRepository = $cartRepository; + } + + /** + * Checks whether guest checkout is enabled before setting payment method + * + * @param GuestPaymentMethodManagementInterface $subject + * @param string $cartId + * @param PaymentInterface $method + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeSet( + GuestPaymentMethodManagementInterface $subject, + $cartId, + PaymentInterface $method + ): void { + /** @var $quoteIdMask QuoteIdMask */ + $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $quote = $this->cartRepository->get($quoteIdMask->getQuoteId()); + if (!$this->checkoutHelper->isAllowedGuestCheckout($quote)) { + throw new CouldNotSaveException(__('Sorry, guest checkout is not available.')); + } + } +} diff --git a/vendor/magento/module-checkout/etc/webapi_rest/di.xml b/vendor/magento/module-checkout/etc/webapi_rest/di.xml new file mode 100644 index 00000000000..2f426d96b4e --- /dev/null +++ b/vendor/magento/module-checkout/etc/webapi_rest/di.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vendor/magento/module-checkout/etc/webapi_soap/di.xml b/vendor/magento/module-checkout/etc/webapi_soap/di.xml new file mode 100644 index 00000000000..2f426d96b4e --- /dev/null +++ b/vendor/magento/module-checkout/etc/webapi_soap/di.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + +