Class Validation
Definition at line 16 of file Validation.php.
◆ __construct()
- Parameters
-
\Magento\Checkout\Api\AgreementsValidatorInterface | $agreementsValidator | |
\Magento\Framework\App\Config\ScopeConfigInterface | $scopeConfiguration | |
\Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface | $checkoutAgreementsList | |
ActiveStoreAgreementsFilter | $activeStoreAgreementsFilter | |
Definition at line 44 of file Validation.php.
52 $this->checkoutAgreementsList = $checkoutAgreementsList;
53 $this->activeStoreAgreementsFilter = $activeStoreAgreementsFilter;
◆ beforeSavePaymentInformation()
- Parameters
-
\Magento\Checkout\Api\PaymentInformationManagementInterface | $subject | |
int | $cartId | |
\Magento\Quote\Api\Data\PaymentInterface | $paymentMethod | |
\Magento\Quote\Api\Data\AddressInterface | null | $billingAddress | |
- Exceptions
-
Definition at line 85 of file Validation.php.
validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $paymentMethod)
◆ beforeSavePaymentInformationAndPlaceOrder()
- Parameters
-
\Magento\Checkout\Api\PaymentInformationManagementInterface | $subject | |
int | $cartId | |
\Magento\Quote\Api\Data\PaymentInterface | $paymentMethod | |
\Magento\Quote\Api\Data\AddressInterface | null | $billingAddress | |
- Exceptions
-
Definition at line 65 of file Validation.php.
validateAgreements(\Magento\Quote\Api\Data\PaymentInterface $paymentMethod)
◆ isAgreementEnabled()
Verify if agreement validation needed
- Returns
- bool
Definition at line 121 of file Validation.php.
123 $isAgreementsEnabled = $this->scopeConfiguration->isSetFlag(
127 $agreementsList = $isAgreementsEnabled
128 ? $this->checkoutAgreementsList->getList($this->activeStoreAgreementsFilter->buildSearchCriteria())
130 return (
bool)($isAgreementsEnabled && count($agreementsList) > 0);
◆ validateAgreements()
- Parameters
-
\Magento\Quote\Api\Data\PaymentInterface | $paymentMethod | |
- Exceptions
-
Definition at line 101 of file Validation.php.
103 $agreements = $paymentMethod->getExtensionAttributes() ===
null 105 : $paymentMethod->getExtensionAttributes()->getAgreementIds();
107 if (!$this->agreementsValidator->isValid($agreements)) {
108 throw new \Magento\Framework\Exception\CouldNotSaveException(
110 "The order wasn't placed. " 111 .
"First, agree to the terms and conditions, then try placing your order again."
◆ $agreementsValidator
◆ $scopeConfiguration
The documentation for this class was generated from the following file:
- vendor/magento/module-checkout-agreements/Model/Checkout/Plugin/Validation.php