nie
be2ce0522e
[FIX] payment_authorize: Show UserError to user
...
Steps:
- Install website_sale and payment_authorize
- Set up a tunnel (e.g. ngrok)
- Log in to Authorize.Net backend
- Go to Account > Response/Receipt URLs > Add Url
- Enter the tunnel URL
- In Odoo, go to Website > Configuration > eCommerce > Payment Acquirers
- Edit "Authorize.Net"
- Credentials tab:
- State: Test Mode
- API Login Id, Transaction and Signature key
- Save, then Generate Client Key
- Configuration tab:
- Payment Flow: Payment from Odoo
- Stop the server
- Replace https://github.com/odoo/odoo/blob/1b9b99dc2643910c1412b564affccf02ba1e55d9/addons/payment_authorize/models/authorize_request.py#L46 with `resp = {'messages': {'resultCode': 'Error', 'message': [{'code': 'E00027', 'text': 'An error occurred during processing. Call Merchant Service Provider.'}]}}`
- Restart the server
- Go to "Website" > "Go to Website" > Shop
- Add a product to the basket
- Check out the basket
- Choose "Credit Card (powered by Authorize) Test Mode"
- Pay Now
- Enter any card data (e.g. 4111 1111 1111 1111 - 01/22 - 900)
Bug:
When the Pay Now process is done, the customer is redirected to
`/shop?error=invalid_token_id`. No errors are shown.
Explanation:
The patch simulates an error from Authorize.Net happening during their
process. Using the special card numbers won't trigger the wanted
behavior.
When getting an error from Authorize.net, a `UserError` is raised. This
error is then caught in the controller to return a formatted message.
However, returning a dict in this part of the code embeds it inside
`{'result': [...]}`. The error message is, thus, not blocking the form's
redirection and the user gets redirected to the form action, i.e.
`/shop/payment/token`. This route requires `pm_id`, but, in this
scenario, it's an empty string. This leads to another redirection to
`/shop/?error=invalid_token_id` as seen here:
https://github.com/odoo/odoo/blob/1b9b99dc2643910c1412b564affccf02ba1e55d9/addons/website_sale/controllers/main.py#L938-L941
Letting the error bubble up forces the backend to return a blocking
error response. This makes the fronted display the Authorize.Net error
underneath the provider selection, and prevents it from redirecting.
opw:2419260
closes odoo/odoo#64482
X-original-commit: 2636b9f5059808b443be67b06fca129cf9d3a913
Signed-off-by: backspac <backspac@users.noreply.github.com >
2021-01-13 13:44:00 +00:00
..
2021-01-12 10:38:54 +00:00
2021-01-05 17:20:06 +00:00
2020-09-18 17:34:46 +00:00
2021-01-11 10:56:43 +00:00
2020-12-03 13:32:29 +00:00
2020-12-03 13:39:21 +00:00
2020-11-10 16:04:29 +00:00
2020-09-01 11:18:00 +00:00
2020-12-08 17:13:24 +00:00
2020-11-30 07:07:58 +00:00
2020-09-01 11:18:00 +00:00
2020-11-23 12:41:52 +00:00
2020-11-30 07:07:58 +00:00
2020-12-11 09:11:11 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-10-19 07:03:01 +00:00
2020-09-01 11:18:00 +00:00
2020-08-14 23:06:11 +00:00
2020-08-14 23:06:11 +00:00
2021-01-05 14:04:21 +00:00
2020-09-29 17:52:02 +00:00
2020-09-29 17:52:02 +00:00
2020-12-24 13:36:49 +00:00
2021-01-12 10:38:54 +00:00
2020-11-24 13:23:32 +00:00
2021-01-12 15:06:03 +00:00
2020-12-03 10:18:36 +00:00
2020-12-29 13:41:25 +00:00
2020-10-07 13:25:32 +00:00
2020-12-11 12:30:42 +00:00
2020-09-01 11:18:00 +00:00
2021-01-07 16:13:06 +00:00
2020-12-03 10:18:36 +00:00
2020-12-10 16:56:29 +00:00
2021-01-05 10:05:15 +00:00
2020-12-17 20:33:13 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 12:50:23 +00:00
2021-01-12 10:38:54 +00:00
2020-11-25 12:29:57 +00:00
2020-11-25 12:29:57 +00:00
2020-12-24 12:51:04 +00:00
2020-11-23 14:58:06 +00:00
2021-01-08 10:10:27 +00:00
2021-01-12 10:38:54 +00:00
2020-12-11 12:30:42 +00:00
2020-12-22 12:01:05 +00:00
2021-01-12 10:38:54 +00:00
2020-06-10 16:10:28 +00:00
2020-12-22 13:40:28 +00:00
2020-09-01 11:18:00 +00:00
2020-11-25 11:09:53 +00:00
2021-01-06 19:06:13 +00:00
2020-12-11 17:52:11 +00:00
2020-12-11 17:52:11 +00:00
2020-09-01 11:18:00 +00:00
2021-01-07 08:24:43 +00:00
2020-12-11 12:30:42 +00:00
2020-12-11 12:30:42 +00:00
2020-10-06 11:09:43 +00:00
2021-01-12 12:50:23 +00:00
2020-11-02 18:25:20 +00:00
2020-12-11 12:30:42 +00:00
2021-01-12 10:38:54 +00:00
2021-01-11 14:54:51 +00:00
2020-09-01 11:18:00 +00:00
2021-01-07 17:44:37 +00:00
2020-09-01 11:18:00 +00:00
2020-09-01 11:18:00 +00:00
2020-11-25 12:31:09 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 10:38:54 +00:00
2020-11-25 11:09:53 +00:00
2020-09-01 11:18:00 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-09-01 11:18:00 +00:00
2021-01-04 16:15:39 +00:00
2020-12-07 12:51:38 +00:00
2020-12-16 15:52:34 +00:00
2020-12-08 08:26:37 +00:00
2020-10-23 13:19:45 +00:00
2021-01-12 10:38:54 +00:00
2020-09-29 17:52:02 +00:00
2020-11-25 12:29:57 +00:00
2020-12-24 12:51:04 +00:00
2020-09-01 11:18:00 +00:00
2020-08-07 08:30:41 +00:00
2020-12-10 12:22:40 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-12-11 13:53:13 +00:00
2020-12-03 13:32:29 +00:00
2020-11-12 14:46:27 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-12-16 17:39:33 +00:00
2020-12-16 17:39:33 +00:00
2020-12-23 18:13:20 +00:00
2020-10-22 07:27:52 +00:00
2020-10-22 16:17:26 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-12-10 17:43:10 +00:00
2020-11-24 13:07:12 +00:00
2020-11-02 16:23:42 +00:00
2020-11-10 16:55:31 +00:00
2020-12-02 10:19:39 +00:00
2020-10-23 07:17:29 +00:00
2020-08-14 10:02:09 +00:00
2020-12-01 12:31:24 +00:00
2020-10-29 12:58:10 +00:00
2020-10-06 09:52:17 +00:00
2020-11-23 12:41:52 +00:00
2020-12-17 11:31:38 +00:00
2020-12-03 09:28:51 +00:00
2020-12-04 09:16:16 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-11-27 09:29:38 +00:00
2020-11-02 16:23:41 +00:00
2020-08-07 08:30:41 +00:00
2020-11-27 14:45:43 +00:00
2020-08-07 08:30:41 +00:00
2020-12-10 16:17:02 +00:00
2020-11-05 10:14:22 +00:00
2020-10-27 11:15:26 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2021-01-12 16:58:14 +00:00
2020-08-07 08:30:41 +00:00
2020-12-02 15:51:55 +00:00
2020-11-16 16:47:28 +00:00
2020-12-07 10:05:42 +00:00
2020-08-07 08:30:41 +00:00
2020-08-22 12:55:12 +00:00
2020-12-29 09:25:50 +00:00
2020-11-10 16:55:31 +00:00
2020-11-10 16:55:31 +00:00
2020-11-23 12:41:52 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-10-23 07:17:29 +00:00
2020-08-07 08:30:41 +00:00
2020-10-22 16:17:26 +00:00
2020-11-20 10:04:27 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-10 09:11:10 +00:00
2020-10-29 19:23:41 +00:00
2020-08-07 08:30:41 +00:00
2020-08-07 08:30:41 +00:00
2020-12-24 12:51:04 +00:00
2021-01-12 10:38:54 +00:00
2021-01-13 10:10:10 +00:00
2020-11-25 11:09:53 +00:00
2020-08-20 13:34:16 +00:00
2020-09-30 09:19:16 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 10:38:54 +00:00
2020-09-01 11:18:00 +00:00
2020-09-24 10:29:44 +00:00
2021-01-12 10:38:54 +00:00
2020-12-11 12:30:42 +00:00
2020-12-11 12:30:42 +00:00
2020-09-14 10:01:49 +00:00
2020-09-01 11:18:00 +00:00
2021-01-07 08:24:43 +00:00
2021-01-12 12:50:23 +00:00
2020-12-11 12:30:42 +00:00
2020-09-01 11:18:00 +00:00
2020-09-15 11:36:12 +00:00
2020-11-24 13:23:32 +00:00
2020-08-03 07:43:05 +00:00
2020-12-24 13:36:49 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-09-01 11:18:00 +00:00
2020-11-25 11:09:53 +00:00
2020-12-24 12:51:04 +00:00
2020-09-01 11:18:00 +00:00
2020-11-25 11:09:53 +00:00
2021-01-13 13:44:00 +00:00
2020-09-01 11:18:00 +00:00
2020-09-01 11:18:00 +00:00
2020-11-25 11:09:53 +00:00
2020-11-15 23:08:46 +00:00
2020-11-25 11:09:53 +00:00
2020-10-05 09:36:34 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-11-17 17:57:34 +00:00
2020-09-01 11:18:00 +00:00
2020-10-13 13:59:31 +00:00
2021-01-12 12:50:23 +00:00
2021-01-08 12:51:34 +00:00
2020-12-11 12:30:42 +00:00
2020-11-30 07:07:58 +00:00
2021-01-12 14:14:11 +00:00
2020-12-11 12:30:42 +00:00
2020-12-17 16:14:08 +00:00
2020-10-30 17:30:56 +00:00
2020-09-01 11:18:00 +00:00
2020-12-04 09:16:16 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-09-29 04:25:44 +00:00
2020-12-31 18:01:23 +00:00
2020-09-29 17:52:02 +00:00
2021-01-12 12:50:23 +00:00
2020-10-23 07:17:53 +00:00
2020-09-01 11:18:00 +00:00
2020-08-12 09:57:09 +00:00
2021-01-12 10:38:54 +00:00
2021-01-07 17:44:37 +00:00
2020-12-04 09:16:16 +00:00
2021-01-13 13:43:33 +00:00
2020-09-01 11:18:00 +00:00
2020-09-09 09:21:12 +00:00
2021-01-12 15:42:15 +00:00
2020-09-01 11:18:00 +00:00
2021-01-13 13:43:33 +00:00
2020-12-08 15:41:52 +00:00
2021-01-04 17:04:08 +00:00
2020-12-11 12:30:42 +00:00
2021-01-07 17:44:37 +00:00
2021-01-11 10:31:25 +00:00
2020-11-03 10:48:03 +00:00
2021-01-07 11:16:28 +00:00
2020-10-06 11:10:54 +00:00
2021-01-12 10:38:54 +00:00
2020-10-20 10:18:57 +00:00
2020-11-09 10:01:37 +00:00
2021-01-12 10:38:54 +00:00
2020-09-28 12:45:08 +00:00
2020-12-22 13:40:28 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-10-09 07:35:59 +00:00
2020-12-29 18:29:33 +00:00
2020-12-08 09:57:00 +00:00
2021-01-12 16:45:47 +00:00
2020-12-22 13:40:28 +00:00
2020-09-01 11:18:00 +00:00
2021-01-07 11:15:20 +00:00
2021-01-12 10:38:54 +00:00
2020-11-25 11:09:53 +00:00
2020-10-05 09:36:34 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 12:50:23 +00:00
2020-12-23 16:07:59 +00:00
2020-11-03 12:09:30 +00:00
2021-01-05 08:32:05 +00:00
2021-01-12 12:50:23 +00:00
2021-01-04 15:10:11 +00:00
2020-10-05 09:36:34 +00:00
2020-12-04 07:49:30 +00:00
2021-01-07 17:44:37 +00:00
2020-11-26 11:00:25 +00:00
2020-10-20 12:29:28 +00:00
2021-01-06 15:49:34 +00:00
2020-11-24 16:02:46 +00:00
2020-09-01 11:18:00 +00:00
2020-12-11 12:30:42 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 13:50:20 +00:00
2021-01-12 10:38:54 +00:00
2020-12-24 13:36:49 +00:00
2020-12-11 12:30:42 +00:00
2021-01-12 10:38:54 +00:00
2021-01-07 17:44:37 +00:00
2021-01-12 10:38:54 +00:00
2020-10-09 08:21:23 +00:00
2021-01-12 10:38:54 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2020-06-10 16:10:28 +00:00
2020-11-16 16:47:28 +00:00
2020-12-11 12:30:42 +00:00
2021-01-12 10:38:54 +00:00
2020-08-21 17:30:13 +00:00
2021-01-12 10:38:54 +00:00
2020-10-06 08:51:09 +00:00
2021-01-12 10:38:54 +00:00
2020-10-02 07:26:27 +00:00
2020-08-04 14:28:29 +00:00
2021-01-12 10:38:54 +00:00
2021-01-12 12:03:30 +00:00
2021-01-07 17:44:37 +00:00
2020-10-02 08:52:39 +00:00
2020-12-14 09:06:05 +00:00
2021-01-12 10:38:54 +00:00
2020-11-30 09:28:17 +00:00
2020-12-11 12:30:42 +00:00
2020-12-08 10:41:42 +00:00
2020-12-30 16:00:56 +00:00
2020-12-24 13:36:49 +00:00
2020-09-01 11:18:00 +00:00
2020-09-08 18:12:26 +00:00
2020-09-01 11:18:00 +00:00
2021-01-12 10:38:54 +00:00
2021-01-06 14:16:13 +00:00
2021-01-12 10:38:54 +00:00
2020-11-30 07:07:58 +00:00
2020-10-22 18:00:23 +00:00
2020-12-03 11:15:23 +00:00
2021-01-12 10:38:54 +00:00
2020-11-24 13:23:32 +00:00
2021-01-12 10:38:54 +00:00
2020-10-28 12:09:04 +00:00
2020-10-22 13:30:03 +00:00
2021-01-07 17:44:37 +00:00
2021-01-12 10:38:54 +00:00
2020-12-11 12:30:42 +00:00
2021-01-12 10:38:54 +00:00
2020-12-24 13:36:49 +00:00