Skip to content

Commit 9ce1735

Browse files
committed
[T-9053][ADD] payment_ceca
1 parent dfb31e4 commit 9ce1735

17 files changed

Lines changed: 713 additions & 0 deletions

payment_ceca/README.rst

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl
3+
:alt: License: AGPL-3
4+
5+
============
6+
Payment CECA
7+
============
8+
9+
This modules allows to use CECA payment acquirer.
10+
11+
12+
Installation
13+
============
14+
15+
To install this module, you need to:
16+
17+
#. Just install.
18+
19+
20+
Configuration
21+
=============
22+
23+
Configure Odoo
24+
--------------
25+
26+
To configure this module, you need to go to Invoicing > Configuration > Payment Acquirers and select Ceca. The following values need to be set in the Credentials tab:
27+
28+
1. Ceca Acquirer Bin. It can be found in the ceca portal.
29+
2. Ceca Merchant Id. It can be found in the ceca portal.
30+
3. Cerca Terminal Id. It can be found in the ceca portal.
31+
4. Ceca Business Name. It can be found in the ceca portal.
32+
5. Ceca Encriptation Key. It can be found in the ceca portal.
33+
6. Ceca Exponente.
34+
7. Ceca Tipo de Moneda.
35+
36+
It is also possible to force the use of a certain payment mode through the fields 'Force Bizum', 'Force Card', 'Force Google Pay', and 'Force Apple Pay'. Only one checkbox can be selected. In case one of these checkbox is activated, the customer will not be able to select a payment mode, but the one selected will be mandatory. If no payment mode is selected, the customer will be asked to select the payment mode to be used among those activated by the bank.
37+
38+
In order to make Ceca Payment Acquirer available, it needs to be activaded. Go to Invoicing > Configuration > Payment Acquirers and select Ceca, then change the 'State' option to one of the following:
39+
40+
- Disabled. The payment acquirer is not available.
41+
42+
- Enabled. The payment acquirer is available both in test and production environment.
43+
44+
- Test Mode. The payment acquierer is only available for testing.
45+
46+
Keep in mind that different security credentials are used in 'Enable' and 'Test Mode' states. The CECA firm can be badly calculated if you are not using the correct credentials, and then a error will be displayed on the CECA payment screen. To create a testing CECA payment acquirer you can duplicate the original one.
47+
48+
49+
Configure CECA portal
50+
---------------------
51+
52+
You would also need to make some configurations on your CECA portal to ensure the compatibility with this module. Specifically, you must tell CECA what is the URL in your server of the endpoint this module provides to mark a payment as done. To do that, you must go to the "Configuración Comunicación Online" of your TPV Portal and fill the following options:
53+
54+
1. Comunicación on-line OK: Si
55+
2. URL online OK: "http://<your_server_domain>/payment/ceca/notify/". Example: https://www.sygel.es/payment/ceca/notify
56+
3. Respuesta requerida OK: No
57+
58+
You can see an example in the image static/src/img/ceca_config.png to see how to configure CECA on its portal:
59+
60+
.. image:: static/src/img/ceca_config.png
61+
62+
63+
Usage
64+
=====
65+
66+
Select Ceca Payment when paying an order in the portal or website shop. You will be redirected to Ceca payment gateway. If no payment mode has been selected to be forced, it will be necessary to select which payment mode has to be used for the specific transaction.
67+
68+
Once the payment is confirmed, the transaction will be changed to the 'Done' state. If an error occurs, the transaction will be cancelled.
69+
70+
IMPORTANT: When a previously confirmed transaction is canceled, the paymen needs to be canceled too. The payment can be accessed from the transaction form view.
71+
72+
ROADMAP
73+
=======
74+
75+
- It only works with serial numbers, not lots.
76+
77+
78+
Bug Tracker
79+
===========
80+
81+
Bugs and errors are managed in `issues of GitHub <https://github.com/sygel-technology/sy-l10n-spain/issues>`_.
82+
In case of problems, please check if your problem has already been
83+
reported. If you are the first to discover it, help us solving it by indicating
84+
a detailed description `here <https://github.com/sygel-technology/sy-l10n-spain/issues/new>`_.
85+
86+
Do not contact contributors directly about support or help with technical issues.
87+
88+
89+
Credits
90+
=======
91+
92+
Authors
93+
~~~~~~~
94+
95+
* Sygel, Odoo Community Association (OCA)
96+
97+
98+
Contributors
99+
~~~~~~~~~~~~
100+
101+
* Manuel Regidor <manuel.regidor@sygel.es>
102+
103+
104+
Maintainer
105+
~~~~~~~~~~
106+
107+
This module is maintained by Sygel.
108+
109+
110+
This module is part of the `Sygel/sy-l10n-spain <https://github.com/sygel-technology/sy-l10n-spain>`_.
111+
112+
To contribute to this module, please visit https://github.com/sygel-technology.

payment_ceca/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import models
5+
from . import controllers

