Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Save country when creating new quote addresses #390

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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