From 068a516f3930a83707375f72de54f063a5c87e21 Mon Sep 17 00:00:00 2001 From: Denis Roussel Date: Thu, 5 Sep 2019 16:35:34 +0200 Subject: [PATCH] [9.0][IMP] pos_payment_terminal: Allow to prepare transaction data --- .../static/src/js/pos_payment_terminal.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pos_payment_terminal/static/src/js/pos_payment_terminal.js b/pos_payment_terminal/static/src/js/pos_payment_terminal.js index 00f84b01..a0b24a39 100755 --- a/pos_payment_terminal/static/src/js/pos_payment_terminal.js +++ b/pos_payment_terminal/static/src/js/pos_payment_terminal.js @@ -53,6 +53,10 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { paymentwidget.order_changes(); }); }, + update_transaction_data: function(line, data){ + data.amount = line.get_amount(); + data.payment_mode = line.cashregister.journal.payment_mode; + }, payment_terminal_transaction_start: function(line_cid, currency_iso, currency_decimals){ var line; var order = this.pos.get_order(); @@ -62,13 +66,12 @@ odoo.define('pos_payment_terminal.pos_payment_terminal', function (require) { line = lines[i]; } } - - var data = {'amount' : line.get_amount(), - 'currency_iso' : currency_iso, - 'currency_decimals' : currency_decimals, - 'payment_mode' : line.cashregister.journal.payment_mode, - 'order_id': order.uid}; - //console.log(JSON.stringify(data)); + var data = { + 'currency_iso' : currency_iso, + 'currency_decimals' : currency_decimals, + 'order_id': order.uid + } + this.update_transaction_data(line, data) this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)}); }, });