[FIX] payment_stripe: open>exit>open opened 1 time
If using Stripe we did "Pay Now" -> close modal -> "Pay Now" we would get 2 modals and possibly be blocked by infinite loading. With this changeset, we only execute one time our strip.js file so we do not declare multiple MutationObserver. We also only open one checkout at a time from stripe when closing and opening it or multiclicking click (the later one that could block the interface with several stripe iframe opened and one with a infinite loading wheel). opw-1939323 closes #31928 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -21,9 +21,13 @@ odoo.define('payment_stripe.stripe', function(require) {
|
||||
$.blockUI.defaults.css["background-color"] = '';
|
||||
$.blockUI.defaults.overlayCSS["opacity"] = '0.9';
|
||||
}
|
||||
var stripeHandler;
|
||||
function getStripeHandler()
|
||||
{
|
||||
var handler = StripeCheckout.configure({
|
||||
if (stripeHandler) {
|
||||
return stripeHandler;
|
||||
}
|
||||
stripeHandler = StripeCheckout.configure({
|
||||
key: $("input[name='stripe_key']").val(),
|
||||
image: $("input[name='stripe_image']").val(),
|
||||
locale: 'auto',
|
||||
@@ -61,7 +65,7 @@ odoo.define('payment_stripe.stripe', function(require) {
|
||||
});
|
||||
},
|
||||
});
|
||||
return handler;
|
||||
return stripeHandler;
|
||||
}
|
||||
|
||||
require('web.dom_ready');
|
||||
|
||||
@@ -21,7 +21,12 @@
|
||||
<input type='hidden' name='email' t-att-value='email'/>
|
||||
<input id="acquirer_stripe" type='hidden' name="acquirer" t-att-value="acquirer.id"/>
|
||||
<input type='hidden' name="stripe_key" t-att-value="acquirer.stripe_publishable_key"/>
|
||||
<script type="text/javascript" src="/payment_stripe/static/src/js/stripe.js"></script>
|
||||
<script type="text/javascript">
|
||||
odoo.define(function (require) {
|
||||
var ajax = require('web.ajax');
|
||||
ajax.loadJS("/payment_stripe/static/src/js/stripe.js");
|
||||
});
|
||||
</script>
|
||||
</template>
|
||||
|
||||
<template id="stripe_s2s_form">
|
||||
|
||||
Reference in New Issue
Block a user