Skip to content

Conversation

@sbidoul
Copy link
Member

@sbidoul sbidoul commented Oct 30, 2019

Better pywebdriver interface in the case the driver can obtain transaction statuses from the terminal.

Comment on lines 70 to 72
if ('transaction_id' in response){
line.transaction_id = response['transaction_id']
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

|| 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-io
Copy link

codecov-io commented Oct 30, 2019

Codecov Report

Merging #3 into 9.0-add_pos_payment_terminal-dro will increase coverage by 0.16%.
The diff coverage is 100%.

Impacted file tree graph

@@                         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
Impacted Files Coverage Δ
pos_payment_terminal/models/pos_config.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4af7c9f...724dcac. Read the comment docs.

Payment lines are updated with response details

Amount due is updated if 'success' == True in response
@rousseldenis rousseldenis force-pushed the 9.0-imp-pos_payment_terminal_enhanced-dro branch from 94fefb5 to 145be15 Compare November 6, 2019 13:30
@rousseldenis rousseldenis changed the base branch from 9.0 to 9.0-add_pos_payment_terminal-dro November 7, 2019 10:53
var screens = require('point_of_sale.screens');

screens.PaymentScreenWidget.include({
deactivate_next: function(){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deactivate_next: function(){
deactivate_validate_button: function(){

deactivate_next: function(){
this.$('.next').toggle(false);
},
activate_next: function(){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
activate_next: function(){
activate_validate_button: function(){

});
paymentwidget.order_changes();
},
update_payment_line: function(response){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
update_payment_line: function(response){
update_payment_line: function(driver_status){

if ('reference' in transaction){
line.terminal_transaction_reference = transaction['reference'];
}
if (line){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if line seems redundant

if ('transaction_id' in response){
line.terminal_transaction_id = response['transaction_id']
}
if ('success' in response){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test seems useless: line.terminal_success = response.success should be sufficient.

}
else if (line.terminal_transaction_success === true){
self.activate_next();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do this in render_payment_line to have all the rendering logic in one place

@rousseldenis rousseldenis force-pushed the 9.0-imp-pos_payment_terminal_enhanced-dro branch from 91a0862 to 631d54f Compare November 8, 2019 10:43
var payment_lines = self.get_paymentlines();
for (var id in payment_lines){
var payment_line = payment_lines[id]
if payment_line.in_transaction{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need in_transaction: it should be equivalent to (transaction_id is not null and transaction_success is null).

@rousseldenis rousseldenis force-pushed the 9.0-imp-pos_payment_terminal_enhanced-dro branch 12 times, most recently from 6ab341e to 9d84324 Compare November 8, 2019 14:01
@rousseldenis rousseldenis force-pushed the 9.0-imp-pos_payment_terminal_enhanced-dro branch 3 times, most recently from 8db0e32 to 0d6ccba Compare November 8, 2019 15:01
@rousseldenis rousseldenis force-pushed the 9.0-imp-pos_payment_terminal_enhanced-dro branch from 0d6ccba to b86459f Compare November 8, 2019 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants