diff --git a/pos_pax/__init__.py b/pos_pax/__init__.py deleted file mode 100644 index 09434554..00000000 --- a/pos_pax/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import models diff --git a/pos_pax/__manifest__.py b/pos_pax/__manifest__.py deleted file mode 100644 index f9970930..00000000 --- a/pos_pax/__manifest__.py +++ /dev/null @@ -1,55 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -{ - 'name': 'POS PAX Terminal Credit Card', - 'author': 'Hibou Corp. ', - 'version': '15.0.1.0.0', - 'category': 'Point of Sale', - 'sequence': 6, - 'summary': 'PAX Terminal Credit card support for Point Of Sale', - 'description': """ -Allow credit card POS payments -============================== - -This module allows customers to pay for their orders with credit cards. -The transactions are processed on the PAX Terminal (no credit credit card -information through Odoo itself). - -Depending on Device and processor support, this integration can handle: - -* Magnetic swiped cards -* EMV chip cards -* Contactless (including Apple Pay, Samsung Pay, Google Pay) - - """, - 'depends': [ - 'pos_sale', - 'hibou_professional', - ], - 'website': 'https://hibou.io', - 'data': [ - 'views/pos_config_setting_views.xml', - 'views/pos_pax_views.xml', - ], - 'demo': [ - ], - 'assets': { - 'web.assets_qweb': [ - 'pos_pax/static/src/xml/OrderReceipt.xml', - 'pos_pax/static/src/xml/PAXPaymentTransactionPopup.xml', - 'pos_pax/static/src/xml/PAXPaymentScreenPaymentLines.xml', - ], - 'point_of_sale.assets': [ - 'pos_pax/static/src/js/jquery_base64.js', - 'pos_pax/static/src/js/pax_device.js', - 'pos_pax/static/src/js/pos_pax.js', - 'pos_pax/static/src/js/PAXPaymentTransactionPopup.js', - 'pos_pax/static/src/js/PAXPaymentScreen.js', - 'pos_pax/static/src/js/PAXPaymentScreenPaymentLines.js', - 'pos_pax/static/src/css/pos_pax.css', - ], - }, - 'installable': True, - 'auto_install': False, - 'license': 'OPL-1', -} diff --git a/pos_pax/models/__init__.py b/pos_pax/models/__init__.py deleted file mode 100644 index c25936ee..00000000 --- a/pos_pax/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from . import pos_pax -from . import update diff --git a/pos_pax/models/pos_pax.py b/pos_pax/models/pos_pax.py deleted file mode 100644 index 2f84cc4e..00000000 --- a/pos_pax/models/pos_pax.py +++ /dev/null @@ -1,38 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from odoo import models, fields, api, _ - - -class PoSPayment(models.Model): - _inherit = 'pos.payment' - - pax_card_number = fields.Char(string='Card Number', help='Masked credit card.') - pax_txn_id = fields.Char(string='PAX Transaction ID') - - -class PoSPaymentMethod(models.Model): - _inherit = 'pos.payment.method' - - def _get_payment_terminal_selection(self): - return super(PoSPaymentMethod, self)._get_payment_terminal_selection() + [('pax', 'PAX')] - - -class PosConfig(models.Model): - _inherit = 'pos.config' - - pax_endpoint = fields.Char(string='PAX Endpoint', - help='Endpoint for PAX device (include protocol (http or https) and port). ' - 'e.g. http://192.168.1.101:10009') - - -class PosOrder(models.Model): - _inherit = "pos.order" - - @api.model - def _payment_fields(self, order, ui_paymentline): - fields = super(PosOrder, self)._payment_fields(order, ui_paymentline) - fields.update({ - 'pax_card_number': ui_paymentline.get('pax_card_number'), - 'pax_txn_id': ui_paymentline.get('pax_txn_id'), - }) - return fields diff --git a/pos_pax/models/update.py b/pos_pax/models/update.py deleted file mode 100644 index 6a08ab50..00000000 --- a/pos_pax/models/update.py +++ /dev/null @@ -1,20 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from odoo import models - - -class PublisherWarrantyContract(models.AbstractModel): - _inherit = 'publisher_warranty.contract' - - def _get_hibou_modules(self): - modules = super(PublisherWarrantyContract, self)._get_hibou_modules() - try: - self.env.cr.execute( - 'SELECT COUNT(*) FROM pos_config WHERE pax_endpoint != \'\' AND pax_endpoint IS NOT NULL') - pax_count = self.env.cr.fetchone()[0] or 0 - modules.update({ - 'pos_pax': pax_count, - }) - except: - pass - return modules diff --git a/pos_pax/static/src/css/pos_pax.css b/pos_pax/static/src/css/pos_pax.css deleted file mode 100644 index 1ea55044..00000000 --- a/pos_pax/static/src/css/pos_pax.css +++ /dev/null @@ -1,18 +0,0 @@ -.pos .paymentline.selected.o_pos_pax_txn_pending, .pos .paymentline.o_pos_pax_txn_pending { - background: rgb(239, 153, 65); -} -.pos .col-tendered.edit.o_pos_pax_txn_pending { - color: rgb(239, 153, 65); - box-shadow: 0px 0px 0px 3px rgb(239, 153, 65); -} - -.pos .paymentline .pax-send-transaction-button { - cursor: pointer !important; - border: 1px solid rgba(255, 255, 255, 0.5); - background-color: rgba(255,255,255, 0.2); - display: block; - text-align: center; - margin: 6px 5px 0 0; - padding: 2px 5px; - min-width: 50px; -} diff --git a/pos_pax/static/src/js/PAXPaymentScreen.js b/pos_pax/static/src/js/PAXPaymentScreen.js deleted file mode 100644 index c7a2c08e..00000000 --- a/pos_pax/static/src/js/PAXPaymentScreen.js +++ /dev/null @@ -1,189 +0,0 @@ -odoo.define('pos_pax.PAXPaymentScreen', function (require) { - 'use strict'; - - // Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - - const { _t } = require('web.core'); - const PaymentScreen = require('point_of_sale.PaymentScreen'); - const Registries = require('point_of_sale.Registries'); - const { useListener } = require('web.custom_hooks'); - const PAX = require('pos_pax.pax_device'); - - PAX.mDestinationIP = ''; - - const PAXPaymentScreen = (PaymentScreen) => - class extends PaymentScreen { - constructor() { - super(...arguments); - // tempting to use 'send-payment-request', - // but method implements things that don't seem to exist yet (payment_method.payment_terminal) - useListener('pax-send-payment-request', this._sendPAXPaymentRequest); - useListener('pax-send-payment-request-debit', this._sendPAXPaymentRequestDebit); - } - - async _sendPAXPaymentRequest({ detail: line }) { - this.pax_credit_transaction(line, 'credit'); - } - - async _sendPAXPaymentRequestDebit({ detail: line }) { - this.pax_credit_transaction(line, 'debit'); - } - - pax_credit_transaction(line, tender_type) { - var order = this.env.pos.get_order(); - - if(this.env.pos.getPAXOnlinePaymentJournals().length === 0) { - return; - } - - var self = this; - var transaction = {}; - - var purchase_amount = line.get_amount(); - - var transactionType = '01'; // SALE - if (purchase_amount < 0.0) { - purchase_amount = -purchase_amount; - transactionType = '02'; // RETURN - } - - transaction = { - command: (tender_type == 'debit') ? 'T02' : 'T00', - version: '1.28', - transactionType: transactionType, - amountInformation: { - TransactionAmount: (purchase_amount * 100) | 0, // cast to integer - }, - cashierInformation: { - ClerkID: this.env.pos.user.name, - }, - traceInformation: { - ReferenceNumber: self.env.pos.get_order().uid, - // InvoiceNumber: self.env.pos.get_order().uid, - }, - } - - var def = new $.Deferred(); - - // show the transaction popup. - // the transaction deferred is used to update transaction status - self.showPopup('PAXPaymentTransactionPopup', { - transaction: def - }); - def.notify({ - message: _t('Handling transaction...'), - }); - - PAX.mDestinationIP = self.env.pos.config.pax_endpoint; - PAX[(tender_type == 'debit') ? 'DoDebit' : 'DoCredit'](transaction, function (response) { - console.log(response); - var parsed_response = self.env.pos.decodePAXResponse(response); - if (parsed_response.fail) { - def.resolve({message: parsed_response.fail}) - return; - } - if (parsed_response.success) { - line.paid = true; - line.pax_card_number = parsed_response.card_num; - line.pax_txn_id = parsed_response.txn_id; - line.pax_approval = parsed_response.approval; - line.pax_txn_pending = false; - line.pax_tender_type = tender_type; - line.set_credit_card_name(); - order.trigger('change', order); - self.render(); - def.resolve({message: 'Approval ' + parsed_response.approval, auto_close: true}) - } - def.resolve({message: _t('Unknown response.')}) - }, function (fail){ - def.resolve({message: _t('Communication Failure: ') + fail}); - }); - } - - pax_do_reversal(line) { - var def = new $.Deferred(); - var self = this; - var transaction = {}; - - // show the transaction popup. - // the transaction deferred is used to update transaction status - this.showPopup('PAXPaymentTransactionPopup', { - transaction: def - }); - def.notify({ - message: 'Sending reversal...', - }); - - transaction = { - command: (line.pax_tender_type == 'debit') ? 'T02' : 'T00', - version: '1.28', - transactionType: (line.get_amount() > 0) ? '17' : '18', // V/SALE, V/RETURN - cashierInformation: { - ClerkID: this.env.pos.user.name, - }, - traceInformation: { - ReferenceNumber: this.env.pos.get_order().uid, - InvoiceNumber: '', - AuthCode: line.pax_approval, - TransactionNumber: line.pax_txn_id, - }, - } - - PAX.mDestinationIP = self.env.pos.config.pax_endpoint; - PAX[(line.pax_tender_type == 'debit') ? 'DoDebit' : 'DoCredit'](transaction, function (response) { - var parsed_response = self.env.pos.decodePAXResponse(response); - if (parsed_response.fail) { - def.resolve({message: parsed_response.fail}) - return; - } - if (parsed_response.success) { - def.resolve({ - message: _t('Reversal succeeded.'), - auto_close: true, - }); - self.remove_paymentline_by_ref(line); - return; - } - def.resolve({message: _t('Unknown response.')}) - }, function (fail){ - def.resolve({message: _t('Communication Failure: ') + fail}); - }); - } - - remove_paymentline_by_ref(line) { - this.env.pos.get_order().remove_paymentline(line); - this.render(); - } - - /** - * @override - */ - deletePaymentLine(event) { - const { cid } = event.detail; - const line = this.paymentLines.find((line) => line.cid === cid); - if (line.pax_txn_id) { - this.pax_do_reversal(line); - } else { - super.deletePaymentLine(event); - } - } - - /** - * @override - */ - addNewPaymentLine({ detail: paymentMethod }) { - const order = this.env.pos.get_order(); - const res = super.addNewPaymentLine(...arguments); - if (res && paymentMethod.use_payment_terminal == 'pax') { - order.selected_paymentline.pax_txn_pending = true; - order.trigger('change', order); - this.render(); - } - } - - }; - - Registries.Component.extend(PaymentScreen, PAXPaymentScreen); - - return PAXPaymentScreen; -}); diff --git a/pos_pax/static/src/js/PAXPaymentScreenPaymentLines.js b/pos_pax/static/src/js/PAXPaymentScreenPaymentLines.js deleted file mode 100644 index 0cd8c7f5..00000000 --- a/pos_pax/static/src/js/PAXPaymentScreenPaymentLines.js +++ /dev/null @@ -1,32 +0,0 @@ -odoo.define('pos_pax.PAXPaymentScreenPaymentLines', function (require) { - 'use strict'; - - // Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - - const PaymentScreenPaymentLines = require('point_of_sale.PaymentScreenPaymentLines'); - const Registries = require('point_of_sale.Registries'); - - const PAXPaymentLines = (PaymentScreenPaymentLines) => - class extends PaymentScreenPaymentLines { - /** - * @override - */ - selectedLineClass(line) { - return Object.assign({}, super.selectedLineClass(line), { - o_pos_pax_txn_pending: line.pax_txn_pending, - }); - } - /** - * @override - */ - unselectedLineClass(line) { - return Object.assign({}, super.unselectedLineClass(line), { - o_pos_pax_txn_pending: line.pax_txn_pending, - }); - } - }; - - Registries.Component.extend(PaymentScreenPaymentLines, PAXPaymentLines); - - return PAXPaymentLines; -}); diff --git a/pos_pax/static/src/js/PAXPaymentTransactionPopup.js b/pos_pax/static/src/js/PAXPaymentTransactionPopup.js deleted file mode 100644 index 8f417995..00000000 --- a/pos_pax/static/src/js/PAXPaymentTransactionPopup.js +++ /dev/null @@ -1,39 +0,0 @@ -odoo.define('pos_pax.PAXPaymentTransactionPopup', function(require) { - 'use strict'; - - // Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - - const { useState } = owl.hooks; - const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); - const Registries = require('point_of_sale.Registries'); - - class PAXPaymentTransactionPopup extends AbstractAwaitablePopup { - constructor() { - super(...arguments); - this.state = useState({ message: '', confirmButtonIsShown: false }); - this.props.transaction.then(data => { - if (data.auto_close) { - setTimeout(() => { - this.confirm(); - }, 2000) - } else { - this.state.confirmButtonIsShown = true; - } - this.state.message = data.message; - }).progress(data => { - this.state.message = data.message; - }) - } - } - PAXPaymentTransactionPopup.template = 'PAXPaymentTransactionPopup'; - PAXPaymentTransactionPopup.defaultProps = { - confirmText: 'Ok', - cancelText: 'Cancel', - title: 'PAX Online Payment', - body: '', - }; - - Registries.Component.add(PAXPaymentTransactionPopup); - - return PAXPaymentTransactionPopup; -}); diff --git a/pos_pax/static/src/js/jquery_base64.js b/pos_pax/static/src/js/jquery_base64.js deleted file mode 100644 index 56ab330b..00000000 --- a/pos_pax/static/src/js/jquery_base64.js +++ /dev/null @@ -1,133 +0,0 @@ -odoo.define('pos_pax.jquery_base64', function (require) { - "use strict"; - - // Hibou Corp. © 2020 - Wrapped library for PAX Device - - var jQuery = window.jQuery; - - /*! - * jquery.base64.js 0.1 - https://github.com/yckart/jquery.base64.js - * Makes Base64 en & -decoding simpler as it is. - * - * Based upon: https://gist.github.com/Yaffle/1284012 - * - * Copyright (c) 2012 Yannick Albert (http://yckart.com) - * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php). - * 2013/02/10 - **/ - ;(function ($) { - - var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - a256 = '', - r64 = [256], - r256 = [256], - i = 0; - - var UTF8 = { - - /** - * Encode multi-byte Unicode string into utf-8 multiple single-byte characters - * (BMP / basic multilingual plane only) - * - * Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars - * - * @param {String} strUni Unicode string to be encoded as UTF-8 - * @returns {String} encoded string - */ - encode: function (strUni) { - // use regular expressions & String.replace callback function for better efficiency - // than procedural approaches - var strUtf = strUni.replace(/[\u0080-\u07ff]/g, // U+0080 - U+07FF => 2 bytes 110yyyyy, 10zzzzzz - function (c) { - var cc = c.charCodeAt(0); - return String.fromCharCode(0xc0 | cc >> 6, 0x80 | cc & 0x3f); - }) - .replace(/[\u0800-\uffff]/g, // U+0800 - U+FFFF => 3 bytes 1110xxxx, 10yyyyyy, 10zzzzzz - function (c) { - var cc = c.charCodeAt(0); - return String.fromCharCode(0xe0 | cc >> 12, 0x80 | cc >> 6 & 0x3F, 0x80 | cc & 0x3f); - }); - return strUtf; - }, - - /** - * Decode utf-8 encoded string back into multi-byte Unicode characters - * - * @param {String} strUtf UTF-8 string to be decoded back to Unicode - * @returns {String} decoded string - */ - decode: function (strUtf) { - // note: decode 3-byte chars first as decoded 2-byte strings could appear to be 3-byte char! - var strUni = strUtf.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars - function (c) { // (note parentheses for precence) - var cc = ((c.charCodeAt(0) & 0x0f) << 12) | ((c.charCodeAt(1) & 0x3f) << 6) | (c.charCodeAt(2) & 0x3f); - return String.fromCharCode(cc); - }) - .replace(/[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars - function (c) { // (note parentheses for precence) - var cc = (c.charCodeAt(0) & 0x1f) << 6 | c.charCodeAt(1) & 0x3f; - return String.fromCharCode(cc); - }); - return strUni; - } - }; - - while (i < 256) { - var c = String.fromCharCode(i); - a256 += c; - r256[i] = i; - r64[i] = b64.indexOf(c); - ++i; - } - - function code(s, discard, alpha, beta, w1, w2) { - s = String(s); - var buffer = 0, - i = 0, - length = s.length, - result = '', - bitsInBuffer = 0; - - while (i < length) { - var c = s.charCodeAt(i); - c = c < 256 ? alpha[c] : -1; - - buffer = (buffer << w1) + c; - bitsInBuffer += w1; - - while (bitsInBuffer >= w2) { - bitsInBuffer -= w2; - var tmp = buffer >> bitsInBuffer; - result += beta.charAt(tmp); - buffer ^= tmp << bitsInBuffer; - } - ++i; - } - if (!discard && bitsInBuffer > 0) result += beta.charAt(buffer << (w2 - bitsInBuffer)); - return result; - } - - var Plugin = $.base64 = function (dir, input, encode) { - return input ? Plugin[dir](input, encode) : dir ? null : this; - }; - - Plugin.btoa = Plugin.encode = function (plain, utf8encode) { - plain = Plugin.raw === false || Plugin.utf8encode || utf8encode ? UTF8.encode(plain) : plain; - plain = code(plain, false, r256, b64, 8, 6); - return plain + '===='.slice((plain.length % 4) || 4); - }; - - Plugin.atob = Plugin.decode = function (coded, utf8decode) { - coded = String(coded).split('='); - var i = coded.length; - do { - --i; - coded[i] = code(coded[i], true, r64, a256, 6, 8); - } while (i > 0); - coded = coded.join(''); - return Plugin.raw === false || Plugin.utf8decode || utf8decode ? UTF8.decode(coded) : coded; - }; - }(jQuery)); - - return jQuery; -}); diff --git a/pos_pax/static/src/js/pax_device.js b/pos_pax/static/src/js/pax_device.js deleted file mode 100644 index 55bf0b03..00000000 --- a/pos_pax/static/src/js/pax_device.js +++ /dev/null @@ -1,582 +0,0 @@ -odoo.define('pos_pax.pax_device', function (require) { - "use strict"; - - var $ = require('pos_pax.jquery_base64'); - - // Hibou Corp. © 2020 - Wrapped library for PAX Device - // Additions and Fixes: - // 2020-11-12 Fixed variable i and ii in getLRC - // 2020-11-12 Fixed/added 'fail' mechanisms for XHR - // 2020-11-23 Added new DoDebit method - - //HEX TO BASE64 - function hexToBase64(str) { - return $.base64.btoa(String.fromCharCode.apply(null, - str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" ")) - ); - } - - //BASE64 TO HEX - function base64ToHex(str) { - for (var i = 0, bin = $.base64.atob(str), hex = []; i < bin.length; ++i) { - var tmp = bin.charCodeAt(i).toString(16); - if (tmp.length === 1) tmp = "0" + tmp; - hex[hex.length] = tmp; - } - return hex.join(" "); - } - - function StringToHex(response){ - var responseHex = ""; - for(var i=0; i0)?String.fromCharCode(lrc):0; - }, - - - - //Connect to the server - HttpCommunication : function(commandType,url,callback,timeout,fail){ - var xhr = null; - if(window.XMLHttpRequest) { - xhr = new XMLHttpRequest(); - } else { - try{ - xhr = new ActiveXObject('Microsoft.XMLHttp'); - }catch(e){ - xhr = new ActiveXObject('msxml2.xmlhttp'); - } - } - //get - - xhr.open("GET", url,true); - xhr.onreadystatechange=function(){ - if(xhr.readyState==4) { - //alert(xhr.status); - if(xhr.status==200) { - var response = xhr.responseText; - console.log("Raw response: "+response); - - var checkParams = StringToHex(response).split(" ").pop(); - var RedundancyCheck = StringToHex(response).split(" ").pop().substring(1); - - var check = PAX.getLRC(checkParams); - - if(check == RedundancyCheck){ - //get package detail info - var packetInfo = []; - var len = StringToHex(response).indexOf("03"); - var hex = StringToHex(response).slice(0,len).split(/02|1c/); - - console.log(hex); - if(commandType == "DoCredit" || commandType == "DoDebit"){ - var subHex=[], subPacketInfo=[]; - for(var i=0; i0){ - subHex = hex[i].split("1f"); - console.log(subHex); - subPacketInfo = []; - for(var j=0; j"+customData+""); - // } - - - var url = this.mDestinationIP + '?' + final_b64; - console.log("URL: " + url); - - this.HttpCommunication('DoCredit',url,function(response){ - callback(response); - },PAX.timeout.DoCredit,fail); - }, - //DoDebit - DoDebit : function(doDebitInfo,callback,fail){ - var amountInformation,accountInformation,traceInformation,avsInformation,cashierInformation,commercialInformation,motoEcommerce,additionalInformation; - var params = [this.mStx.hex,doDebitInfo.command, this.mFS.hex, doDebitInfo.version]; - params.push(this.mFS.hex); - // if(doDebitInfo.transactionType != ''){ - params.push(doDebitInfo.transactionType); - // } - params.push(this.mFS.hex); - params = this.PushParams(params,"amountInformation",doDebitInfo.amountInformation); - - params.push(this.mFS.hex); - params = this.PushParams(params,"accountInformation",doDebitInfo.accountInformation); - - params.push(this.mFS.hex); - params = this.PushParams(params,"traceInformation",doDebitInfo.traceInformation); - - // params.push(this.mFS.hex); - // params = this.PushParams(params,"avsInformation",doCreditInfo.avsInformation); - - params.push(this.mFS.hex); - params = this.PushParams(params,"cashierInformation",doDebitInfo.cashierInformation); - - // params.push(this.mFS.hex); - // params = this.PushParams(params,"commercialInformation",doCreditInfo.commercialInformation); - // - // params.push(this.mFS.hex); - // params = this.PushParams(params,"motoEcommerce",doCreditInfo.motoEcommerce); - - params.push(this.mFS.hex); - params = this.PushParams(params,"additionalInformation",doDebitInfo.additionalInformation); - - params.push(this.mEtx.hex); - - var lrc = this.getLRC(params); - - console.log(params); - - //prepare for base64 encoding. - var command_hex = base64ToHex($.base64.btoa(doDebitInfo.command)); - var version_hex = base64ToHex($.base64.btoa(doDebitInfo.version)); - var transactionType_hex = base64ToHex($.base64.btoa(doDebitInfo.transactionType)); - var amountInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.amountInformation)); - var accountInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.accountInformation)); - var traceInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.traceInformation)); - var avsInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.avsInformation)); - var cashierInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.cashierInformation)); - var commercialInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.commercialInformation)); - var motoEcommerce_hex = base64ToHex($.base64.btoa(doDebitInfo.motoEcommerce)); - var additionalInformation_hex = base64ToHex($.base64.btoa(doDebitInfo.additionalInformation)); - - //var elements = [this.mStx.code, command_hex, this.mFS.code, version_hex, this.mFS.code, uploadFlag_hex, this.mFS.code, timeout, this.mEtx.code, base64ToHex($.base64.btoa(lrc))]; - var elements = [this.mStx.code]; - elements.push(command_hex); - elements.push(this.mFS.code); - elements.push(version_hex); - elements.push(this.mFS.code); - - if(transactionType_hex != ''){ - elements.push(transactionType_hex); - } - elements.push(this.mFS.code); - - elements = this.AddBase64(elements,"amountInformation",doDebitInfo.amountInformation); - elements.push(this.mFS.code); - elements = this.AddBase64(elements,"accountInformation",doDebitInfo.accountInformation); - elements.push(this.mFS.code); - elements = this.AddBase64(elements,"traceInformation",doDebitInfo.traceInformation); - // elements.push(this.mFS.code); - // elements = this.AddBase64(elements,"avsInformation",doCreditInfo.avsInformation); - elements.push(this.mFS.code); - elements = this.AddBase64(elements,"cashierInformation",doDebitInfo.cashierInformation); - // elements.push(this.mFS.code); - // elements = this.AddBase64(elements,"commercialInformation",doCreditInfo.commercialInformation); - // elements.push(this.mFS.code); - // elements = this.AddBase64(elements,"motoEcommerce",doCreditInfo.motoEcommerce); - elements.push(this.mFS.code); - elements = this.AddBase64(elements,"additionalInformation",doDebitInfo.additionalInformation); - - elements.push(this.mEtx.code); - elements.push(base64ToHex($.base64.btoa(lrc))); - console.log("elements"); - console.log(elements); - - var final_string = elements.join(" "); - var final_b64 = hexToBase64(final_string); - console.log("LRC: " + lrc); - console.log("Base64: " + final_b64); - - // if(customData != ''){ - // final_b64 = hexToBase64(final_string+"&custom_data="+customData+""); - // } - - - var url = this.mDestinationIP + '?' + final_b64; - console.log("URL: " + url); - - this.HttpCommunication('DoDebit',url,function(response){ - callback(response); - },PAX.timeout.DoDebit,fail); - }, - }; - - return PAX; - -}); \ No newline at end of file diff --git a/pos_pax/static/src/js/pos_pax.js b/pos_pax/static/src/js/pos_pax.js deleted file mode 100644 index b56f2b62..00000000 --- a/pos_pax/static/src/js/pos_pax.js +++ /dev/null @@ -1,86 +0,0 @@ -odoo.define('pos_pax.pos_pax', function (require) { -"use strict"; - -// Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -const pos_model = require('point_of_sale.models'); - -pos_model.PosModel = pos_model.PosModel.extend({ - getPAXOnlinePaymentJournals: function () { - var online_payment_methods = []; - - $.each(this.payment_methods, function (i, payment_method) { - if (payment_method.use_payment_terminal == 'pax') { - online_payment_methods.push({label: payment_method.name, item: payment_method.id}); - } - }); - return online_payment_methods; - }, - decodePAXResponse: function (data) { - var status = data[5]; - if (status == 'ABORTED') { - return {fail: 'Transaction Aborted'}; - } else if (status == 'DECLINE') { - return {fail: 'Transaction Declined or not Allowed'}; - } else if (status == 'COMM ERROR') { - return {fail: 'Communication Error (e.g. could be your CC processor or internet)'} - } else if (status == 'DEBIT ONLY, TRY ANOTHER TENDER') { - return {fail: 'Card does not support Debit. Use Credit or switch cards.'} - } else if (status == 'RECEIVE ERROR') { - return {fail: 'Error receiving response. Try again?'} - } else if (status == 'OK') { - return { - success: true, - approval: data[6][2], - txn_id: data[10][0], - card_num: '***' + data[9][0], - } - } - var response = 'Not handled response: ' + status; - if (this.debug) { - response += ' --------- Debug Data: ' + data; - } - return {fail: response}; - }, -}); - -var _paylineproto = pos_model.Paymentline.prototype; -pos_model.Paymentline = pos_model.Paymentline.extend({ - init_from_JSON: function (json) { - _paylineproto.init_from_JSON.apply(this, arguments); - - this.paid = json.paid; - this.pax_txn_pending = json.pax_txn_pending; - this.pax_card_number = json.pax_card_number; - this.pax_approval = json.pax_approval; - this.pax_txn_id = json.pax_txn_id; - this.pax_tender_type = json.pax_tender_type; - - this.set_credit_card_name(); - }, - export_as_JSON: function () { - return _.extend(_paylineproto.export_as_JSON.apply(this, arguments), { - paid: this.paid, - pax_txn_pending: this.pax_txn_pending, - pax_card_number: this.pax_card_number, - pax_approval: this.pax_approval, - pax_txn_id: this.pax_txn_id, - pax_tender_type: this.pax_tender_type, - }); - }, - set_credit_card_name: function () { - if (this.pax_card_number) { - this.name = this.pax_card_number + ((this.pax_tender_type == 'debit') ? ' (Debit)' : ' (Credit)'); - } - }, -}); - -var _order_super = pos_model.Order.prototype; -pos_model.Order = pos_model.Order.extend({ - electronic_payment_in_progress: function() { - var res = _order_super.electronic_payment_in_progress.apply(this, arguments); - return res || this.get_paymentlines().some(line => line.pax_txn_pending); - }, -}); - -}); diff --git a/pos_pax/static/src/xml/OrderReceipt.xml b/pos_pax/static/src/xml/OrderReceipt.xml deleted file mode 100644 index b91928d2..00000000 --- a/pos_pax/static/src/xml/OrderReceipt.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - -
- APPROVAL CODE: - - - -
-
-
-
- -
diff --git a/pos_pax/static/src/xml/PAXPaymentScreenPaymentLines.xml b/pos_pax/static/src/xml/PAXPaymentScreenPaymentLines.xml deleted file mode 100644 index b0704f78..00000000 --- a/pos_pax/static/src/xml/PAXPaymentScreenPaymentLines.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - WAITING FOR TXN -
-
- Credit -
-
- Debit -
-
-
- - - - -
-
- -
diff --git a/pos_pax/static/src/xml/PAXPaymentTransactionPopup.xml b/pos_pax/static/src/xml/PAXPaymentTransactionPopup.xml deleted file mode 100644 index 7c120b30..00000000 --- a/pos_pax/static/src/xml/PAXPaymentTransactionPopup.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/pos_pax/views/pos_config_setting_views.xml b/pos_pax/views/pos_config_setting_views.xml deleted file mode 100644 index 3041cb57..00000000 --- a/pos_pax/views/pos_config_setting_views.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - pos.config.form.inherit.pax - pos.config - - - -
-
- PAX -
-

Your PAX Device Endpoint

- -
-
-
-
-
-
- -
diff --git a/pos_pax/views/pos_pax_views.xml b/pos_pax/views/pos_pax_views.xml deleted file mode 100644 index a017ba1e..00000000 --- a/pos_pax/views/pos_pax_views.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - POS orders - pos.order - - - - - - - - - -