-
-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
36 changed files
with
4,358 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
======================= | ||
Pasarela de pago Redsys | ||
======================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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%2Fl10n--spain-lightgray.png?logo=github | ||
:target: https://github.com/OCA/l10n-spain/tree/15.0/payment_redsys | ||
:alt: OCA/l10n-spain | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/l10n-spain-15-0/l10n-spain-15-0-payment_redsys | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-spain&target_branch=15.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Este módulo añade la opción de pago a través de la pasarela de Redsys, pudiendo | ||
seleccionar entre los métodos de pago: pago con tarjeta, pago por transferencia, | ||
domiciliación y Bizum. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
Para utilizar este módulo, necesita la biblioteca `pycryptodome | ||
<https://pypi.python.org/pypi/pycryptodome>`_ instalada en su sistema:: | ||
|
||
pip3 install pycryptodome | ||
|
||
Configuration | ||
============= | ||
|
||
Parámetros | ||
~~~~~~~~~~ | ||
|
||
* **Nombre del comercio**: Indicaremos el nombre del comercio. | ||
|
||
* **Número de comercio (FUC)**: Indicaremos el número de comercio que | ||
nuestra entidad nos ha comunicado. | ||
|
||
* **Clave secreta de encriptación**: Indicaremos la clave de encriptación | ||
que tiene el comercio. | ||
|
||
* **Número de terminal**: Indicaremos el terminal del TPV. | ||
|
||
* **Tipo de firma**: Seleccionaremos el tipo de firma del comercio. | ||
|
||
* **Tipo de moneda**: Seleccionaremos la moneda de nuestro terminal TPV | ||
(Normalmente EUR - Euros). | ||
|
||
* **Tipo de transacción**: Indicaremos el tipo de transacción, 0. | ||
|
||
* **Idioma TPV**: Indicaremos el idioma en el TPV. | ||
|
||
* **Método de pago**: Indicaremos qué tipo de pago se debe aceptar, pago con | ||
tarjeta, Bizum u otro de los disponibles. | ||
|
||
* **Porcentaje de pago**: Indicar el porcentaje de pago que se permite, si | ||
se deja a 0.0 se entiende 100%. | ||
|
||
Nota | ||
~~~~ | ||
|
||
Se tiene que verificar la configuración del comercio en el | ||
módulo de administración de Redsys, donde la opción “Parámetros en las | ||
URLs” debe tener el valor “SI”. | ||
|
||
En caso de que exista más de una base de datos en la instalación, cuando la | ||
pasarela de pago envía el formulario a "/payment/redsys/return" odoo no sabe | ||
con que base de datos procesar esta información, por lo que hay que establecer | ||
los parametros **dbfilter** y **dbname** en el archivo de configuración. | ||
|
||
Para mostrar simultáneamente en el comercio electrónico varios de los métodos | ||
de pago que proporciona Redsys, como pago con tarjeta y Bizum por ejemplo, | ||
debemos duplicar el medio de pago y escoger en el campo método de pago el que | ||
corresponda en cada caso. | ||
|
||
En el caso de Bizum, el titular del TPV deberá solicitar al banco su activación. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
De acuerdo a los requisitos de Redsys, el tamaño máximo del número de pedido | ||
resultante (``Ds_Order``) es de 12 caracteres. Este addon trunca dicho | ||
dato en el comienzo de la transacción, con el resultado de que, aunque Redsys | ||
la aceptará, no se finalizará el pedido pedido en Odoo al retornar y entregará | ||
un Error 500 a Redsys. | ||
Para evitar esto, es recomendable seleccionar secuencias de pedido que se | ||
ajusten a esta limitación, en particular de 10 o menos caracteres, al ser la | ||
referencia un número extendido a partir del pedido, que incluye un guion y un | ||
número secuencial para posibles repeticiones de pago. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/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 <https://github.com/OCA/l10n-spain/issues/new?body=module:%20payment_redsys%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 | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Sergio Teruel | ||
* Carlos Dauden | ||
* Carlos Roca | ||
* João Marques | ||
|
||
* Isaac Gallart <[email protected]> | ||
|
||
* `Acysos S.L. <https://www.acysos.com>`_: | ||
|
||
* Ignacio Ibeas <[email protected]> | ||
|
||
* `Planes Asesoria y Soluciones Informaticas S.L. <https://www.planesnet.com>`_: | ||
|
||
* Luis Planes <[email protected]> | ||
|
||
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/l10n-spain <https://github.com/OCA/l10n-spain/tree/15.0/payment_redsys>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import models | ||
from . import controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2017 Tecnativa - Sergio Teruel | ||
# Copyright 2020 Tecnativa - João Marques | ||
|
||
{ | ||
"name": "Pasarela de pago Redsys", | ||
"category": "Payment Acquirer", | ||
"summary": "Payment Acquirer: Redsys Implementation", | ||
"version": "15.0.1.0.0", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/l10n-spain", | ||
"depends": ["payment", "website_sale"], | ||
"external_dependencies": {"python": ["pycryptodome"]}, | ||
"data": [ | ||
"views/payment_acquirer.xml", | ||
"views/payment_redsys_templates.xml", | ||
"data/payment_redsys.xml", | ||
], | ||
"license": "AGPL-3", | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2016-2017 Tecnativa - Sergio Teruel | ||
# Copyright 2019 Ignacio Ibeas <[email protected]> | ||
# Copyright 2023 Planesnet - Luis Planes, Laia Espinosa, Raul Solana | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
import logging | ||
import pprint | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class RedsysController(http.Controller): | ||
_return_url = "/payment/redsys/return" | ||
_cancel_url = "/payment/redsys/cancel" | ||
_exception_url = "/payment/redsys/error" | ||
_reject_url = "/payment/redsys/reject" | ||
|
||
@http.route( | ||
[ | ||
"/payment/redsys/return", | ||
"/payment/redsys/cancel", | ||
"/payment/redsys/error", | ||
"/payment/redsys/reject", | ||
], | ||
type="http", | ||
auth="public", | ||
csrf=False, | ||
) | ||
def redsys_return(self, **post): | ||
"""Redsys.""" | ||
_logger.info( | ||
"Redsys: entering form_feedback with post data %s", pprint.pformat(post) | ||
) | ||
if post: | ||
request.env["payment.transaction"].sudo()._handle_feedback_data( | ||
"redsys", post | ||
) | ||
return request.redirect("/payment/status") | ||
|
||
@http.route( | ||
["/payment/redsys/result/<page>"], | ||
type="http", | ||
auth="public", | ||
methods=["GET"], | ||
website=True, | ||
) | ||
def redsys_result(self, page, **vals): | ||
return request.redirect("/payment/status") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2016-2017 Tecnativa - Sergio Teruel | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3). --> | ||
<odoo noupdate="1"> | ||
<record id="payment_acquirer_redsys" model="payment.acquirer"> | ||
<field name="name">Redsys</field> | ||
<field | ||
name="image_128" | ||
type="base64" | ||
file="payment_redsys/static/description/icon.png" | ||
/> | ||
<field name="provider">redsys</field> | ||
<field name="company_id" ref="base.main_company" /> | ||
<field name="redirect_form_view_id" ref="redsys_form" /> | ||
<field name="redsys_merchant_name">Bussines name</field> | ||
<field name="redsys_merchant_code">8888888</field> | ||
<field name="redsys_merchant_description">Bussines description</field> | ||
<field name="redsys_secret_key">xxxxxxxxxxxx -- SHA256</field> | ||
<field name="description" type="html"> | ||
<field name="module_id" ref="base.module_payment_redsys" /> | ||
<p> | ||
A payment gateway to accept online payments via credit cards. | ||
</p> | ||
<ul> | ||
<li><i class="fa fa-check" />eCommerce</li> | ||
</ul> | ||
</field> | ||
<field | ||
name="pre_msg" | ||
><![CDATA[ | ||
<p>You will be redirected to the Redsys payment gateway after clicking on the payment button.</p>]]></field> | ||
</record> | ||
<record id="payment_icon_cc_bizum" model="payment.icon"> | ||
<field name="name">Bizum</field> | ||
<field name="image" type="base64" file="payment_redsys/static/img/bizum.png" /> | ||
</record> | ||
|
||
<record id="payment_method_redsys" model="account.payment.method"> | ||
<field name="name">Redsys</field> | ||
<field name="code">redsys</field> | ||
<field name="payment_type">inbound</field> | ||
</record> | ||
|
||
</odoo> |
Oops, something went wrong.