Skip to content

Commit 9d7b665

Browse files
committed
[T-9053][ADD] payment_ceca
1 parent 96ba7d8 commit 9d7b665

25 files changed

+1395
-0
lines changed

payment_ceca/README.rst

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
=====================
6+
Ceca Payment Acquirer
7+
=====================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:7e4250f952ad77cb10f792023ee97871e1d0f2c687ee37d26b40ad8463763258
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-sygel--technology%2Fsy--l10n--spain-lightgray.png?logo=github
24+
:target: https://github.com/sygel-technology/sy-l10n-spain/tree/15.0/payment_ceca
25+
:alt: sygel-technology/sy-l10n-spain
26+
27+
|badge1| |badge2| |badge3|
28+
29+
This modules allows to use CECA payment acquirer.
30+
31+
**Table of contents**
32+
33+
.. contents::
34+
:local:
35+
36+
Configuration
37+
=============
38+
39+
To configure this module, both you and your customer must configure Odoo
40+
and the CECA portal platform.
41+
42+
Both platforms must be correctly interconnected and must use the same
43+
credentials to ensure proper communication.
44+
45+
Configure Odoo
46+
--------------
47+
48+
To configure this module, you need configure the CECA payment Acquirer.
49+
For that, to go to Invoicing > Configuration > Payment Acquirers and
50+
select Ceca. The following values need to be set in the Credentials tab:
51+
52+
1. Ceca Acquirer Bin. It can be found in the ceca portal.
53+
2. Ceca Merchant Id. It can be found in the ceca portal.
54+
3. Cerca Terminal Id. It can be found in the ceca portal.
55+
4. Ceca Business Name. It can be found in the ceca portal.
56+
5. Ceca Encriptation Key. It can be found in the ceca portal.
57+
6. Ceca Exponente.
58+
7. Ceca Tipo de Moneda.
59+
60+
It is also possible to force the use of a certain payment mode through
61+
the fields 'Force Bizum', 'Force Card', 'Force Google Pay', and 'Force
62+
Apple Pay'. Only one checkbox can be selected. In case one of these
63+
checkbox is activated, the customer will not be able to select a payment
64+
mode, but the one selected will be mandatory. If no payment mode is
65+
selected, the customer will be asked to select the payment mode to be
66+
used among those activated by the bank.
67+
68+
In order to make Ceca Payment Acquirer available, it needs to be
69+
activaded. Go to Invoicing > Configuration > Payment Acquirers and
70+
select Ceca, then change the 'State' option to one of the following:
71+
72+
- Disabled. The payment acquirer is not available.
73+
74+
- Enabled. The payment acquirer is available both in test and
75+
production environment.
76+
77+
- Test Mode. The payment acquierer is only available for testing.
78+
79+
Keep in mind that different security credentials are used in 'Enable'
80+
and 'Test Mode' states. The CECA firm can be badly calculated if you are
81+
not using the correct credentials, and then a error will be displayed on
82+
the CECA payment screen. To create a testing CECA payment acquirer you
83+
can duplicate the original one.
84+
85+
Configure the CECA portal
86+
-------------------------
87+
88+
You would also need to make some configurations on your CECA portal to
89+
ensure the compatibility with this module. Specifically, you must inform
90+
CECA of the URL on your server corresponding to the endpoint provided by
91+
this module to mark a payment as completed. To do that, you must go to
92+
the "Configuración Comunicación Online" of your TPV Portal and fill the
93+
following options:
94+
95+
- Comunicación on-line OK: Si
96+
- URL online OK: http://<your_server_domain>/payment/ceca/notify/.
97+
Example: https://www.sygel.es/payment/ceca/notify
98+
- Respuesta requerida OK: No
99+
100+
You can see an example in the image located in this module at
101+
static/src/img/ceca_config.png to see how to configure CECA on its
102+
portal
103+
104+
For more information about how to configure the CECA payment, you can
105+
refer to the CECA manual.
106+
107+
|image|
108+
109+
.. |image| image:: https://raw.githubusercontent.com/sygel-technology/sy-l10n-spain/15.0/payment_ceca/static/src/img/ceca_config.png
110+
111+
Usage
112+
=====
113+
114+
To use this module, you need to create an order and pay it using the
115+
CECA method. The detailed steps are explained below:
116+
117+
1. Create an order and go to its payment view on the portal or website
118+
shop. For example, you can create a Sale Order, and click on Action /
119+
Generate a Paymnent link. Select the CECA payment acquirer, and go to
120+
the provided link. Note: If no payment mode has been selected to be
121+
forced, it will be necessary to select which payment mode has to be
122+
used for the specific transaction
123+
124+
2. In the payment view, review the corresponding fields and click on the
125+
Pay button.
126+
127+
3. You would be redirected to the payment gateway. Fill the fields and
128+
confirm the payment. If the CECA acquirer is in test mode, you can
129+
use CECA's test credentials; if not, a real credit card needs to be
130+
used.
131+
132+
4. Once the payment is confirmed, you would be redirected again to
133+
Odoo's payment view. Then, the transaction will be changed to the
134+
'Done' state. If an error occurs, the transaction will be cancelled.
135+
136+
IMPORTANT: When a previously confirmed transaction is canceled, the
137+
payment needs to be canceled too. The payment can be accessed from the
138+
transaction form view.
139+
140+
Known issues / Roadmap
141+
======================
142+
143+
- It only works with serial numbers, not lots.
144+
- Unit tests should be added in the next versions of this module
145+
- The payment acquirer has fields written in spanish. That sould be
146+
changed in the next versions of this module.
147+
148+
Bug Tracker
149+
===========
150+
151+
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-l10n-spain/issues>`_.
152+
In case of trouble, please check there if your issue has already been reported.
153+
If you spotted it first, help us to smash it by providing a detailed and welcomed
154+
`feedback <https://github.com/sygel-technology/sy-l10n-spain/issues/new?body=module:%20payment_ceca%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
155+
156+
Do not contact contributors directly about support or help with technical issues.
157+
158+
Credits
159+
=======
160+
161+
Authors
162+
-------
163+
164+
* Sygel
165+
166+
Contributors
167+
------------
168+
169+
- `Sygel <https://www.sygel.es>`__:
170+
171+
- Manuel Regidor
172+
- Valentin Vinagre
173+
- Harald Panten
174+
- Alberto Martínez
175+
176+
Maintainers
177+
-----------
178+
179+
This module is part of the `sygel-technology/sy-l10n-spain <https://github.com/sygel-technology/sy-l10n-spain/tree/15.0/payment_ceca>`_ project on GitHub.
180+
181+
You are welcome to contribute.

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

0 commit comments

Comments
 (0)