summaryrefslogtreecommitdiff
path: root/addons/payment_stripe/static
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:23 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commitdab34f0aebabae76ea7f73fb5e98c8babe646fcd (patch)
tree50ef6ee1c778dde16e4d9f5caa6b8988719e4c6d /addons/payment_stripe/static
parent9c90d21f2e0b1f674a89288105c42035a5b91348 (diff)
[REF] payment_stripe: adapt code after jQuery update
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
Diffstat (limited to 'addons/payment_stripe/static')
-rw-r--r--addons/payment_stripe/static/src/js/stripe.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js
index 262068fd12d..e0aeaeaacbd 100644
--- a/addons/payment_stripe/static/src/js/stripe.js
+++ b/addons/payment_stripe/static/src/js/stripe.js
@@ -47,17 +47,19 @@ odoo.define('payment_stripe.stripe', function(require) {
invoice_num: $("input[name='invoice_num']").val(),
tx_ref: $("input[name='invoice_num']").val(),
return_url: $("input[name='return_url']").val()
- }).always(function(){
+ }).then(function(data){
+ handler.isTokenGenerate = false;
+ window.location.href = data;
if ($.blockUI) {
$.unblockUI();
}
- }).done(function(data){
- handler.isTokenGenerate = false;
- window.location.href = data;
- }).fail(function(data){
+ }).guardedCatch(function(data){
var msg = data && data.data && data.data.message;
var wizard = $(qweb.render('stripe.error', {'msg': msg || _t('Payment error')}));
wizard.appendTo($('body')).modal({'keyboard': true});
+ if ($.blockUI) {
+ $.unblockUI();
+ }
});
},
});
@@ -66,7 +68,7 @@ odoo.define('payment_stripe.stripe', function(require) {
require('web.dom_ready');
if (!$('.o_payment_form').length) {
- return $.Deferred().reject("DOM doesn't contain '.o_payment_form'");
+ return Promise.reject("DOM doesn't contain '.o_payment_form'");
}
var observer = new MutationObserver(function(mutations, observer) {
@@ -109,7 +111,7 @@ odoo.define('payment_stripe.stripe', function(require) {
try { provider_form[0].innerHTML = data; } catch (e) {}
// Restore 'Pay Now' button HTML since data might have changed it.
$(provider_form[0]).find('#pay_stripe').replaceWith($pay_stripe);
- }).done(function () {
+ }).then(function () {
getStripeHandler().open({
name: merchant,
description: invoice_num,