Skip to content

Commit

Permalink
💣 Support scanning via scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Yelizariev committed Jul 12, 2018
1 parent e2c9b02 commit 26e8a69
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pos_wechat/static/src/js/wechat_pay.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ odoo.define('pos_payment_wechat', function(require){
});

},
scan_product: function(parsed_code){
// TODO: do we need to make this optional?
var value = parsed_code.code;
if (this.wechat.check_auth_code(value)){
this.wechat.process_qr(value);
return true;
}
return PosModelSuper.prototype.scan_product.apply(this, arguments);
},
on_micropay: function(msg){
var order = this.get('orders').find(function(item){
return item.uid === msg.order_ref;
Expand Down Expand Up @@ -117,7 +126,7 @@ odoo.define('pos_payment_wechat', function(require){
});
},
check_auth_code: function(code) {
return true; // for DEBUG
// TODO: do we need to integrate this with barcode.nomenclature?
if (code && Number.isInteger(+code) &&
code.length === 18 &&
+code[0] === 1 && (+code[1] >= 0 && +code[1] <= 5)) {
Expand Down

0 comments on commit 26e8a69

Please sign in to comment.