payment_ceca/__manifest__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Ceca Payment Acquirer",
6+
"version": "15.0.1.0.0",
7+
"category": "Payment",
8+
"website": "https://www.sygel.es",
9+
"author": "Sygel, Odoo Community Association (OCA)",
10+
"license": "AGPL-3",
11+
"depends": [
12+
"account",
13+
"payment",
14+
"sale",
15+
],
16+
"data": [
17+
"views/payment_ceca_templates.xml",
18+
"views/payment_acquirer_view.xml",
19+
"data/payment_ceca_data.xml"
20+
],
21+
"installable": True
22+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import main

payment_ceca/controllers/main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import http
5+
from odoo.http import request
6+
7+
import logging
8+
_logger = logging.getLogger(__name__)
9+
10+
11+
class PaymentTransacionCecaController(http.Controller):
12+
13+
_return_url = '/payment/ceca/feedback'
14+
_error_url = '/payment/ceca/error'
15+
_transaction_answer_url = '/payment/ceca/notify'
16+
17+
@http.route(_return_url, type='http', auth='public', methods=['GET'], website=True)
18+
def ceca_form_feedback(self, **post):
19+
return request.redirect('/payment/status')
20+
21+
@http.route(_error_url, type='http', auth='public', methods=['GET'], website=True)
22+
def ceca_form_error(self, **post):
23+
if post.get('transaction'):
24+
_logger.info("Cancelling CECA Transaction {}.".format(post.get('transaction')))
25+
transaction = request.env['payment.transaction'].sudo().search([
26+
('provider', '=', 'ceca'),
27+
('reference', '=', post.get('transaction')),
28+
('state', '=', 'draft'),
29+
], limit=1)
30+
if transaction:
31+
transaction._set_canceled()
32+
return request.redirect('/payment/status')
33+
34+
@http.route(_transaction_answer_url, type='http', auth='public', methods=['POST'], csrf=False)
35+
def ceca_notify(self, **post):
36+
_logger.info("CECA Online Notification: {}".format(post))
37+
request.env['payment.transaction']._handle_feedback_data('ceca', post)
38+
return 'success'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
3+
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
4+
<odoo noupdate="1">
5+
<record id="payment_acquirer_ceca" model="payment.acquirer">
6+
<field name="name">Ceca</field>
7+
<field name="provider">ceca</field>
8+
<field name="image_128" type="base64" file="payment_ceca/static/src/img/ceca_icon.png"/>
9+
<field name="description" type="html">
10+
<p>
11+
CECA Virtual TPV.
12+
</p>
13+
</field>
14+
<field name="redirect_form_view_id" ref="ceca_acquirer_button"/>
15+
<field name="ceca_acquirer_bin">XXXXXXXXXX</field>
16+
<field name="ceca_merchant_id">XXXXXXXXXX</field>
17+
<field name="ceca_terminal_id">XXXXXXXXXX</field>
18+
<field name="ceca_business_name">XXXXX</field>
19+
<field name="ceca_encriptation_key">XXXXXXXX</field>
20+
<field name="ceca_exponente">0</field>
21+
<field name="ceca_tipo_moneda">0</field>
22+
</record>
23+
<record id="payment_method_ceca" model="account.payment.method">
24+
<field name="name">Ceca</field>
25+
<field name="code">ceca</field>
26+
<field name="payment_type">inbound</field>
27+
</record>
28+
</odoo>
694 KB
Binary file not shown.

