Skip to content

Commit 35635e4

Browse files
committed
[IMP] payment_ceca: precommit manual fixes
1 parent d458682 commit 35635e4

12 files changed

Lines changed: 739 additions & 96 deletions

File tree

payment_ceca/README.rst

Lines changed: 119 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
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-
============
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|
828

929
This modules allows to use CECA payment acquirer.
1030

31+
**Table of contents**
1132

12-
Installation
13-
============
14-
15-
To install this module, you need to:
16-
17-
#. Just install.
18-
33+
.. contents::
34+
:local:
1935

2036
Configuration
2137
=============
2238

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+
2345
Configure Odoo
2446
--------------
2547

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:
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:
2751

2852
1. Ceca Acquirer Bin. It can be found in the ceca portal.
2953
2. Ceca Merchant Id. It can be found in the ceca portal.
@@ -33,80 +57,123 @@ To configure this module, you need to go to Invoicing > Configuration > Payment
3357
6. Ceca Exponente.
3458
7. Ceca Tipo de Moneda.
3559

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.
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.
3767

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:
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:
3971

40-
- Disabled. The payment acquirer is not available.
72+
- Disabled. The payment acquirer is not available.
4173

42-
- Enabled. The payment acquirer is available both in test and production environment.
74+
- Enabled. The payment acquirer is available both in test and
75+
production environment.
4376

44-
- Test Mode. The payment acquierer is only available for testing.
77+
- Test Mode. The payment acquierer is only available for testing.
4578

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.
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.
4784

85+
Configure the CECA portal
86+
-------------------------
4887

49-
Configure CECA portal
50-
---------------------
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:
5194

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:
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
5399

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
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
57103

58-
You can see an example in the image static/src/img/ceca_config.png to see how to configure CECA on its portal:
104+
For more information about how to configure the CECA payment, you can
105+
refer to the CECA manual.
59106

60-
.. image:: static/src/img/ceca_config.png
107+
|image|
61108

109+
.. |image| image:: https://raw.githubusercontent.com/sygel-technology/sy-l10n-spain/15.0/payment_ceca/static/src/img/ceca_config.png
62110

63111
Usage
64112
=====
65113

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.
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:
67116

68-
Once the payment is confirmed, the transaction will be changed to the 'Done' state. If an error occurs, the transaction will be cancelled.
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
69123

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.
124+
2. In the payment view, review the corresponding fields and click on the
125+
Pay button.
71126

72-
ROADMAP
73-
=======
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.
74131

75-
- It only works with serial numbers, not lots.
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.
76135

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
77145

78146
Bug Tracker
79147
===========
80148

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>`_.
149+
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-l10n-spain/issues>`_.
150+
In case of trouble, please check there if your issue has already been reported.
151+
If you spotted it first, help us to smash it by providing a detailed and welcomed
152+
`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**>`_.
85153

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

88-
89156
Credits
90157
=======
91158

92159
Authors
93-
~~~~~~~
94-
95-
* Sygel, Odoo Community Association (OCA)
160+
-------
96161

162+
* Sygel
97163

98164
Contributors
99-
~~~~~~~~~~~~
100-
101-
* Manuel Regidor <manuel.regidor@sygel.es>
102-
165+
------------
103166

104-
Maintainer
105-
~~~~~~~~~~
167+
- `Sygel <https://www.sygel.es>`__:
106168

107-
This module is maintained by Sygel.
169+
- Manuel Regidor
170+
- Valentin Vinagre
171+
- Harald Panten
172+
- Alberto Martínez
108173

174+
Maintainers
175+
-----------
109176

110-
This module is part of the `Sygel/sy-l10n-spain <https://github.com/sygel-technology/sy-l10n-spain>`_.
177+
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.
111178

112-
To contribute to this module, please visit https://github.com/sygel-technology.
179+
You are welcome to contribute.

payment_ceca/i18n/es.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ msgstr ""
6262
#. module: payment_ceca
6363
#: code:addons/payment_ceca/models/payment_transaction.py:0
6464
#, python-format
65-
msgid "Ceca: No transaction found matching reference {}."
66-
msgstr "CECA: No se encuentra la transacción con referencia {}."
65+
msgid "Ceca: No transaction found matching reference %(ref)s."
66+
msgstr "CECA: No se encuentra la transacción con referencia %(ref)s."
6767

6868
#. module: payment_ceca
6969
#: model:ir.model.fields,field_description:payment_ceca.field_payment_acquirer__ceca_force_apple
@@ -114,8 +114,8 @@ msgstr "Proveedor"
114114
#. module: payment_ceca
115115
#: code:addons/payment_ceca/models/payment_transaction.py:0
116116
#, python-format
117-
msgid "Received data with missing Num_operacion"
118-
msgstr "Se ha recibidio información sin Num_operacion"
117+
msgid "Ceca: Received data with missing Num_operacion"
118+
msgstr "CECA: Se ha recibidio información sin Num_operacion"
119119

