summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoren Van Onder <jov@odoo.com>2020-10-20 21:07:35 +0000
committerJoren Van Onder <jov@odoo.com>2020-10-27 22:05:11 +0000
commitfa576fc74e904ea428fd9cd24070ddbb64c553b4 (patch)
tree3f8ed05e5f96046f6e84c5222224b659c8bc10d7
parent831d306e1bee5c01bad1c9c7a0c7d5b58b7789ea (diff)
[FIX] payment_authorize: make it possible to pay after closing popup
Closing the Authorize.net popup with the little "x" doesn't call the responseHandler. Looking at the documentation (and source) of AcceptUI.js it seems there's no clean way to detect this. Because of this the "Pay & Confirm" button remains disabled, requiring the user to refresh the page. To solve this don't disable the button at all. Presumably it was added to avoid issues when spamming the button with clicks on a slow connection. But simulating this with a slow connection doesn't cause any issues. When AcceptJS is not yet loaded it's loaded with web.ajax.loadJS(). It correctly handles parallel calls before loading is finished and returns the same promise. AcceptJS correctly ignores subsequent click events on the button, because it immediately blocks all clicks on the body (and grays it out). Using a MutationObserver was also considered but this approach is much less messy. opw-2367166 closes odoo/odoo#60869 X-original-commit: 63f759b63284efc5fb9f5dc7dfbe4e2aed982ad0 Signed-off-by: jorenvo <jorenvo@users.noreply.github.com>
-rw-r--r--addons/payment_authorize/static/src/js/payment_form.js3
1 files changed, 0 insertions, 3 deletions
diff --git a/addons/payment_authorize/static/src/js/payment_form.js b/addons/payment_authorize/static/src/js/payment_form.js
index 06a74af31ed..54007ce4cc2 100644
--- a/addons/payment_authorize/static/src/js/payment_form.js
+++ b/addons/payment_authorize/static/src/js/payment_form.js
@@ -45,7 +45,6 @@ PaymentForm.include({
} else {
var button = ev.target;
}
- this.disableButton(button);
var acquirerID = this.getAcquirerIdFromRadio($checkedRadio);
var acquirerForm = this.$('#o_payment_add_token_acq_' + acquirerID);
var inputsForm = $('input', acquirerForm);
@@ -69,7 +68,6 @@ PaymentForm.include({
errorMessage += message.code + ": " + message.text;
})
acquirerForm.removeClass('d-none');
- self.enableButton(button);
return self.displayError(_t('Server Error'), errorMessage);
}
@@ -91,7 +89,6 @@ PaymentForm.include({
// if the rpc fails, pretty obvious
error.event.preventDefault();
acquirerForm.removeClass('d-none');
- self.enableButton(button);
self.displayError(
_t('Server Error'),
_t("We are not able to add your payment method at the moment.") +