Skip to content

Commit

Permalink
Release 4.0.29
Browse files Browse the repository at this point in the history
  • Loading branch information
edgaraswallee committed Mar 29, 2022
1 parent 03bde17 commit df1db3f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.29
- Fix to hide birthdate field if it's already provided
- Tested against SW v6.4.9.0

# 4.0.28
- Added italian translations
- Tested against SW v6.4.9.0
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 4.0.29
- Korrektur zum Ausblenden des Geburtsdatumsfelds, wenn es bereits vorhanden ist
- Getestet mit SW v6.4.9.0

# 4.0.28
- Italienische Übersetzungen hinzugefügt
- Getestet mit SW v6.4.9.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tail -f var/log/postfinancecheckout_payment*.log

## Documentation

[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.28/docs/en/documentation.html)
[Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/shopware-6/4.0.29/docs/en/documentation.html)

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@
"postfinancecheckout/sdk": "3.0.1"
},
"type": "shopware-platform-plugin",
"version": "4.0.28"
"version": "4.0.29"
}
2 changes: 1 addition & 1 deletion docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/shopware-6/releases/tag/4.0.28/">
<a href="https://github.com/pfpayments/shopware-6/releases/tag/4.0.29/">
Source
</a>
</li>
Expand Down
12 changes: 12 additions & 0 deletions src/Core/Util/Payload/TransactionPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,13 @@ protected function getAddressPayload(CustomerEntity $customer, CustomerAddressEn
}
$salutation = !empty($salutation) ? $this->fixLength($salutation, 20) : null;

$birthday = null;
if (!empty($customer->getBirthday())) {
$birthday = new \DateTime();
$birthday->setTimestamp($customer->getBirthday()->getTimestamp());
$birthday = $birthday->format('Y-m-d');
}

$addressData = [
'city' => $customerAddressEntity->getCity() ? $this->fixLength($customerAddressEntity->getCity(), 100) : null,
'country' => $customerAddressEntity->getCountry() ? $customerAddressEntity->getCountry()->getIso() : null,
Expand All @@ -526,6 +533,7 @@ protected function getAddressPayload(CustomerEntity $customer, CustomerAddressEn
'postal_state' => $customerAddressEntity->getCountryState() ? $customerAddressEntity->getCountryState()->getShortCode() : null,
'salutation' => $salutation,
'street' => $customerAddressEntity->getStreet() ? $this->fixLength($customerAddressEntity->getStreet(), 300) : null,
'birthday' => $birthday
];

$addressPayload = (new AddressCreate())
Expand All @@ -541,6 +549,10 @@ protected function getAddressPayload(CustomerEntity $customer, CustomerAddressEn
->setSalutation($addressData['salutation'])
->setStreet($addressData['street']);

if (!empty($addressData['birthday'])) {
$addressPayload->setDateOfBirth($addressData['birthday']);
}

if (!$addressPayload->valid()) {
$this->logger->critical('Address payload invalid:', $addressPayload->listInvalidProperties());
throw new InvalidPayloadException('Address payload invalid:' . json_encode($addressPayload->listInvalidProperties()));
Expand Down

Large diffs are not rendered by default.

0 comments on commit df1db3f

Please sign in to comment.