[9.0][IMP] pos_payment_terminal: better pywebdriver interface#3
[9.0][IMP] pos_payment_terminal: better pywebdriver interface#3sbidoul wants to merge 9 commits into
Conversation
| if ('transaction_id' in response){ | ||
| line.transaction_id = response['transaction_id'] | ||
| } |
There was a problem hiding this comment.
You can simplify by writing line.transaction_id = response.transaction_id, no need to test for the field presence.
| } | ||
| this.update_transaction_data(line, data) | ||
| this.message('payment_terminal_transaction_start', {'payment_info' : JSON.stringify(data)}); | ||
| self.update_transaction_data(line, data) |
There was a problem hiding this comment.
| self.update_transaction_data(line, data) | |
| self.update_transaction_data(line, data); |
| vals['transaction_id'] = this.transaction_id || false; | ||
| vals['success'] = this.success || false; | ||
| vals['status'] = this.status || false; | ||
| vals['reference'] = this.reference || false; |
There was a problem hiding this comment.
|| false sounds suspicious. Because for sucess, we want to distinguish (null/undefined, false, true).
I'd say you can simply do
vals.transaction_id = this.transaction_id
Codecov Report
@@ Coverage Diff @@
## 9.0-add_pos_payment_terminal-dro #3 +/- ##
====================================================================
+ Coverage 55.67% 55.83% +0.16%
====================================================================
Files 20 20
Lines 273 274 +1
====================================================================
+ Hits 152 153 +1
Misses 121 121
Continue to review full report at Codecov.
|
Payment lines are updated with response details Amount due is updated if 'success' == True in response
94fefb5 to
145be15
Compare
| var screens = require('point_of_sale.screens'); | ||
|
|
||
| screens.PaymentScreenWidget.include({ | ||
| deactivate_next: function(){ |
There was a problem hiding this comment.
| deactivate_next: function(){ | |
| deactivate_validate_button: function(){ |
| deactivate_next: function(){ | ||
| this.$('.next').toggle(false); | ||
| }, | ||
| activate_next: function(){ |
There was a problem hiding this comment.
| activate_next: function(){ | |
| activate_validate_button: function(){ |
| }); | ||
| paymentwidget.order_changes(); | ||
| }, | ||
| update_payment_line: function(response){ |
There was a problem hiding this comment.
| update_payment_line: function(response){ | |
| update_payment_line: function(driver_status){ |
| if ('reference' in transaction){ | ||
| line.terminal_transaction_reference = transaction['reference']; | ||
| } | ||
| if (line){ |
There was a problem hiding this comment.
this if line seems redundant
| if ('transaction_id' in response){ | ||
| line.terminal_transaction_id = response['transaction_id'] | ||
| } | ||
| if ('success' in response){ |
There was a problem hiding this comment.
this test seems useless: line.terminal_success = response.success should be sufficient.
| } | ||
| else if (line.terminal_transaction_success === true){ | ||
| self.activate_next(); | ||
| } |
There was a problem hiding this comment.
handle all this button state inside render_payment_line
| on_click_transaction_start: function(event){ | ||
| var line_cid = $(event.currentTarget).data('cid'); | ||
| var self = this; | ||
| self.hide_transaction_started(line_cid); |
There was a problem hiding this comment.
do this in render_payment_line to have all the rendering logic in one place
91a0862 to
631d54f
Compare
| var payment_lines = self.get_paymentlines(); | ||
| for (var id in payment_lines){ | ||
| var payment_line = payment_lines[id] | ||
| if payment_line.in_transaction{ |
There was a problem hiding this comment.
I don't think we need in_transaction: it should be equivalent to (transaction_id is not null and transaction_success is null).
6ab341e to
9d84324
Compare
8db0e32 to
0d6ccba
Compare
0d6ccba to
b86459f
Compare
Better pywebdriver interface in the case the driver can obtain transaction statuses from the terminal.