From 6769a42e92dc90ba758e55b05a1fdd2500b768e6 Mon Sep 17 00:00:00 2001 From: Horacio Tellez Date: Mon, 27 Mar 2023 08:13:02 +0000 Subject: [PATCH] [FIX] payment_adyen: incorrect parsing of partner's address When passing the customer data to adyen to execute a payment an error occurred if the address did not follow a pattern that might be unkown to the customer. This fix allows for the user to be aware of what the issue is through the logs and inform the customer if necessary. opw - 3171407 closes odoo/odoo#116936 X-original-commit: 66716551f1f75d228876b49cda9fd92732756afc Signed-off-by: Antoine Vandevenne (anv) Signed-off-by: Horacio Tellez Perez (hote) --- addons/payment_adyen/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/payment_adyen/utils.py b/addons/payment_adyen/utils.py index eaea4faf5cd..4f269330fff 100644 --- a/addons/payment_adyen/utils.py +++ b/addons/payment_adyen/utils.py @@ -52,6 +52,7 @@ def format_partner_address(partner): 'country': partner.country_id.code or 'ZZ', # 'ZZ' if the country is not known. 'stateOrProvince': partner.state_id.code, 'postalCode': partner.zip, - 'street': street_data['street_name'], - 'houseNumberOrName': street_data['street_number'], + # Fill in the address fields if the format is supported, or fallback to the raw address. + 'street': street_data.get('street_name', partner.street), + 'houseNumberOrName': street_data.get('street_number'), }