Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
feat(Common): add externalId to address object
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Schulze committed Oct 25, 2016
1 parent 2b5a4a7 commit 76dc332
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Model/Common/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -84,6 +86,7 @@ public function fieldDefinitions()
'email' => [self::TYPE => 'string'],
'additionalAddressInfo' => [self::TYPE => 'string'],
'fax' => [static::TYPE => 'string'],
'externalId' => [static::TYPE => 'string'],
];
}
}
1 change: 1 addition & 0 deletions tests/fixtures/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ address:
- email
- additionalAddressInfo
- fax
- externalId
discountedPrice:
domain: common
model: discountedPrice
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/Customer/CustomerUpdateRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 76dc332

Please # to comment.