diff options
| author | Joren Van Onder <jov@odoo.com> | 2020-08-17 21:14:49 +0000 |
|---|---|---|
| committer | Joren Van Onder <jov@odoo.com> | 2020-09-15 01:10:38 +0000 |
| commit | aad941f6c4c7b6db5b9cf3860b411dbfecc9ea52 (patch) | |
| tree | acc662f831dca29547c4488f3baf97c1ccdedaa3 /addons/payment_authorize/static/src | |
| parent | ec11cb0fa7bc7807481bf7346586e0bc023fd27a (diff) | |
[FIX] payment_authorize: make it possible to customize AcceptJS params
Without this you have to overwrite the entire function.
closes odoo/odoo#57695
X-original-commit: c2e980c3798c3cf75e4f96b71c7bc81dbad6b78c
Signed-off-by: jorenvo <jorenvo@users.noreply.github.com>
Diffstat (limited to 'addons/payment_authorize/static/src')
| -rw-r--r-- | addons/payment_authorize/static/src/js/payment_form.js | 26 |
1 files 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 @@ -14,6 +14,23 @@ PaymentForm.include({ //-------------------------------------------------------------------------- /** + * 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. * * @private @@ -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 = $('<button>', params); + this.$button = $('<button>', this._acceptJsParams(formData)); this.$button.appendTo('body'); } ajax.loadJS(AcceptJs).then(function () { |
