Files
odoo_source/addons/payment_authorize
Joren Van Onder fc0754f569 [FIX] payment_authorize: support references longer than 20 characters
We can have payment.transaction references of >20 characters. This
happens automatically if you have long sale.{order,subscription}
sequences (especially through website_payment because it adds multiple
suffixes, e.g. SO2020/1234567 could turn into
SO2020/1234567-12-1-1-1). We POST the full reference via the
x_invoice_num variable. Unfortunately Authorize specifies a maximum
length of 20 for this field [1]. So when Authorize POSTs back to
/payment/authorize/return it only specifies the first 20 characters in
x_invoice_num. E.g. when POSTing

{
...
'x_invoice_num': 'SO2020/1234567-12-1-1-1',
...
}

we receive back in /payment/authorize/return:

{
...
'x_invoice_num': 'SO2020/1234567-12-1-',
...
}

This causes _authorize_form_get_tx_from_data() to not find the
transaction which results in a ValidationError.

To fix this also pass the reference in the x_description field. It has
a more generous 255 character limit [1]. Then search using both.

We can't get rid of x_invoice_num entirely because we cannot assume
the payment_authorize.authorize_form will be updated (even more so
because it's a noupdate="1" template). By still using it in
_authorize_form_get_tx_from_data() we ensure that everything keeps
working regardless of whether or not x_description is included in the
template.

[1] p39 in https://www.authorize.net/content/dam/anet-redesign/documents/AIM_guide.pdf

opw-2373433

closes odoo/odoo#61449

X-original-commit: 3a220d3ad2999a21d54924940574ba96a9c07154
Signed-off-by: jorenvo <jorenvo@users.noreply.github.com>
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-05 18:40:04 +00:00
..
…
…