[IMP] pos_six: Upgrade TIM JavaScript SDK
Upgrade the TIM JavaScript SDK to the latest version (4.6.0). The version Six gave us initially (3.8.1) didn't return any error message. We now have some (ugly) error messages that could at least help the cashier understand where the problem comes from (e.g. "timCommunicationFailure", "cardholderStop", etc.). closes odoo/odoo#52181 Taskid: 2267818 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -7,6 +7,14 @@ var PaymentInterface = require('point_of_sale.PaymentInterface');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
onTimApiReady = function () {};
|
||||
onTimApiPublishLogRecord = function (record) {
|
||||
// Log only warning or errors
|
||||
if (record.matchesLevel(timapi.LogRecord.LogLevel.warning)) {
|
||||
timapi.log(String(record));
|
||||
}
|
||||
};
|
||||
|
||||
var PaymentSix = PaymentInterface.extend({
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -24,10 +32,11 @@ var PaymentSix = PaymentInterface.extend({
|
||||
settings.connectionMode = timapi.constants.ConnectionMode.onFixIp;
|
||||
settings.connectionIPString = this.payment_method.six_terminal_ip;
|
||||
settings.connectionIPPort = "80";
|
||||
settings.integratorId = "175d97a0-2a88-4413-b920-e90037b582ac";
|
||||
|
||||
this.terminal = new timapi.Terminal(settings);
|
||||
this.terminal.posId = this.pos.pos_session.name;
|
||||
this.terminal.userId = this.pos.pos_session.user_id[0];
|
||||
this.terminal.setPosId(this.pos.pos_session.name);
|
||||
this.terminal.setUserId(this.pos.pos_session.user_id[0]);
|
||||
|
||||
this.terminalListener = new timapi.DefaultTerminalListener();
|
||||
this.terminalListener.transactionCompleted = this._onTransactionComplete.bind(this);
|
||||
@@ -44,7 +53,7 @@ var PaymentSix = PaymentInterface.extend({
|
||||
);
|
||||
options.push(option);
|
||||
});
|
||||
this.terminal.printOptions = options;
|
||||
this.terminal.setPrintOptions(options);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -82,10 +91,10 @@ var PaymentSix = PaymentInterface.extend({
|
||||
timapi.DefaultTerminalListener.prototype.transactionCompleted(event, data);
|
||||
|
||||
if (event.exception) {
|
||||
if (this.pos.get_order().selected_paymentline.get_payment_status() !== 'retry') {
|
||||
if (event.exception.resultCode !== timapi.constants.ResultCode.apiCancelEcr) {
|
||||
Gui.showPopup('ErrorPopup', {
|
||||
title: _t('Terminal Error'),
|
||||
body: _t('Transaction was not processed correctly'),
|
||||
title: _t('Transaction was not processed correctly'),
|
||||
body: event.exception.errorText,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,7 +107,7 @@ var PaymentSix = PaymentInterface.extend({
|
||||
// Store Transaction Data
|
||||
var transactionData = new timapi.TransactionData();
|
||||
transactionData.transSeq = data.transactionInformation.transSeq;
|
||||
this.terminal.transactionData = transactionData;
|
||||
this.terminal.setTransactionData(transactionData);
|
||||
|
||||
this.transactionResolve(true);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<odoo>
|
||||
<template id="assets" inherit_id="point_of_sale.assets">
|
||||
<xpath expr="." position="inside">
|
||||
<script type="text/javascript" src="/pos_six/static/lib/six_timapi/timapi.bundle.js"></script>
|
||||
<script type="text/javascript" src="/pos_six/static/lib/six_timapi/timapi.js"></script>
|
||||
<script type="text/javascript" src="/pos_six/static/src/js/models.js"></script>
|
||||
<script type="text/javascript" src="/pos_six/static/src/js/payment_six.js"></script>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user