Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions payment_ceca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=====================
Ceca Payment Acquirer
=====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7e4250f952ad77cb10f792023ee97871e1d0f2c687ee37d26b40ad8463763258
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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-sygel--technology%2Fsy--l10n--spain-lightgray.png?logo=github
:target: https://github.com/sygel-technology/sy-l10n-spain/tree/15.0/payment_ceca
:alt: sygel-technology/sy-l10n-spain

|badge1| |badge2| |badge3|

This modules allows to use CECA payment acquirer.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, both you and your customer must configure Odoo
and the CECA portal platform.

Both platforms must be correctly interconnected and must use the same
credentials to ensure proper communication.

Configure Odoo
--------------

To configure this module, you need configure the CECA payment Acquirer.
For that, to go to Invoicing > Configuration > Payment Acquirers and
select Ceca. The following values need to be set in the Credentials tab:

1. Ceca Acquirer Bin. It can be found in the ceca portal.
2. Ceca Merchant Id. It can be found in the ceca portal.
3. Cerca Terminal Id. It can be found in the ceca portal.
4. Ceca Business Name. It can be found in the ceca portal.
5. Ceca Encriptation Key. It can be found in the ceca portal.
6. Ceca Exponente.
7. Ceca Tipo de Moneda.

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.

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:

- Disabled. The payment acquirer is not available.

- Enabled. The payment acquirer is available both in test and
production environment.

- Test Mode. The payment acquierer is only available for testing.

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.

Configure the CECA portal
-------------------------

You would also need to make some configurations on your CECA portal to
ensure the compatibility with this module. Specifically, you must inform
CECA of the URL on your server corresponding to the endpoint provided by
this module to mark a payment as completed. To do that, you must go to
the "Configuración Comunicación Online" of your TPV Portal and fill the
following options:

- Comunicación on-line OK: Si
- URL online OK: http://<your_server_domain>/payment/ceca/notify/.
Example: https://www.sygel.es/payment/ceca/notify
- Respuesta requerida OK: No

You can see an example in the image located in this module at
static/src/img/ceca_config.png to see how to configure CECA on its
portal

For more information about how to configure the CECA payment, you can
refer to the CECA manual.

|image|

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

Usage
=====

To use this module, you need to create an order and pay it using the
CECA method. The detailed steps are explained below:

1. Create an order and go to its payment view on the portal or website
shop. For example, you can create a Sale Order, and click on Action /
Generate a Paymnent link. Select the CECA payment acquirer, and go to
the provided link. Note: 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

2. In the payment view, review the corresponding fields and click on the
Pay button.

3. You would be redirected to the payment gateway. Fill the fields and
confirm the payment. If the CECA acquirer is in test mode, you can
use CECA's test credentials; if not, a real credit card needs to be
used.

4. Once the payment is confirmed, you would be redirected again to
Odoo's payment view. Then, the transaction will be changed to the
'Done' state. If an error occurs, the transaction will be cancelled.

IMPORTANT: When a previously confirmed transaction is canceled, the
payment needs to be canceled too. The payment can be accessed from the
transaction form view.

Known issues / Roadmap
======================

- It only works with serial numbers, not lots.
- Unit tests should be added in the next versions of this module
- The payment acquirer has fields written in spanish. That sould be
changed in the next versions of this module.

Bug Tracker
===========

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

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

Credits
=======

Authors
-------

* Sygel

Contributors
------------

- `Sygel <https://www.sygel.es>`__:

- Manuel Regidor
- Valentin Vinagre
- Harald Panten
- Alberto Martínez

Maintainers
-----------

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.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions payment_ceca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
from . import controllers
22 changes: 22 additions & 0 deletions payment_ceca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Ceca Payment Acquirer",
"version": "15.0.1.0.0",
"category": "Payment",
"website": "https://github.com/sygel-technology/sy-l10n-spain",
"author": "Sygel, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"account",
"payment",
"sale",
],
"data": [
"views/payment_ceca_templates.xml",
"views/payment_acquirer_view.xml",
"data/payment_ceca_data.xml",
],
"installable": True,
}
4 changes: 4 additions & 0 deletions payment_ceca/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import main
54 changes: 54 additions & 0 deletions payment_ceca/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import logging

from odoo import http
from odoo.http import request

_logger = logging.getLogger(__name__)


class PaymentTransacionCecaController(http.Controller):

_return_url = "/payment/ceca/feedback"
_error_url = "/payment/ceca/error"
_transaction_answer_url = "/payment/ceca/notify"

@http.route(_return_url, type="http", auth="public", methods=["GET"], website=True)
def ceca_form_feedback(self, **post):
return request.redirect("/payment/status")

@http.route(_error_url, type="http", auth="public", methods=["GET"], website=True)
def ceca_form_error(self, **post):
if post.get("transaction"):
_logger.info(
"Cancelling CECA Transaction {}.".format(post.get("transaction"))
)
transaction = (
request.env["payment.transaction"]
.sudo()
.search(
[
("provider", "=", "ceca"),
("reference", "=", post.get("transaction")),
("state", "=", "draft"),
],
limit=1,
)
)
if transaction:
transaction._set_canceled()
return request.redirect("/payment/status")

@http.route(
_transaction_answer_url,
type="http",
auth="public",
methods=["POST"],
csrf=False,
)
def ceca_notify(self, **post):
_logger.info("CECA Online Notification: {}".format(post))
request.env["payment.transaction"]._handle_feedback_data("ceca", post)
return "success"
32 changes: 32 additions & 0 deletions payment_ceca/data/payment_ceca_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="payment_acquirer_ceca" model="payment.acquirer">
<field name="name">Ceca</field>
<field name="provider">ceca</field>
<field
name="image_128"
type="base64"
file="payment_ceca/static/src/img/ceca_icon.png"
/>
<field name="description" type="html">
<p>
CECA Virtual TPV.
</p>
</field>
<field name="redirect_form_view_id" ref="ceca_acquirer_button" />
<field name="ceca_acquirer_bin">XXXXXXXXXX</field>
<field name="ceca_merchant_id">XXXXXXXXXX</field>
<field name="ceca_terminal_id">XXXXXXXXXX</field>
<field name="ceca_business_name">XXXXX</field>
<field name="ceca_encriptation_key">XXXXXXXX</field>
<field name="ceca_exponente">0</field>
<field name="ceca_tipo_moneda">0</field>
</record>
<record id="payment_method_ceca" model="account.payment.method">
<field name="name">Ceca</field>
<field name="code">ceca</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
Binary file not shown.
Loading