Skip to content

Commit

Permalink
[PAYONE-190] if the customer has a company address, the birthday is n…
Browse files Browse the repository at this point in the history
…ot required
  • Loading branch information
amirinterlutions committed Nov 10, 2023
1 parent 5497dc3 commit cdcadc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% block payone_payolution_consent_checkbox %}

{% if context.customer.activeBillingAddress and context.customer.activeBillingAddress.company is empty %}
<div class="row consent-row">
<div class="col-12">
<label class="form-label" for="payolutionBirthday">
Expand All @@ -17,6 +19,7 @@
/>
</div>
</div>
{% endif %}

<div class="row consent-row">
<div class="col-12">
Expand Down

0 comments on commit cdcadc7

Please sign in to comment.