diff --git a/pos_payment_terminal/README.rst b/pos_payment_terminal/README.rst new file mode 100644 index 0000000000..8fea04308b --- /dev/null +++ b/pos_payment_terminal/README.rst @@ -0,0 +1,106 @@ +==================== +POS Payment Terminal +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/14.0/pos_payment_terminal + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_payment_terminal + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds support for credit card reader and checks printer +in the Point of Sale. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +This module is designed to be installed on the +*main Odoo server*. On the *POSbox/IoTbox*, you should install the module +*hw_x* depending on the protocol implemented in your device. Remember that the POSbox/IoTbox runs Odoo v12 (even if your Odoo server runs v13 or v14), so you should look in the 12.0 branch of the `OCA POS project `_ to find the *hw_x* modules. + +`Ingenico ` +card readers for France support the Telium protocol implemented in the +*hw_telium_payment_terminal* module for the POSbox/IoTBox. + +You can also consider `pywebdriver project `_ as an alternative to the POSbox/IoTbox. + +Configuration +============= + +* Go to *Point of Sale > Configuration > Payment Methods*, edit the + payment method corresponding to the card reader and set + the field *Use a payment terminal* to *OCA Payment Terminal*. A new field *Payment Mode* will appear, that has *Card* as defaut value. If the payment method is for Checks and you have a check printer, select *Check* instead. + +.. figure:: https://raw.githubusercontent.com/OCA/pos/14.0/pos_payment_terminal/static/description/pos_payment_method_form.png + +Usage +===== + +In the frontend of the POS, when you select a payment method that has a payment mode with *Use a Payment Terminal* set to *OCA Payment Terminal*, you will have an additionnal *Send* button: if you click on that button, the amount, the currency and the payment mode will be sent to the POSbox/IoTBox/pywebdriver. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Aurélien DUMAINE +* GRAP +* Akretion +* ACSONE SA/NV + +Contributors +~~~~~~~~~~~~ + +* Aurelien Dumaine +* Alexis de Lattre +* Sylvain LE GAL (https://twitter.com/legalsylvain) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_payment_terminal/__init__.py b/pos_payment_terminal/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_payment_terminal/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_payment_terminal/__manifest__.py b/pos_payment_terminal/__manifest__.py new file mode 100644 index 0000000000..01d3691beb --- /dev/null +++ b/pos_payment_terminal/__manifest__.py @@ -0,0 +1,31 @@ +# Copyright 2014-2020 Aurélien DUMAINE +# Copyrght 2015-2020 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "POS Payment Terminal", + "version": "16.0.1.0.0", + "category": "Point Of Sale", + "summary": "Point of sale: support generic payment terminal", + "author": ( + "Aurélien DUMAINE," + "GRAP," + "Akretion," + "ACSONE SA/NV," + "Odoo Community Association (OCA)" + ), + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "data": [ + "views/pos_payment_method.xml", + ], + "assets": { + "point_of_sale.assets": [ + "pos_payment_terminal/static/src/js/payment_terminal.js", + "pos_payment_terminal/static/src/js/models.js", + ], + }, + "installable": True, +} diff --git a/pos_payment_terminal/i18n/es.po b/pos_payment_terminal/i18n/es.po new file mode 100644 index 0000000000..a5d1661343 --- /dev/null +++ b/pos_payment_terminal/i18n/es.po @@ -0,0 +1,133 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +# Translators: +# OCA Transbot , 2017 +# enjolras , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-01 02:01+0000\n" +"PO-Revision-Date: 2020-07-27 11:19+0000\n" +"Last-Translator: Daniel Martinez Vila \n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "Tarjeta" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "Talón" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" + +#~ msgid "A payment terminal is available on the Proxy" +#~ msgstr "Un terminal de pago está disponible en el Proxy" + +#~ msgid "Journal" +#~ msgstr "Diario" + +#~ msgid "Payment Terminal" +#~ msgstr "Terminal de pago" + +#~ msgid "Point of Sale Configuration" +#~ msgstr "Configuración del punto de venta" + +#~ msgid "Point of Sale Orders" +#~ msgstr "Pedidos de Punto de Venta" + +#~ msgid "Select the payment mode sent to the payment terminal" +#~ msgstr "Seleccione la forma de pega enviada al terminal de pago" + +#~ msgid "Start transaction" +#~ msgstr "Iniciar transacción" + +#~ msgid "Terminal Payment Mode" +#~ msgstr "Modo de pago del terminal" + +#~ msgid "pos.config" +#~ msgstr "Configuración del TPV" diff --git a/pos_payment_terminal/i18n/fr.po b/pos_payment_terminal/i18n/fr.po new file mode 100644 index 0000000000..32e422d7a3 --- /dev/null +++ b/pos_payment_terminal/i18n/fr.po @@ -0,0 +1,107 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-12-17 08:57+0000\n" +"PO-Revision-Date: 2020-12-17 08:57+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "Carte" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "Chèque" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" +"Échec de l'envoi du montant à payer au lecteur CB. Appuyez sur le bouton " +"rouge du lecteur CB et essayez à nouveau." + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "ID" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "Terminal de paiement OCA" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "Mode de paiement" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "Erreur - Lecteur CB" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "Modes de paiement du point de vente" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" + +#~ msgid "Cannot process transactions with negative amount." +#~ msgstr "Impossible d'envoyer des montants négatifs au lecteur CB" diff --git a/pos_payment_terminal/i18n/hr_HR.po b/pos_payment_terminal/i18n/hr_HR.po new file mode 100644 index 0000000000..7c8810cbb8 --- /dev/null +++ b/pos_payment_terminal/i18n/hr_HR.po @@ -0,0 +1,126 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-12-13 19:51+0000\n" +"PO-Revision-Date: 2016-12-13 19:51+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/" +"hr_HR/)\n" +"Language: hr_HR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "Kartica" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "Ček" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" + +#~ msgid "Journal" +#~ msgstr "Dnevnik" + +#, fuzzy +#~ msgid "Payment Terminal" +#~ msgstr "Način plaćanja" + +#~ msgid "Select the payment mode sent to the payment terminal" +#~ msgstr "Odaberite način plaćanja korišten na naplatnom terminalu" + +#~ msgid "Start transaction" +#~ msgstr "Započni transakciju" + +#, fuzzy +#~ msgid "Terminal Payment Mode" +#~ msgstr "Način plaćanja" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_payment_terminal/i18n/it.po b/pos_payment_terminal/i18n/it.po new file mode 100644 index 0000000000..820135b320 --- /dev/null +++ b/pos_payment_terminal/i18n/it.po @@ -0,0 +1,108 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +# Translators: +# Francesco Fresta , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-01 02:01+0000\n" +"PO-Revision-Date: 2022-07-04 12:05+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "ID" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_payment_terminal/i18n/nl_NL.po b/pos_payment_terminal/i18n/nl_NL.po new file mode 100644 index 0000000000..0e1f9bd7b9 --- /dev/null +++ b/pos_payment_terminal/i18n/nl_NL.po @@ -0,0 +1,108 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-05-30 02:44+0000\n" +"PO-Revision-Date: 2017-05-30 02:44+0000\n" +"Last-Translator: Peter Hageman , 2017\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" + +#~ msgid "pos.config" +#~ msgstr "pos.config" diff --git a/pos_payment_terminal/i18n/pos_payment_terminal.pot b/pos_payment_terminal/i18n/pos_payment_terminal.pot new file mode 100644 index 0000000000..920063b62b --- /dev/null +++ b/pos_payment_terminal/i18n/pos_payment_terminal.pot @@ -0,0 +1,99 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_payment_terminal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Cannot process transactions with zero or negative amount." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__card +msgid "Card" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields.selection,name:pos_payment_terminal.selection__pos_payment_method__oca_payment_terminal_mode__check +msgid "Check" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__display_name +msgid "Display Name" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Failed to send the amount to pay to the payment terminal. Press the red " +"button on the payment terminal and try again." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__id +msgid "ID" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method____last_update +msgid "Last Modified on" +msgstr "" + +#. module: pos_payment_terminal +#: code:addons/pos_payment_terminal/models/pos_payment_method.py:0 +#, python-format +msgid "OCA Payment Terminal" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_mode +msgid "Payment Mode" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "Payment Terminal Error" +msgstr "" + +#. module: pos_payment_terminal +#. openerp-web +#: code:addons/pos_payment_terminal/static/src/js/payment_terminal.js:0 +#, python-format +msgid "" +"Please press the red button on the payment terminal to cancel the " +"transaction." +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model,name:pos_payment_terminal.model_pos_payment_method +msgid "Point of Sale Payment Methods" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,field_description:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "Terminal identifier" +msgstr "" + +#. module: pos_payment_terminal +#: model:ir.model.fields,help:pos_payment_terminal.field_pos_payment_method__oca_payment_terminal_id +msgid "" +"The identifier of the terminal as known by the hardware proxy. Leave empty " +"if the proxy has only one terminal connected." +msgstr "" diff --git a/pos_payment_terminal/models/__init__.py b/pos_payment_terminal/models/__init__.py new file mode 100644 index 0000000000..f5c5bb8d16 --- /dev/null +++ b/pos_payment_terminal/models/__init__.py @@ -0,0 +1 @@ +from . import pos_payment_method, pos_session diff --git a/pos_payment_terminal/models/pos_payment_method.py b/pos_payment_terminal/models/pos_payment_method.py new file mode 100644 index 0000000000..4472c2fb23 --- /dev/null +++ b/pos_payment_terminal/models/pos_payment_method.py @@ -0,0 +1,25 @@ +# Copyrght 2020 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, fields, models + + +class PosPaymentMethod(models.Model): + _inherit = "pos.payment.method" + + def _get_payment_terminal_selection(self): + res = super()._get_payment_terminal_selection() + res.append(("oca_payment_terminal", _("OCA Payment Terminal"))) + return res + + oca_payment_terminal_mode = fields.Selection( + [("card", "Card"), ("check", "Check")], string="Payment Mode", default="card" + ) + oca_payment_terminal_id = fields.Char( + string="Terminal identifier", + help=( + "The identifier of the terminal as known by the hardware proxy. " + "Leave empty if the proxy has only one terminal connected." + ), + ) diff --git a/pos_payment_terminal/models/pos_session.py b/pos_payment_terminal/models/pos_session.py new file mode 100644 index 0000000000..714b053272 --- /dev/null +++ b/pos_payment_terminal/models/pos_session.py @@ -0,0 +1,13 @@ +from odoo import models + + +class PosSession(models.Model): + _inherit = "pos.session" + + def _loader_params_pos_payment_method(self): + params = super()._loader_params_pos_payment_method() + params["search_params"]["fields"].extend( + ["oca_payment_terminal_mode", "oca_payment_terminal_id"] + ) + + return params diff --git a/pos_payment_terminal/readme/CONFIGURE.rst b/pos_payment_terminal/readme/CONFIGURE.rst new file mode 100644 index 0000000000..6ac8a5fd35 --- /dev/null +++ b/pos_payment_terminal/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +* Go to *Point of Sale > Configuration > Payment Methods*, edit the + payment method corresponding to the card reader and set + the field *Use a payment terminal* to *OCA Payment Terminal*. A new field *Payment Mode* will appear, that has *Card* as defaut value. If the payment method is for Checks and you have a check printer, select *Check* instead. + +.. figure:: ../static/description/pos_payment_method_form.png diff --git a/pos_payment_terminal/readme/CONTRIBUTORS.rst b/pos_payment_terminal/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..2246ef2fd2 --- /dev/null +++ b/pos_payment_terminal/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Aurelien Dumaine +* Alexis de Lattre +* Sylvain LE GAL (https://twitter.com/legalsylvain) diff --git a/pos_payment_terminal/readme/DESCRIPTION.rst b/pos_payment_terminal/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..ee3a40513d --- /dev/null +++ b/pos_payment_terminal/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds support for credit card reader and checks printer +in the Point of Sale. diff --git a/pos_payment_terminal/readme/INSTALL.rst b/pos_payment_terminal/readme/INSTALL.rst new file mode 100644 index 0000000000..e2ee57351b --- /dev/null +++ b/pos_payment_terminal/readme/INSTALL.rst @@ -0,0 +1,9 @@ +This module is designed to be installed on the +*main Odoo server*. On the *POSbox/IoTbox*, you should install the module +*hw_x* depending on the protocol implemented in your device. Remember that the POSbox/IoTbox runs Odoo v12 (even if your Odoo server runs v13 or v14), so you should look in the 12.0 branch of the `OCA POS project `_ to find the *hw_x* modules. + +`Ingenico ` +card readers for France support the Telium protocol implemented in the +*hw_telium_payment_terminal* module for the POSbox/IoTBox. + +You can also consider `pywebdriver project `_ as an alternative to the POSbox/IoTbox. diff --git a/pos_payment_terminal/readme/USAGE.rst b/pos_payment_terminal/readme/USAGE.rst new file mode 100644 index 0000000000..2543eb46aa --- /dev/null +++ b/pos_payment_terminal/readme/USAGE.rst @@ -0,0 +1 @@ +In the frontend of the POS, when you select a payment method that has a payment mode with *Use a Payment Terminal* set to *OCA Payment Terminal*, you will have an additionnal *Send* button: if you click on that button, the amount, the currency and the payment mode will be sent to the POSbox/IoTBox/pywebdriver. diff --git a/pos_payment_terminal/static/description/icon.png b/pos_payment_terminal/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_payment_terminal/static/description/icon.png differ diff --git a/pos_payment_terminal/static/description/index.html b/pos_payment_terminal/static/description/index.html new file mode 100644 index 0000000000..b62e42e667 --- /dev/null +++ b/pos_payment_terminal/static/description/index.html @@ -0,0 +1,453 @@ + + + + + + +POS Payment Terminal + + + +
+

