diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2018-02-01 14:35:43 +0100 |
|---|---|---|
| committer | Nicolas Martinelli <nim-odoo@users.noreply.github.com> | 2018-02-02 09:17:30 +0100 |
| commit | ad9edfc2dd2a041932bc89df55c7c3e42507efbb (patch) | |
| tree | 63767a7a48f3e7b46943cc1337557bb6fec2ce26 /addons/payment_stripe/static/src | |
| parent | 4df087b24d651b6763fcc50544194cbd48b5008a (diff) | |
[FIX] payment_stripe: missing route
In case an invoice is required to be paid thanks to the route
'/my/invoices/', the user is redirected to '/shop/payment/transaction/'.
If website_sale is not installed, this causes a crash.
Complement of 2bd17285ea3bcde5c86d8cd925070b048ce39082
opw-813481
Diffstat (limited to 'addons/payment_stripe/static/src')
| -rw-r--r-- | addons/payment_stripe/static/src/js/stripe.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js index ee8f0ff4ca6..2c22dcfa0f4 100644 --- a/addons/payment_stripe/static/src/js/stripe.js +++ b/addons/payment_stripe/static/src/js/stripe.js @@ -97,7 +97,10 @@ odoo.define('payment_stripe.stripe', function(require) { if (so_id) { so_id = parseInt(so_id[1]); } - + var invoice_id = $("input[name='return_url']").val().match(/invoices\/([0-9]+)/) || undefined; + if (invoice_id) { + invoice_id = parseInt(invoice_id[1]); + } var currency = $("input[name='currency']").val(); var currency_id = $("input[name='currency_id']").val(); @@ -127,6 +130,13 @@ odoo.define('payment_stripe.stripe', function(require) { }).then(function (data) { try { provider_form.innerHTML = data; } catch (e) {}; }); + } else if (window.location.href.includes("/my/invoices/")) { + var create_tx = ajax.jsonRpc('/invoice/pay/' + invoice_id + '/form_tx/', 'call', { + access_token: access_token, + acquirer_id: acquirer_id + }).then(function (data) { + try { provider_form.innerHTML = data; } catch (e) {}; + }); } else { var create_tx = ajax.jsonRpc('/shop/payment/transaction/' + acquirer_id, 'call', { |