payment_ceca/i18n/es.po

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * payment_ceca
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2022-11-21 10:20+0000\n"
10+
"PO-Revision-Date: 2022-11-21 11:21+0100\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Plural-Forms: \n"
17+
"Language: es\n"
18+
"X-Generator: Poedit 2.3\n"
19+
20+
#. module: payment_ceca
21+
#: model:account.payment.method,name:payment_ceca.payment_method_ceca
22+
#: model:ir.model.fields.selection,name:payment_ceca.selection__payment_acquirer__provider__ceca
23+
#: model:payment.acquirer,name:payment_ceca.payment_acquirer_ceca
24+
msgid "Ceca"
25+
msgstr ""
26+
27+
#. module: payment_ceca
28+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_acquirer_bin
29+
msgid "Ceca Acquirer Bin"
30+
msgstr "Código entidad CECA"
31+
32+
#. module: payment_ceca
33+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_business_name
34+
msgid "Ceca Business Name"
35+
msgstr "Nombre del negocio"
36+
37+
#. module: payment_ceca
38+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_encriptation_key
39+
msgid "Ceca Encriptation Key"
40+
msgstr "Clave de encriptación CECA"
41+
42+
#. module: payment_ceca
43+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_exponente
44+
msgid "Ceca Exponente"
45+
msgstr ""
46+
47+
#. module: payment_ceca
48+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_merchant_id
49+
msgid "Ceca Merchant Id"
50+
msgstr "Código comercio CECA"
51+
52+
#. module: payment_ceca
53+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_terminal_id
54+
msgid "Ceca Terminal Id"
55+
msgstr "Identificador de terminal CECA"
56+
57+
#. module: payment_ceca
58+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_tipo_moneda
59+
msgid "Ceca Tipo Moneda"
60+
msgstr ""
61+
62+
#. module: payment_ceca
63+
#: code:addons/payment_ceca/models/payment_transaction.py:0
64+
#, python-format
65+
msgid "Ceca: No transaction found matching reference {}."
66+
msgstr "CECA: No se encuentra la transacción con referencia {}."
67+
68+
#. module: payment_ceca
69+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_force_apple
70+
msgid "Force Apple Pay"
71+
msgstr "Forzar Apple Pay"
72+
73+
#. module: payment_ceca
74+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_force_bizum
75+
msgid "Force Bizum"
76+
msgstr "Forzar Bizum"
77+
78+
#. module: payment_ceca
79+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_force_card
80+
msgid "Force Card"
81+
msgstr "Forzar Tarjeta"
82+
83+
#. module: payment_ceca
84+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_force_google
85+
msgid "Force Google Pay"
86+
msgstr "Forzar Google Pay"
87+
88+
#. module: payment_ceca
89+
#: code:addons/payment_ceca/models/payment_acquirer.py:0
90+
#, python-format
91+
msgid "Only one payment mode can be forced."
92+
msgstr "Solo puede forzarse un modo de pago."
93+
94+
#. module: payment_ceca
95+
#: model:ir.model,name:payment_ceca.model_payment_acquirer
96+
msgid "Payment Acquirer"
97+
msgstr "Método de Pago"
98+
99+
#. module: payment_ceca
100+
#: model:ir.model,name:payment_ceca.model_account_payment_method
101+
msgid "Payment Methods"
102+
msgstr "Métodos de pago"
103+
104+
#. module: payment_ceca
105+
#: model:ir.model,name:payment_ceca.model_payment_transaction
106+
msgid "Payment Transaction"
107+
msgstr "Transacción de pago"
108+
109+
#. module: payment_ceca
110+
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__provider
111+
msgid "Provider"
112+
msgstr "Proveedor"
113+
114+
#. module: payment_ceca
115+
#: code:addons/payment_ceca/models/payment_transaction.py:0
116+
#, python-format
117+
msgid "Received data with missing Num_operacion"
118+
msgstr "Se ha recibidio información sin Num_operacion"
119+
120+
#. module: payment_ceca
121+
#: model:ir.actions.server,name:payment_ceca.cron_sqs_ceca_action_run_ir_actions_server
122+
#: model:ir.cron,cron_name:payment_ceca.cron_sqs_ceca_action_run
123+
#: model:ir.cron,name:payment_ceca.cron_sqs_ceca_action_run
124+
msgid "SQS Payment Transaction Ceca Action Run"
125+
msgstr ""
126+
127+
#. module: payment_ceca
128+
#: model:ir.model.fields,help:payment_ceca.field_payment_acquirer__provider
129+
msgid "The Payment Service Provider to use with this acquirer"
130+
msgstr "El proveedor de servicios de pago a utilizar con este adquirente"
131+
132+
#. module: payment_ceca
133+
#: code:addons/payment_ceca/models/payment_transaction.py:0
134+
#, python-format
135+
msgid "The customer has selected {} to make the payment."
136+
msgstr "El cliente ha seleccionado {} para hacer el pago."
137+
138+
#. module: payment_ceca
139+
#: code:addons/payment_ceca/models/payment_transaction.py:0
140+
#, python-format
141+
msgid "Transaction {} could not be validated."
142+
msgstr "La transacción {} no se pudo validar."
143+
144+
#. module: payment_ceca
145+
#: model_terms:payment.acquirer,auth_msg:payment_ceca.payment_acquirer_ceca
146+
msgid "Your payment has been authorized."
147+
msgstr "Su pago ha sido autorizado."
148+
149+
#. module: payment_ceca
150+
#: model_terms:payment.acquirer,cancel_msg:payment_ceca.payment_acquirer_ceca
151+
msgid "Your payment has been cancelled. Please, try again."
152+
msgstr "Su pago ha sido cancelado. Por favor, vuévalo a intentar."
153+
154+
#. module: payment_ceca
155+
#: model_terms:payment.acquirer,pending_msg:payment_ceca.payment_acquirer_ceca
156+
msgid "Your payment has been successfully processed but is waiting for approval."
157+
msgstr "Su pago ha sido correctamente procesado pero está pendiente de aprobación."
158+
159+
#. module: payment_ceca
160+
#: model_terms:payment.acquirer,done_msg:payment_ceca.payment_acquirer_ceca
161+
msgid "Your payment has been successfully processed. Thank you!"
162+
msgstr "Su pago se ha procesado correctamente. ¡Gracias!"

payment_ceca/models/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import payment_acquirer
5+
from . import payment_transaction
6+
from . import account_payment_method
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models, api
5+
6+
7+
class AccountPaymentMethod(models.Model):
8+
_inherit = 'account.payment.method'
9+
10+
@api.model
11+
def _get_payment_method_information(self):
12+
res = super()._get_payment_method_information()
13+
res["ceca"] = {"mode": "unique", "domain": [("type", "=", "bank")]}
14+
return res

0 commit comments

Comments
 (0)