From 055bbf41d480a208f7e8d18967da05fec63261c6 Mon Sep 17 00:00:00 2001 From: Patryk Fabeck Date: Wed, 19 Jun 2019 12:47:48 +0200 Subject: [PATCH] Gender (#495) * optional attribute type * optional attribute type * styleCI * styleCI --- .../Order/Customer/CustomerRequestGenerator.php | 2 +- .../ResponseParser/Order/OrderResponseParser.php | 2 +- .../ResponseParser/Address/AddressResponseParser.php | 2 +- .../ResponseParser/Customer/CustomerResponseParser.php | 2 +- CHANGELOG.md | 1 + Connector/TransferObject/Order/Address/Address.php | 1 + Connector/TransferObject/Order/Customer/Customer.php | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Adapter/PlentymarketsAdapter/RequestGenerator/Order/Customer/CustomerRequestGenerator.php b/Adapter/PlentymarketsAdapter/RequestGenerator/Order/Customer/CustomerRequestGenerator.php index 1c2e97c61..cc32722e6 100644 --- a/Adapter/PlentymarketsAdapter/RequestGenerator/Order/Customer/CustomerRequestGenerator.php +++ b/Adapter/PlentymarketsAdapter/RequestGenerator/Order/Customer/CustomerRequestGenerator.php @@ -64,7 +64,7 @@ public function generate(Customer $customer, Order $order): array 'typeId' => 1, 'firstName' => $customer->getFirstname(), 'lastName' => $customer->getLastname(), - 'gender' => $customer->getGender() === Customer::GENDER_MALE ? 'male' : 'female', + 'gender' => $customer->getGender(), 'lang' => $languageIdentity->getAdapterIdentifier(), 'singleAccess' => $customer->getType() === Customer::TYPE_GUEST, 'plentyId' => $shopIdentity->getAdapterIdentifier(), diff --git a/Adapter/PlentymarketsAdapter/ResponseParser/Order/OrderResponseParser.php b/Adapter/PlentymarketsAdapter/ResponseParser/Order/OrderResponseParser.php index bf9302c78..8f1fb9ec0 100644 --- a/Adapter/PlentymarketsAdapter/ResponseParser/Order/OrderResponseParser.php +++ b/Adapter/PlentymarketsAdapter/ResponseParser/Order/OrderResponseParser.php @@ -355,7 +355,7 @@ private function getCustomer(array $entry) $customer->setEmail($this->getMail($entry)); $customer->setLanguageIdentifier($languageIdentity->getObjectIdentifier()); $customer->setCustomerGroupIdentifier($customerGroupIdentity->getObjectIdentifier()); - $customer->setGender($entry['customerData']['gender'] === 'male' ? Customer::GENDER_MALE : Customer::GENDER_FEMALE); + $customer->setGender($entry['customerData']['gender']); $customer->setFirstname($entry['customerData']['firstName']); $customer->setLastname($entry['customerData']['lastName']); $customer->setPhoneNumber($this->getPhoneNumber($entry)); diff --git a/Adapter/ShopwareAdapter/ResponseParser/Address/AddressResponseParser.php b/Adapter/ShopwareAdapter/ResponseParser/Address/AddressResponseParser.php index 924b65837..7a09631ff 100755 --- a/Adapter/ShopwareAdapter/ResponseParser/Address/AddressResponseParser.php +++ b/Adapter/ShopwareAdapter/ResponseParser/Address/AddressResponseParser.php @@ -51,7 +51,7 @@ public function parse(array $entry) } elseif ($entry['salutation'] === 'ms' || $entry['salutation'] === 'frau') { $gender = Customer::GENDER_FEMALE; } else { - $gender = null; + $gender = Customer::GENDER_DIVERSE; } $params = [ diff --git a/Adapter/ShopwareAdapter/ResponseParser/Customer/CustomerResponseParser.php b/Adapter/ShopwareAdapter/ResponseParser/Customer/CustomerResponseParser.php index c7a27b81f..e9f70c00a 100644 --- a/Adapter/ShopwareAdapter/ResponseParser/Customer/CustomerResponseParser.php +++ b/Adapter/ShopwareAdapter/ResponseParser/Customer/CustomerResponseParser.php @@ -76,7 +76,7 @@ public function parse(array $entry) } elseif ($entry['salutation'] === 'ms' || $entry['salutation'] === 'frau') { $gender = Customer::GENDER_FEMALE; } else { - $gender = null; + $gender = Customer::GENDER_DIVERSE; } if (empty($entry['birthday'])) { diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c90d2d8..e6a197e44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - separate price import logic (@Pfabeck) - bundle variation limit (@Pfabeck) - variant properties are now transferred as attribute (beta feature) (@Pfabeck) +- 3rd gender support (@Pfabeck) ### Changed - change media command handler to update media if exists (@lacodimizer) diff --git a/Connector/TransferObject/Order/Address/Address.php b/Connector/TransferObject/Order/Address/Address.php index 4a0e042e4..d9a42266a 100755 --- a/Connector/TransferObject/Order/Address/Address.php +++ b/Connector/TransferObject/Order/Address/Address.php @@ -11,6 +11,7 @@ class Address extends AbstractValueObject implements AttributableInterface { const GENDER_MALE = 'male'; const GENDER_FEMALE = 'female'; + const GENDER_DIVERSE = 'diverse'; /** * @var null|string diff --git a/Connector/TransferObject/Order/Customer/Customer.php b/Connector/TransferObject/Order/Customer/Customer.php index c46504b96..22e7eeb79 100644 --- a/Connector/TransferObject/Order/Customer/Customer.php +++ b/Connector/TransferObject/Order/Customer/Customer.php @@ -13,6 +13,7 @@ class Customer extends AbstractValueObject const GENDER_MALE = 'male'; const GENDER_FEMALE = 'female'; + const GENDER_DIVERSE = 'diverse'; /** * @var int