120120
#. module: payment_ceca
121121
#: model:ir.actions.server,name:payment_ceca.cron_sqs_ceca_action_run_ir_actions_server
@@ -138,7 +138,7 @@ msgstr "El cliente ha seleccionado {} para hacer el pago."
138138
#. module: payment_ceca
139139
#: code:addons/payment_ceca/models/payment_transaction.py:0
140140
#, python-format
141-
msgid "Transaction {} could not be validated."
141+
msgid "Ceca: Transaction %(ref)s could not be validated."
142142
msgstr "La transacción {} no se pudo validar."
143143

144144
#. module: payment_ceca

payment_ceca/models/payment_acquirer.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from odoo import _, api, fields, models
77
from odoo.exceptions import ValidationError
88

9-
from odoo.addons.payment_ceca.controllers.main import PaymentTransacionCecaController
9+
from ..controllers.main import PaymentTransacionCecaController
1010

1111

1212
class PaymentAcquirer(models.Model):
@@ -21,25 +21,13 @@ def _get_ceca_url(self, env):
2121
provider = fields.Selection(
2222
selection_add=[("ceca", "Ceca")], ondelete={"ceca": "set default"}
2323
)
24-
ceca_acquirer_bin = fields.Char(
25-
string="Ceca Acquirer Bin", required_if_provider="ceca"
26-
)
27-
ceca_merchant_id = fields.Char(
28-
string="Ceca Merchant Id", required_if_provider="ceca"
29-
)
30-
ceca_terminal_id = fields.Char(
31-
string="Ceca Terminal Id", required_if_provider="ceca"
32-
)
33-
ceca_business_name = fields.Char(
34-
string="Ceca Business Name", required_if_provider="ceca"
35-
)
36-
ceca_encriptation_key = fields.Char(
37-
string="Ceca Encriptation Key", required_if_provider="ceca"
38-
)
39-
ceca_exponente = fields.Char(string="Ceca Exponente", required_if_provider="ceca")
40-
ceca_tipo_moneda = fields.Char(
41-
string="Ceca Tipo Moneda", required_if_provider="ceca"
42-
)
24+
ceca_acquirer_bin = fields.Char()
25+
ceca_merchant_id = fields.Char()
26+
ceca_terminal_id = fields.Char()
27+
ceca_business_name = fields.Char()
28+
ceca_encriptation_key = fields.Char()
29+
ceca_exponente = fields.Char()
30+
ceca_tipo_moneda = fields.Char()
4331
ceca_force_bizum = fields.Boolean(string="Force Bizum")
4432
ceca_force_card = fields.Boolean(string="Force Card")
4533
ceca_force_google = fields.Boolean(string="Force Google Pay")

payment_ceca/models/payment_transaction.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ def _get_tx_from_feedback_data(self, provider, data):
2525
return tx
2626
reference = data.get("Num_operacion")
2727
if not reference:
28-
raise ValidationError(
29-
"Ceca: " + _("Received data with missing Num_operacion")
30-
)
28+
raise ValidationError(_("Ceca: Received data with missing Num_operacion"))
3129
tx = self.sudo().search(
3230
[
3331
("provider", "=", "ceca"),
@@ -38,7 +36,8 @@ def _get_tx_from_feedback_data(self, provider, data):
3836
)
3937
if not tx:
4038
raise ValidationError(
41-
_("Ceca: No transaction found matching reference {}.".format(reference))
39+
_("Ceca: No transaction found matching reference %(ref)s.")
40+
% {"ref": reference}
4241
)
4342
return tx
4443

@@ -58,18 +57,19 @@ def _process_feedback_data(self, data):
5857
try:
5958
self.sudo()._set_done()
6059
self.sudo().write({"acquirer_reference": data.get("Referencia")})
61-
except Exception:
60+
except Exception as e:
6261
raise ValidationError(
63-
"Ceca: "
64-
+ _("Transaction {} could not be validated.".format(data.reference))
65-
)
62+
_("Ceca: Transaction %(ref)s could not be validated.")
63+
% {"ref": data.reference}
64+
) from e
6665

6766
def _get_specific_rendering_values(self, processing_values):
6867
"""Override of payment to return ceca-specific rendering values.
6968
7069
Note: self.ensure_one() from `_get_processing_values`
7170
72-
:param dict processing_values: The generic and specific processing values of the transaction
71+
:param dict processing_values: The generic and specific processing values
72+
of the transaction
7373
:return: The dict of acquirer-specific processing values
7474
:rtype: dict
7575
"""
@@ -87,9 +87,7 @@ def _get_sent_message(self):
8787
"""
8888
message = super()._get_sent_message()
8989
if self.provider == "ceca":
90-
message = _(
91-
"The customer has selected {} to make the payment.".format(
92-
self.acquirer_id.name
93-
),
94-
)
90+
message = _("The customer has selected %(p_name)s to make the payment.") % {
91+
"p_name": self.acquirer_id.name
92+
}
9593
return message

0 commit comments

Comments
 (0)