POS Payment Terminal

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

This module adds support for credit card reader and checks printer +in the Point of Sale.

+

Table of contents

+ +
+

Installation

+

This module is designed to be installed on the +main Odoo server. On the POSbox/IoTbox, you should install the module +hw_x depending on the protocol implemented in your device. Remember that the POSbox/IoTbox runs Odoo v12 (even if your Odoo server runs v13 or v14), so you should look in the 12.0 branch of the OCA POS project to find the hw_x modules.

+

Ingenico <http://en.wikipedia.org/wiki/Ingenico> +card readers for France support the Telium protocol implemented in the +hw_telium_payment_terminal module for the POSbox/IoTBox.

+

You can also consider pywebdriver project as an alternative to the POSbox/IoTbox.

+
+
+

Configuration

+
    +
  • Go to Point of Sale > Configuration > Payment Methods, edit the +payment method corresponding to the card reader and set +the field Use a payment terminal to OCA Payment Terminal. A new field Payment Mode will appear, that has Card as defaut value. If the payment method is for Checks and you have a check printer, select Check instead.
  • +
+
+https://raw.githubusercontent.com/OCA/pos/14.0/pos_payment_terminal/static/description/pos_payment_method_form.png +
+
+
+

Usage

+

In the frontend of the POS, when you select a payment method that has a payment mode with Use a Payment Terminal set to OCA Payment Terminal, you will have an additionnal Send button: if you click on that button, the amount, the currency and the payment mode will be sent to the POSbox/IoTBox/pywebdriver.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Aurélien DUMAINE
  • +
  • GRAP
  • +
  • Akretion
  • +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_payment_terminal/static/description/pos_payment_method_form.png b/pos_payment_terminal/static/description/pos_payment_method_form.png new file mode 100644 index 0000000000..bbcec530b2 Binary files /dev/null and b/pos_payment_terminal/static/description/pos_payment_method_form.png differ diff --git a/pos_payment_terminal/static/src/js/models.js b/pos_payment_terminal/static/src/js/models.js new file mode 100644 index 0000000000..2ee4345f9a --- /dev/null +++ b/pos_payment_terminal/static/src/js/models.js @@ -0,0 +1,72 @@ +/* + POS Payment Terminal module for Odoo + Copyright (C) 2014-2020 Aurélien DUMAINE + Copyright (C) 2014-2020 Akretion (www.akretion.com) + @author: Aurélien DUMAINE + @author: Alexis de Lattre + @author: Denis Roussel + @author: Stéphane Bidoul + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +*/ + +odoo.define("pos_payment_terminal.models", function (require) { + "use strict"; + + var models = require("point_of_sale.models"); + const {PosGlobalState, Payment} = require("point_of_sale.models"); + const Registries = require("point_of_sale.Registries"); + + var OCAPaymentTerminal = require("pos_payment_terminal.payment"); + models.register_payment_method("oca_payment_terminal", OCAPaymentTerminal); + + const PosPaymentTerminalPosGlobalState = (PosGlobalState) => + class PosPaymentTerminalPosGlobalState extends PosGlobalState { + // @override + async after_load_server_data() { + for (var payment_method_id in this.payment_methods) { + var payment_method = this.payment_methods[payment_method_id]; + if (payment_method.use_payment_terminal == "oca_payment_terminal") { + this.config.use_proxy = true; + } + } + return await super.after_load_server_data(...arguments); + } + }; + Registries.Model.extend(PosGlobalState, PosPaymentTerminalPosGlobalState); + + const PosPaymentTerminalPayment = (Payment) => + class PosPaymentTerminalPayment extends Payment { + constructor() { + super(...arguments); + // Id of the terminal transaction, used to find the payment + // line corresponding to a terminal transaction status coming + // from the terminal driver. + this.terminal_transaction_id = null; + // Success: null: in progress, false: failed: true: succeeded + this.terminal_transaction_success = null; + // Human readable transaction status, set if the transaction failed. + this.terminal_transaction_status = null; + // Additional information about the transaction status. + this.terminal_transaction_status_details = null; + } + // @override + init_from_JSON(json) { + super.init_from_JSON(json); + this.terminal_transaction_id = json.terminal_transaction_id; + this.terminal_transaction_success = json.terminal_transaction_success; + this.terminal_transaction_status = json.terminal_transaction_status; + this.terminal_transaction_status_details = + json.terminal_transaction_status_details; + } + // @override + export_as_JSON() { + var vals = super.export_as_JSON(); + vals.terminal_transaction_id = this.terminal_transaction_id; + vals.terminal_transaction_success = this.terminal_transaction_success; + vals.terminal_transaction_status_details = + this.terminal_transaction_status_details; + return vals; + } + }; + Registries.Model.extend(Payment, PosPaymentTerminalPayment); +}); diff --git a/pos_payment_terminal/static/src/js/payment_terminal.js b/pos_payment_terminal/static/src/js/payment_terminal.js new file mode 100644 index 0000000000..614a3ebb3e --- /dev/null +++ b/pos_payment_terminal/static/src/js/payment_terminal.js @@ -0,0 +1,191 @@ +/* + Copyright 2020 Akretion France (http://www.akretion.com/) + @author: Alexis de Lattre + @author: Stéphane Bidoul + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +*/ + +odoo.define("pos_payment_terminal.payment", function (require) { + "use strict"; + + var core = require("web.core"); + var PaymentInterface = require("point_of_sale.PaymentInterface"); + const {Gui} = require("point_of_sale.Gui"); + + var _t = core._t; + + var OCAPaymentTerminal = PaymentInterface.extend({ + init: function () { + this._super.apply(this, arguments); + }, + + send_payment_request: function () { + this._super.apply(this, arguments); + return this._oca_payment_terminal_pay(); + }, + + send_payment_cancel: function () { + this._super.apply(this, arguments); + this._show_error( + _t( + "Please press the red button on the payment terminal to cancel the transaction." + ) + ); + return Promise.reject(); + }, + + _oca_payment_terminal_pay: function () { + var order = this.pos.get_order(); + var pay_line = order.selected_paymentline; + var currency = this.pos.currency; + if (pay_line.amount <= 0) { + // TODO check if it's possible or not + this._show_error( + _t("Cannot process transactions with zero or negative amount.") + ); + return Promise.resolve(); + } + var data = { + amount: pay_line.amount, + currency_iso: currency.name, + currency_decimals: currency.decimals, + payment_mode: this.payment_method.oca_payment_terminal_mode, + payment_id: pay_line.cid, + order_id: order.name, + }; + if (this.payment_method.oca_payment_terminal_id) { + data.terminal_id = this.payment_method.oca_payment_terminal_id; + } + return this._oca_payment_terminal_proxy_request(data).then((response) => { + if (response === false) { + this._show_error( + _t( + "Failed to send the amount to pay to the payment terminal. Press the red button on the payment terminal and try again." + ) + ); + // There was an error, let the user retry. + return false; + } else if (response instanceof Object && "transaction_id" in response) { + // The response has a terminal transaction identifier: + // return a promise that polls for transaction status. + pay_line.set_payment_status("waitingCard"); + this._oca_update_payment_line_terminal_transaction_status( + pay_line, + response + ); + return new Promise((resolve, reject) => { + this._oca_poll_for_transaction_status( + pay_line, + resolve, + reject + ); + }); + } + + // The transaction was started, but the terminal driver + // does not report status, so we won't know the + // transaction result: we let the user enter the + // outcome manually. This is done by rejecting the + // promise as explained in the send_payment_request() + // documentation. + pay_line.set_payment_status("force_done"); + return Promise.reject(); + }); + }, + + _oca_poll_for_transaction_status: function (pay_line, resolve, reject) { + var timerId = setInterval(() => { + // Query the driver status more frequently than the regular POS + // proxy, to get faster feedback when the transaction is + // complete on the terminal. + var status_params = {}; + if (this.payment_method.oca_payment_terminal_id) { + status_params.terminal_id = + this.payment_method.oca_payment_terminal_id; + } + this.pos.env.proxy.connection + .rpc("/hw_proxy/status_json", status_params, { + shadow: true, + timeout: 1000, + }) + .then((drivers_status) => { + for (var driver_name in drivers_status) { + // Look for a driver that is a payment terminal and has + // transactions. + var driver = drivers_status[driver_name]; + if (!driver.is_terminal || !("transactions" in driver)) { + continue; + } + for (var transaction_id in driver.transactions) { + var transaction = driver.transactions[transaction_id]; + if ( + transaction.transaction_id === + pay_line.terminal_transaction_id + ) { + // Look for the transaction corresponding to + // the payment line. + this._oca_update_payment_line_terminal_transaction_status( + pay_line, + transaction + ); + if ( + pay_line.terminal_transaction_success !== null + ) { + resolve(pay_line.terminal_transaction_success); + // Stop the loop + clearInterval(timerId); + } + } + } + } + }) + .catch(() => { + console.error("Error querying terminal driver status"); + // We could not query the transaction status so we + // won't know the transaction result: we let the user + // enter the outcome manually. This is done by + // rejecting the promise as explained in the + // send_payment_request() documentation. + pay_line.set_payment_status("force_done"); + reject(); + // Stop the loop + clearInterval(timerId); + }); + }, 1000); + }, + + _oca_update_payment_line_terminal_transaction_status: function ( + pay_line, + transaction + ) { + pay_line.terminal_transaction_id = transaction.transaction_id; + pay_line.terminal_transaction_success = transaction.success; + pay_line.terminal_transaction_status = transaction.status; + pay_line.terminal_transaction_status_details = transaction.status_details; + // Payment transaction reference, for accounting reconciliation purposes. + pay_line.transaction_id = transaction.reference; + }, + + _oca_payment_terminal_proxy_request: function (data) { + return this.pos.env.proxy + .message("payment_terminal_transaction_start", { + payment_info: JSON.stringify(data), + }) + .then((response) => { + return response; + }) + .catch(() => { + console.error("Error starting payment transaction"); + return false; + }); + }, + + _show_error: function (msg, title) { + Gui.showPopup("ErrorPopup", { + title: title || _t("Payment Terminal Error"), + body: msg, + }); + }, + }); + return OCAPaymentTerminal; +}); diff --git a/pos_payment_terminal/views/pos_payment_method.xml b/pos_payment_terminal/views/pos_payment_method.xml new file mode 100644 index 0000000000..141aac8c7d --- /dev/null +++ b/pos_payment_terminal/views/pos_payment_method.xml @@ -0,0 +1,21 @@ + + + + + pos.payment.method + + + + + + + + + + diff --git a/setup/pos_payment_terminal/odoo/addons/pos_payment_terminal b/setup/pos_payment_terminal/odoo/addons/pos_payment_terminal new file mode 120000 index 0000000000..77dc5689b3 --- /dev/null +++ b/setup/pos_payment_terminal/odoo/addons/pos_payment_terminal @@ -0,0 +1 @@ +../../../../pos_payment_terminal \ No newline at end of file diff --git a/setup/pos_payment_terminal/setup.py b/setup/pos_payment_terminal/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_payment_terminal/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)