From 869a37f5f96d908e1fb925e81441e79be52453b1 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 17 Aug 2020 21:14:49 +0000 Subject: [PATCH] [FIX] payment_authorize: make it possible to customize AcceptJS params Without this you have to overwrite the entire function. closes odoo/odoo#57696 X-original-commit: c2e980c3798c3cf75e4f96b71c7bc81dbad6b78c Signed-off-by: jorenvo --- .../static/src/js/payment_form.js | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/addons/payment_authorize/static/src/js/payment_form.js b/addons/payment_authorize/static/src/js/payment_form.js index aab561066d7..06a74af31ed 100644 --- a/addons/payment_authorize/static/src/js/payment_form.js +++ b/addons/payment_authorize/static/src/js/payment_form.js @@ -13,6 +13,23 @@ PaymentForm.include({ // Private //-------------------------------------------------------------------------- + /** + * Returns the parameters for the AcceptUI button that AcceptJS will use. + * + * @private + * @param {Object} formData data obtained by getFormData + * @returns {Object} params for the AcceptJS button + */ + _acceptJsParams: function (formData) { + return { + 'class': 'AcceptUI d-none', + 'data-apiLoginID': formData.login_id, + 'data-clientKey': formData.client_key, + 'data-billingAddressOptions': '{"show": false, "required": false}', + 'data-responseHandler': 'responseHandler' + }; + }, + /** * called when clicking on pay now or add payment event to create token for credit card/debit card. * @@ -84,14 +101,7 @@ PaymentForm.include({ }; if (this.$button === undefined) { - var params = { - 'class': 'AcceptUI d-none', - 'data-apiLoginID': formData.login_id, - 'data-clientKey': formData.client_key, - 'data-billingAddressOptions': '{"show": false, "required": false}', - 'data-responseHandler': 'responseHandler' - }; - this.$button = $('