Skip to content

Commit

Permalink
[ADD] payment_monetico
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Apr 10, 2024
1 parent d18fefd commit a8b65ee
Show file tree
Hide file tree
Showing 18 changed files with 1,164 additions and 0 deletions.
79 changes: 79 additions & 0 deletions payment_monetico/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
=========================
Monetico Payment Acquirer
=========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:91e6c262ca7224be33209224b2b47eb7926fdf58181691b6a4615aded5a21674
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--france-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-france/tree/14.0/payment_monetico
:alt: OCA/l10n-france
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-france-14-0/l10n-france-14-0-payment_monetico
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-france&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Payment Acquirer for `Monetico <https://www.monetico-paiement.fr/>`_ french payment gateway.


**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-france/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/OCA/l10n-france/issues/new?body=module:%20payment_monetico%0Aversion:%2014.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
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* `Akretion <https://www.akretion.com>`_:

* Florian Mounier

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-france <https://github.com/OCA/l10n-france/tree/14.0/payment_monetico>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions payment_monetico/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
21 changes: 21 additions & 0 deletions payment_monetico/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Monetico Payment Acquirer",
"summary": "Accept payments with Monetico secure payment gateway.",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"category": "Accounting",
"author": "Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-france",
"depends": ["payment"],
"data": [
"views/payment_views.xml",
"views/payment_monetico_templates.xml",
"data/payment_acquirer_data.xml",
],
"images": ["static/description/icon.png"],
"installable": True,
}
1 change: 1 addition & 0 deletions payment_monetico/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
73 changes: 73 additions & 0 deletions payment_monetico/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2024 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging
import pprint

import werkzeug

from odoo import http
from odoo.http import request

_logger = logging.getLogger(__name__)


class MoneticoController(http.Controller):
_notify_url = "/payment/monetico/webhook/"
_return_url = "/payment/monetico/return/"

def monetico_validate_data(self, **post):
monetico = request.env["payment.acquirer"].search(
[("provider", "=", "monetico")], limit=1
)
values = dict(post)
shasign = values.pop("MAC", False)
if shasign.upper() != monetico._monetico_generate_shasign(values).upper():
_logger.debug("Monetico: validated data")
return (
request.env["payment.transaction"]
.sudo()
.form_feedback(post, "monetico")
)
_logger.warning("Monetico: data are corrupted")
return False

@http.route(
"/payment/monetico/webhook/",
type="http",
auth="public",
methods=["POST"],
csrf=False,
)
def monetico_webhook(self, **post):
"""Monetico IPN."""
_logger.info(
"Beginning Monetico IPN form_feedback with post data %s",
pprint.pformat(post),
)
if not post:
_logger.warning("Monetico: received empty notification; skip.")
else:
self.monetico_validate_data(**post)
return ""

@http.route(
"/payment/monetico/return",
type="http",
auth="public",
methods=["POST"],
csrf=False,
save_session=False,
)
def monetico_return(self, **post):
"""Monetico DPN."""
try:
_logger.info(
"Beginning Monetico DPN form_feedback with post data %s",
pprint.pformat(post),
)
self.monetico_validate_data(**post)
except Exception:
pass
return werkzeug.utils.redirect("/payment/process")
24 changes: 24 additions & 0 deletions payment_monetico/data/payment_acquirer_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2024 Akretion (http://www.akretion.com).
@author Florian Mounier <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data noupdate="0">

<record id="payment_acquirer_monetico" model="payment.acquirer">
<field name="name">Monetico</field>
<field
name="image_128"
type="base64"
file="payment_monetico/static/src/img/logo.png"
/>
<field name="provider">monetico</field>
<field name="state">test</field>
<field name="company_id" ref="base.main_company" />
<field name="view_template_id" ref="payment_monetico.monetico_form" />
</record>

</data>
</odoo>
1 change: 1 addition & 0 deletions payment_monetico/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import payment
Loading

0 comments on commit a8b65ee

Please sign in to comment.