Skip to content

Commit

Permalink
ENGCOM-4382: Save country when creating new quote addresses #390
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav authored Feb 26, 2019
2 parents 697978e + 100803c commit 8f098c4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
);
}
if (null === $customerAddressId) {
$addressInput['country_id'] = $addressInput['country_code'] ?? '';
$billingAddress = $this->addressModel->addData($addressInput);
} else {
$this->checkCustomerAccount->execute($context->getUserId(), $context->getUserType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function execute(ContextInterface $context, CartInterface $cart, array $s
);
}
if (null === $customerAddressId) {
$addressInput['country_id'] = $addressInput['country_code'] ?? '';
$shippingAddress = $this->addressModel->addData($addressInput);
} else {
$this->checkCustomerAccount->execute($context->getUserId(), $context->getUserType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public function testSetNewBillingAddressByGuest()
city
postcode
telephone
country {
code
label
}
}
}
}
Expand Down Expand Up @@ -140,6 +144,10 @@ public function testSetNewBillingAddressWithUseForShippingParameterByGuest()
city
postcode
telephone
country {
code
label
}
}
shipping_addresses {
firstname
Expand All @@ -149,6 +157,10 @@ public function testSetNewBillingAddressWithUseForShippingParameterByGuest()
city
postcode
telephone
country {
code
label
}
}
}
}
Expand Down Expand Up @@ -234,6 +246,10 @@ public function testSetNewBillingAddressByRegisteredCustomer()
city
postcode
telephone
country {
code
label
}
}
}
}
Expand Down Expand Up @@ -413,7 +429,8 @@ private function assertNewAddressFields(array $billingAddressResponse): void
['response_field' => 'street', 'expected_value' => [0 => 'test street 1', 1 => 'test street 2']],
['response_field' => 'city', 'expected_value' => 'test city'],
['response_field' => 'postcode', 'expected_value' => '887766'],
['response_field' => 'telephone', 'expected_value' => '88776655']
['response_field' => 'telephone', 'expected_value' => '88776655'],
['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']],
];

$this->assertResponseFields($billingAddressResponse, $assertionMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public function testSetNewShippingAddressByGuest()
city
postcode
telephone
country {
code
label
}
}
}
}
Expand Down Expand Up @@ -176,6 +180,10 @@ public function testSetNewShippingAddressByRegisteredCustomer()
city
postcode
telephone
country {
label
code
}
}
}
}
Expand Down Expand Up @@ -462,7 +470,8 @@ private function assertNewShippingAddressFields(array $shippingAddressResponse):
['response_field' => 'street', 'expected_value' => [0 => 'test street 1', 1 => 'test street 2']],
['response_field' => 'city', 'expected_value' => 'test city'],
['response_field' => 'postcode', 'expected_value' => '887766'],
['response_field' => 'telephone', 'expected_value' => '88776655']
['response_field' => 'telephone', 'expected_value' => '88776655'],
['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']],
];

$this->assertResponseFields($shippingAddressResponse, $assertionMap);
Expand Down

0 comments on commit 8f098c4

Please sign in to comment.