diff --git a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php index 021bdadc7..084b5b7c0 100644 --- a/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php +++ b/src/PaymentHandler/PayonePayolutionInvoicingPaymentHandler.php @@ -18,7 +18,11 @@ public function getValidationDefinitions(SalesChannelContext $salesChannelContex $definitions = parent::getValidationDefinitions($salesChannelContext); $definitions['payolutionConsent'] = [new NotBlank()]; - $definitions['payolutionBirthday'] = [new NotBlank(), new Birthday(['value' => $this->getMinimumDate()])]; + + // if the customer has a company address, the birthday is not required + if ($salesChannelContext->getCustomer()?->getDefaultBillingAddress()?->getCompany() === null) { + $definitions['payolutionBirthday'] = [new NotBlank(), new Birthday(['value' => $this->getMinimumDate()])]; + } $configuration = $this->configReader->read($salesChannelContext->getSalesChannel()->getId()); diff --git a/src/Resources/views/storefront/payone/payolution/consent-checkbox.html.twig b/src/Resources/views/storefront/payone/payolution/consent-checkbox.html.twig index 0d797f59c..6024f32db 100644 --- a/src/Resources/views/storefront/payone/payolution/consent-checkbox.html.twig +++ b/src/Resources/views/storefront/payone/payolution/consent-checkbox.html.twig @@ -1,4 +1,6 @@ {% block payone_payolution_consent_checkbox %} + + {% if context.customer.activeBillingAddress and context.customer.activeBillingAddress.company is empty %} + {% endif %}