[FIX] payment_adyen: empty field

- Activate Adyen
- In the eCommerce, purchase an item
- Change the delivery address
- Pay with Adyen

A internal error is raised.

It is caused by `val.replace(...)` where `val` is `False` ( due to
`shopperEmail`).

We make the code more robust by fallbacking on the billing email, then
on an empty string.

opw-2002974

[1] https://docs.adyen.com/classic-integration/hosted-payment-pages/hpp-payment-response/payment-response-merchantsig-sha-256/

closes odoo/odoo#33840

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-06-03 13:23:15 +00:00
parent b27077bb0c
commit 25155aa472
+1 -1
View File
@@ -128,7 +128,7 @@ class AcquirerAdyen(models.Model):
'sessionValidity': tmp_date.isoformat('T')[:19] + "Z",
'resURL': '%s' % urlparse.urljoin(base_url, AdyenController._return_url),
'merchantReturnData': json.dumps({'return_url': '%s' % values.pop('return_url')}) if values.get('return_url', '') else False,
'shopperEmail': values.get('partner_email', ''),
'shopperEmail': values.get('partner_email') or values.get('billing_partner_email') or '',
})
values['merchantSig'] = self._adyen_generate_merchant_sig_sha256('in', values)