From e2b1e64e20a366fff62bc60f7fc23d348955c3c2 Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Tue, 12 Jan 2021 15:58:43 -0800 Subject: [PATCH] [FIX] pos_pax: chrome creats many requests Appears to be bad click handling, as the 'click' is processed, but I also wrapped the ternary operators in case browsers handle that differently (.. I've seen 5+ requests...) --- pos_pax/static/src/js/pos_pax.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pos_pax/static/src/js/pos_pax.js b/pos_pax/static/src/js/pos_pax.js index a49fbd24..87ed0f50 100644 --- a/pos_pax/static/src/js/pos_pax.js +++ b/pos_pax/static/src/js/pos_pax.js @@ -189,7 +189,7 @@ PaymentScreenWidget.include({ }); PAX.mDestinationIP = this.pos.config.pax_endpoint; - PAX[(tender_type == 'debit') ? 'DoDebit' : 'DoCredit'](transaction, function (response) { + PAX[((tender_type == 'debit') ? 'DoDebit' : 'DoCredit')](transaction, function (response) { console.log(response); var parsed_response = self.pos.decodePAXResponse(response); if (parsed_response.fail) { @@ -252,7 +252,7 @@ PaymentScreenWidget.include({ } PAX.mDestinationIP = this.pos.config.pax_endpoint; - PAX[(line.pax_tender_type == 'debit') ? 'DoDebit' : 'DoCredit'](transaction, function (response) { + PAX[((line.pax_tender_type == 'debit') ? 'DoDebit' : 'DoCredit')](transaction, function (response) { var parsed_response = self.pos.decodePAXResponse(response); if (parsed_response.fail) { def.resolve({message: parsed_response.fail}) @@ -330,10 +330,10 @@ PaymentScreenWidget.include({ render_paymentlines: function() { this._super(); var self = this; - self.$('.paymentlines-container').on('click', '.pax_send_transaction', function(){ + self.$('.paymentlines-container .pax_send_transaction').on('click', null, function(){ self.click_pax_send_transaction('credit'); }); - self.$('.paymentlines-container').on('click', '.pax_send_transaction_debit', function(){ + self.$('.paymentlines-container .pax_send_transaction_debit').on('click', null, function(){ self.click_pax_send_transaction('debit'); }); },