Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix passing shipping address to Adyen (#14246) (#14250)

Marcin Gębalaf701877812ab
diff --git a/saleor/payment/gateways/adyen/tests/utils/test_common.py b/saleor/payment/gateways/adyen/tests/utils/test_common.py
index 416da7c52b..8ceb0985e8 100644
--- a/saleor/payment/gateways/adyen/tests/utils/test_common.py
+++ b/saleor/payment/gateways/adyen/tests/utils/test_common.py
@@ -707,13 +707,19 @@ def test_to_adyen_price(value, currency, expected_result):
assert result == expected_result
-def test_request_data_for_gateway_config(checkout_with_item, address):
+def test_request_data_for_gateway_config(
+ checkout_with_item, address, address_other_country
+):
# given
- checkout_with_item.billing_address = address
+ checkout_with_item.shipping_address = address
+ checkout_with_item.billing_address = address_other_country
+ assert address.country.code != address_other_country.country.code
+
merchant_account = "test_account"
manager = get_plugins_manager()
lines_info, _ = fetch_checkout_lines(checkout_with_item)
checkout_info = fetch_checkout_info(checkout_with_item, lines_info, manager)
+
# when
response_config = request_data_for_gateway_config(
checkout_info, lines_info, merchant_account
@@ -722,7 +728,7 @@ def test_request_data_for_gateway_config(checkout_with_item, address):
# then
assert response_config == {
"merchantAccount": merchant_account,
- "countryCode": checkout_with_item.billing_address.country,
+ "countryCode": checkout_with_item.shipping_address.country,
"channel": "web",
"amount": {"currency": "USD", "value": "3000"},
}
diff --git a/saleor/payment/gateways/adyen/utils/common.py b/saleor/payment/gateways/adyen/utils/common.py
index 0dfdd74817..6c2bf84550 100644
--- a/saleor/payment/gateways/adyen/utils/common.py
+++ b/saleor/payment/gateways/adyen/utils/common.py
@@ -342,7 +342,7 @@ def request_data_for_gateway_config(
) -> Dict[str, Any]:
manager = get_plugins_manager()
checkout = checkout_info.checkout
- address = checkout_info.billing_address or checkout_info.shipping_address
+ address = checkout_info.shipping_address or checkout_info.billing_address
lines = lines or []
total = checkout_total(
manager=manager,