Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] payment_redsys: Migration to version 15.0 #2968

Merged
merged 39 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
219d21d
[ADD] Nuevo modulo para pagos con tajeta (sermepa-redsys)
sergio-teruel Nov 5, 2014
40a74d8
[DEL] No crear un pago redsys por defecto al instalar
rlizana Jan 5, 2015
16bd5c6
[FIX+IMP] payment_redsys: Descripción + error reference
sergio-teruel Jan 21, 2015
a79877e
[FIX] payment_redsys: New module
pedrobaeza Apr 3, 2015
7a00e50
[IMP] payment_redsys: Migracion a HMAC SHA-256
sergio-teruel Nov 13, 2015
a7f4a43
[FIX] payment_redsys: Renaming class name yields unwanted side effect.
eantones Nov 23, 2015
9e18356
[IMP] payment_redsys: Change payment logo
sergio-teruel Nov 27, 2015
4ef294c
[IMP] payment_redsys: 3 enhancements:
eantones Nov 30, 2015
3bd6ff5
[IMP] payment_redsys: Change card icon in checkout process.
sergio-teruel Nov 30, 2015
3e776e9
[FIX+IMP] payment_redsys: 2 things:
eantones Dec 1, 2015
d6fcda7
[IMP+FIX] payment_redsys: Logo tarjetas + Show order information afte…
sergio-teruel Dec 17, 2015
c03ef82
[IMP] payment_redsys: Add the discount on the order summary
eantones Mar 7, 2016
bad62fa
[IMP][8.0] payment_redsys: Pagar un porcentaje del pedido (#362)
sergio-teruel Aug 21, 2016
60dec04
[MIG] payment_redsys: Migration to v9
sergio-teruel Dec 1, 2016
fded338
[MIG] payment_redsys: Migrated to 10.0
sergio-teruel May 14, 2017
6221efc
[11.0][MIG] payment_redsys: Migration
sergio-teruel Nov 13, 2017
d375a72
[chg] Dependency from abandoned pycrypto to pycryptodome
m1k3lm Apr 8, 2018
54339a2
[FIX] payment_redsys: Fix signature
igallart Jan 24, 2019
627e08a
[IMP] payment_redsys: README by fragments
pedrobaeza Mar 22, 2019
2e21d7f
[12.0][MIG] payment_redsys: Better test coverage
sergio-teruel Apr 1, 2019
5d9fa08
[IMP] payment_redsys: Better status code check
pedrobaeza Feb 9, 2018
8138a39
Translated using Weblate (Spanish)
josepmy Jul 22, 2019
77c9ea8
[FIX] payment_redsys: Process order after gateway payment successful
sergio-teruel Feb 5, 2020
add0097
[IMP] account_multicompany_easy_creation: black, isort, prettier
CarlosRoca13 May 13, 2020
2f33740
[MIG] payment_redsys: Migration to v13.0
CarlosRoca13 May 13, 2020
6c0f552
Translated using Weblate (Spanish)
danimv5 Jul 27, 2020
0238a8f
Translated using Weblate (Catalan)
brendapaniagua Nov 6, 2020
7f00c7a
[FIX+IMP] payment_redsys: Set Merchant titular as billing partner + E…
sergio-teruel Nov 19, 2020
f24dcc5
[MIG] payment_redsys: Migration to 14.0
joao-p-marques Jan 4, 2021
c986107
Translated using Weblate (Catalan)
danimv5 Mar 30, 2021
1d9c1c0
[IMP] payment_redsys: README improvement of DS_Order length limit
dalonsod Apr 28, 2021
d2d869c
[IMP] payment_redsys: Remove send_quotation + module_id in data file
manuelregidor Jul 23, 2021
fe0cb06
[IMP] payment_redsys: add 'Bizum' option to 'redsys_pay_method' field.
azucenatrey Jul 21, 2021
e7c54ad
[IMP] payment_redsys: Put real package on pypi
pedrobaeza Jan 12, 2022
3188cb9
[FIX] payment_redsys: JSON request + wrong reference
chienandalu Jan 26, 2022
3f446cb
[FIX] payment_redsys: Use updated library + black formatting
pedrobaeza Mar 30, 2022
b94331b
[FIX] payment_redsys: feedback error string format
chienandalu Feb 7, 2023
9540742
[IMP] payment_redsys: black, isort
sergio-teruel Mar 23, 2023
e31ff41
[MIG] payment_redsys: Migration to v15.0
sergio-teruel Mar 23, 2023
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
161 changes: 161 additions & 0 deletions payment_redsys/README.rst
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.
4 changes: 4 additions & 0 deletions payment_redsys/__init__.py
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
20 changes: 20 additions & 0 deletions payment_redsys/__manifest__.py
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,
}
1 change: 1 addition & 0 deletions payment_redsys/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
51 changes: 51 additions & 0 deletions payment_redsys/controllers/main.py
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")
44 changes: 44 additions & 0 deletions payment_redsys/data/payment_redsys.xml
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>
Loading