diff --git a/src/Model/Common/Address.php b/src/Model/Common/Address.php index 938547df16..52274f9ead 100644 --- a/src/Model/Common/Address.php +++ b/src/Model/Common/Address.php @@ -55,6 +55,8 @@ * @method Address setAdditionalAddressInfo(string $additionalAddressInfo = null) * @method string getFax() * @method Address setFax(string $fax = null) + * @method string getExternalId() + * @method Address setExternalId(string $externalId = null) */ class Address extends JsonObject { @@ -84,6 +86,7 @@ public function fieldDefinitions() 'email' => [self::TYPE => 'string'], 'additionalAddressInfo' => [self::TYPE => 'string'], 'fax' => [static::TYPE => 'string'], + 'externalId' => [static::TYPE => 'string'], ]; } } diff --git a/tests/fixtures/models.yaml b/tests/fixtures/models.yaml index 2074a60d79..c38628219d 100644 --- a/tests/fixtures/models.yaml +++ b/tests/fixtures/models.yaml @@ -211,6 +211,7 @@ address: - email - additionalAddressInfo - fax + - externalId discountedPrice: domain: common model: discountedPrice diff --git a/tests/integration/Customer/CustomerUpdateRequestTest.php b/tests/integration/Customer/CustomerUpdateRequestTest.php index a9bb18496e..096ba2ce54 100644 --- a/tests/integration/Customer/CustomerUpdateRequestTest.php +++ b/tests/integration/Customer/CustomerUpdateRequestTest.php @@ -212,6 +212,28 @@ public function testAddress() $this->assertCount(0, $customer->getAddresses()); } + public function testAddressExternalId() + { + $draft = $this->getDraft('external-address-id'); + $customer = $this->createCustomer($draft); + + $externalId = uniqid(); + $address = Address::of() + ->setCountry('DE') + ->setFirstName($this->getTestRun() . '-firstName') + ->setExternalId($externalId); + + $request = CustomerUpdateRequest::ofIdAndVersion($customer->getId(), $customer->getVersion()) + ->addAction(CustomerAddAddressAction::ofAddress($address)) + ; + $response = $request->executeWithClient($this->getClient()); + $customer = $request->mapResponse($response); + $this->deleteRequest->setVersion($customer->getVersion()); + + $this->assertCount(1, $customer->getAddresses()); + $this->assertSame($externalId, $customer->getAddresses()->current()->getExternalId()); + } + public function testDefaultShippingAddress() { $draft = $this->getDraft('title');