Joren Van Onder
aa343d17f7
[FIX] payment_authorize: always send an amount with the correct decimals
...
We cannot assume reading the value of a monetary field has the
decimals specified by the currency in decimal_places.
Right after creating a record with a monetary field it may have a
different amount of decimals.
To reproduce this:
>>> tx = env['payment.transaction'].create({
'amount': 10.87,
'acquirer_id': env['payment.acquirer'].search([], limit=1).id,
'currency_id': env.ref('base.USD').id,
'reference': 'test'
})
>>> tx.id
130
>>> tx.amount
10.870000000000001
<Restart odoo>
>>> env['payment.transaction'].browse(130).amount
10.87
Authorize requires us to send a correctly rounded amount. The
following response is returned when sending 10.870000000000001:
{'messages': {'message': [{'code': 'E00027',
'text': 'The transaction was unsuccessful.'}],
'resultCode': 'Error'},
'transactionResponse': {'SupplementalDataQualificationIndicator': 0,
'accountNumber': '',
'accountType': '',
'authCode': '',
'avsResultCode': 'P',
'cavvResultCode': '',
'cvvResultCode': '',
'errors': [{'errorCode': '5',
'errorText': 'A valid amount is '
'required.'}],
'refTransID': '',
'responseCode': '3',
'testRequest': '0',
'transHash': '',
'transHashSha2': '',
'transId': '0'}}
To work around the issue always round when we read amount.
Lower level solutions were considered in #45248 but for now we'll
stick with this higher level and lower risk patch.
opw-2188889
closes odoo/odoo#45362
X-original-commit: 7485927f0eb152086efcaaf4a30260e503267c41
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com >
2020-02-14 08:44:12 +00:00
..
2020-02-13 16:35:09 +00:00
2020-01-22 11:23:16 +00:00
2020-01-16 15:51:15 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2020-01-16 18:04:26 +00:00
2020-02-13 16:52:56 +00:00
2019-12-16 15:10:24 +00:00
2020-01-20 08:46:04 +00:00
2019-12-16 12:49:55 +00:00
2020-01-31 14:37:56 +00:00
2020-01-22 14:09:46 +00:00
2020-02-04 12:42:35 +00:00
2019-10-07 09:11:11 +02:00
2020-02-11 14:01:13 +00:00
2019-12-10 10:00:18 +00:00
2020-01-23 17:10:03 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 16:06:09 +00:00
2020-02-04 17:54:18 +01:00
2019-12-10 10:00:18 +00:00
2019-12-10 10:00:18 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2020-02-05 10:39:39 +00:00
2020-01-13 13:45:47 +00:00
2020-02-04 10:33:19 +00:00
2020-02-11 14:01:13 +00:00
2019-12-10 10:00:18 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 15:29:40 +00:00
2020-02-13 08:00:22 +00:00
2020-02-13 08:00:22 +00:00
2020-01-30 14:43:11 +00:00
2019-12-20 09:09:12 +01:00
2019-10-07 09:11:11 +02:00
2020-02-13 11:45:39 +00:00
2020-02-11 14:01:13 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-01-10 16:06:40 +00:00
2019-12-16 15:10:24 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2020-02-11 13:07:06 +00:00
2020-02-13 11:45:39 +00:00
2020-02-10 17:38:28 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 12:42:35 +00:00
2020-02-13 11:45:39 +00:00
2020-02-12 09:32:17 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 12:34:30 +00:00
2019-12-10 10:00:18 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 15:10:24 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-19 17:24:31 +00:00
2019-12-09 10:38:59 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-01-08 13:26:03 +00:00
2020-01-08 13:26:03 +00:00
2020-01-08 13:26:03 +00:00
2020-02-13 11:45:39 +00:00
2020-01-28 10:28:33 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 12:42:35 +00:00
2019-10-22 18:19:39 +00:00
2020-01-31 18:34:02 +00:00
2019-12-10 10:00:18 +00:00
2020-01-31 18:34:02 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2019-10-07 09:11:11 +02:00
2019-12-09 10:33:36 +00:00
2020-01-22 11:23:16 +00:00
2020-02-05 13:59:43 +00:00
2020-01-22 11:23:16 +00:00
2019-11-29 20:47:29 +00:00
2020-02-10 15:11:49 +00:00
2019-11-22 14:58:35 +00:00
2020-01-30 14:43:11 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-02-04 12:42:35 +00:00
2020-02-05 13:59:43 +00:00
2020-02-06 09:29:32 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2019-12-04 08:37:19 +00:00
2019-12-04 08:37:19 +00:00
2019-11-28 13:39:09 +00:00
2020-01-22 11:23:16 +00:00
2019-12-18 08:46:59 +00:00
2020-01-22 11:23:16 +00:00
2020-02-07 16:06:04 +00:00
2020-01-22 11:23:16 +00:00
2020-01-30 14:43:11 +00:00
2020-01-22 11:23:16 +00:00
2020-02-05 13:59:43 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2019-12-04 08:52:37 +00:00
2020-01-22 11:23:16 +00:00
2019-10-23 15:56:04 +00:00
2020-01-06 08:26:28 +00:00
2019-10-18 07:20:30 +00:00
2019-09-27 11:39:39 +00:00
2019-09-27 11:39:39 +00:00
2020-01-28 09:56:51 +00:00
2019-09-27 11:39:39 +00:00
2019-11-25 14:35:01 +00:00
2020-01-13 11:19:17 +00:00
2020-01-20 17:00:11 +00:00
2019-12-10 10:00:18 +00:00
2020-02-06 10:02:56 +00:00
2019-10-23 15:56:04 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2019-12-10 10:00:18 +00:00
2020-01-30 14:43:11 +00:00
2020-02-06 17:05:30 +00:00
2020-01-22 11:23:16 +00:00
2019-12-02 12:08:18 +00:00
2019-12-23 14:11:59 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2020-01-22 11:23:16 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-09 10:33:36 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 14:48:31 +00:00
2020-01-08 09:11:50 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2020-02-13 16:02:29 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2019-10-23 07:43:01 +00:00
2020-02-11 13:07:06 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-05 10:48:38 +00:00
2020-02-13 11:45:39 +00:00
2019-12-10 10:00:18 +00:00
2019-10-07 09:11:11 +02:00
2020-02-14 08:44:12 +00:00
2019-12-10 10:00:18 +00:00
2020-02-04 12:42:35 +00:00
2020-01-14 10:41:09 +00:00
2019-10-07 09:11:11 +02:00
2019-10-31 12:33:56 +00:00
2019-12-10 10:00:18 +00:00
2020-01-31 16:28:08 +00:00
2019-09-30 15:11:18 +00:00
2019-12-10 10:00:18 +00:00
2019-11-22 19:41:28 +00:00
2020-02-13 11:45:39 +00:00
2020-02-11 14:01:13 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2019-12-16 12:49:55 +00:00
2019-12-10 10:00:18 +00:00
2019-10-07 09:11:11 +02:00
2019-10-07 09:11:11 +02:00
2019-10-11 08:23:24 +00:00
2020-01-21 09:00:07 +00:00
2019-12-10 10:00:18 +00:00
2020-02-13 11:45:39 +00:00
2020-02-05 10:17:03 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 11:45:39 +00:00
2019-12-10 06:35:05 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-01-31 15:35:54 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-05 16:19:47 +00:00
2020-02-03 10:29:58 +00:00
2020-01-09 12:17:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-05 07:00:53 +00:00
2020-02-13 11:45:39 +00:00
2020-01-28 14:16:21 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-10 10:00:18 +00:00
2020-02-13 15:29:40 +00:00
2019-12-09 11:29:18 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-01-27 11:42:05 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-01-28 14:51:36 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-10 16:13:29 +00:00
2020-02-13 11:45:39 +00:00
2020-01-30 15:23:23 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2019-12-09 10:33:36 +00:00
2019-12-16 12:49:55 +00:00
2020-02-13 17:13:03 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 17:54:18 +01:00
2020-02-13 11:45:39 +00:00
2020-02-08 18:55:15 +00:00
2020-02-11 14:01:13 +00:00
2020-01-27 09:06:19 +00:00
2020-01-14 11:59:53 +00:00
2020-02-05 16:44:37 +01:00
2020-01-21 06:56:15 +00:00
2020-01-17 16:04:17 +00:00
2019-10-30 12:35:23 +00:00
2020-02-13 11:45:39 +00:00
2019-11-21 15:27:10 +00:00
2020-02-13 11:45:39 +00:00
2020-02-04 12:42:35 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 13:15:02 +00:00
2020-02-13 18:02:48 +00:00
2019-10-07 09:11:11 +02:00
2020-02-11 11:38:27 +00:00
2019-11-22 09:19:35 +00:00
2020-02-13 18:02:48 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 15:29:40 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 15:29:40 +00:00
2020-02-05 11:12:01 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 16:53:15 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2019-10-18 14:59:02 +00:00
2020-02-13 11:45:39 +00:00
2020-02-11 15:30:00 +00:00
2020-02-11 15:30:10 +00:00
2020-01-21 16:40:06 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-17 10:30:57 +00:00
2019-12-10 10:00:18 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2020-01-15 14:20:04 +00:00
2020-02-13 11:45:39 +00:00
2019-12-16 12:49:55 +00:00
2019-11-05 16:18:10 +01:00
2020-02-13 11:45:39 +00:00
2019-12-17 11:03:22 +00:00
2020-01-27 14:26:00 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 11:45:39 +00:00
2020-02-13 15:29:40 +00:00
2020-01-24 13:02:02 +00:00