[FIX] payment_adyen: not send False information
If customer did not have address,email and telephone fields, "False" would be send to Adyen resulting in these field containing False values, which in some cases was falsely triggering anti-fraud system. task-3159378 closes odoo/odoo#146990 X-original-commit: 0de6864e32cff260393fde391250cff0fa6d9653 Signed-off-by: anko-odoo <anko@odoo.com>
This commit is contained in:
@@ -97,9 +97,9 @@ class AdyenController(http.Controller):
|
||||
'recurringProcessingModel': 'CardOnFile', # Most susceptible to trigger a 3DS check
|
||||
'shopperIP': payment_utils.get_customer_ip_address(),
|
||||
'shopperInteraction': 'Ecommerce',
|
||||
'shopperEmail': tx_sudo.partner_email,
|
||||
'shopperEmail': tx_sudo.partner_email or "",
|
||||
'shopperName': adyen_utils.format_partner_name(tx_sudo.partner_name),
|
||||
'telephoneNumber': tx_sudo.partner_phone,
|
||||
'telephoneNumber': tx_sudo.partner_phone or "",
|
||||
'storePaymentMethod': tx_sudo.tokenize, # True by default on Adyen side
|
||||
'additionalData': {
|
||||
'authenticationData.threeDSRequestData.nativeThreeDS': True,
|
||||
|
||||
@@ -139,6 +139,13 @@ msgstr ""
|
||||
msgid "Payment processing failed"
|
||||
msgstr ""
|
||||
|
||||
#. module: payment_adyen
|
||||
#. odoo-python
|
||||
#: code:addons/payment_adyen/utils.py:0
|
||||
#, python-format
|
||||
msgid "Please complete your address details."
|
||||
msgstr ""
|
||||
|
||||
#. module: payment_adyen
|
||||
#. odoo-python
|
||||
#: code:addons/payment_adyen/models/payment_transaction.py:0
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
from odoo import _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
from odoo.addons.payment import utils as payment_utils
|
||||
|
||||
|
||||
@@ -47,12 +50,17 @@ def format_partner_address(partner):
|
||||
:rtype: dict
|
||||
"""
|
||||
street_data = partner._get_street_split()
|
||||
return {
|
||||
address = {
|
||||
'city': partner.city,
|
||||
'country': partner.country_id.code or 'ZZ', # 'ZZ' if the country is not known.
|
||||
'stateOrProvince': partner.state_id.code,
|
||||
'stateOrProvince': partner.state_id.code or '', # The state is not always required.
|
||||
'postalCode': partner.zip,
|
||||
# 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'),
|
||||
}
|
||||
for key, value in address.items():
|
||||
if key == 'stateOrProvince' and partner.country_id.code not in ['CA', 'US', 'GB']:
|
||||
continue
|
||||
if not value:
|
||||
raise ValidationError(_("Please complete your address details."))
|
||||
|
||||
Reference in New Issue
Block a user