Skip to content

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alima Grine committed Dec 15, 2022
2 parents 9dd6eb7 + 47161bd commit f650830
Show file tree
Hide file tree
Showing 22 changed files with 243 additions and 600 deletions.
16 changes: 2 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
2.0.3, 2022-06-14
3.0.0, 2022-12-15
=============
- Fix invoice payment with payment links.

2.0.2, 2022-06-07
=============
- Update list of supported payment means.

2.0.1, 2022-04-14
=============
- Fix the management of empty customer state.

2.0.0, 2022-02-10
=============
- New plugin for Odoo 15.
- New plugin for Odoo 16.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ can choose one of these instructions:

In your Odoo administrator interface, browse to "Applications" tab, delete "Applications" filter from
search field and search for "lyra" keyword. Click "Install" (or "Upgrade") button of the "Lyra Collect
Payment Acquirer" module.
Payment Provider" module.

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

* Go to "Website Admin" tab.
* In "Configuration" section, expand "eCommerce" menu than click on "Payment Acquirers" entry.
* In "Configuration" section, expand "eCommerce" menu than click on "Payment Providers" entry.
* Click on button "Configure" of Lyra Collect module.
* You can now enter your Lyra Collect credentials.

Expand Down
11 changes: 6 additions & 5 deletions payment_lyra/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
# License: http://www.gnu.org/licenses/agpl.html GNU Affero General Public License (AGPL v3)

{
'name': 'Lyra Collect Payment Acquirer',
'version': '2.0.3',
'name': 'Lyra Collect Payment Provider',
'version': '3.0.0',
'summary': 'Accept payments with Lyra Collect secure payment gateway.',
'category': 'Accounting/Payment Acquirers',
'category': 'Accounting/Payment Providers',
'author': 'Lyra Network',
'website': 'https://www.lyra.com/',
'license': 'AGPL-3',
'depends': ['payment'],
'data': [
'views/payment_views.xml',
'views/payment_provider_views.xml',
'views/payment_lyra_templates.xml',
'data/payment_acquirer_data.xml',
'data/payment_icon_data.xml',
'data/payment_provider_data.xml',
'security/ir.model.access.csv',
],
'images': ['static/description/icon.png'],
Expand Down
41 changes: 32 additions & 9 deletions payment_lyra/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,55 @@

from odoo import http, release
from odoo.http import request
from odoo.exceptions import ValidationError

_logger = logging.getLogger(__name__)

class LyraController(http.Controller):
_notify_url = '/payment/lyra/ipn'
_return_url = '/payment/lyra/return'

def _get_return_url(self, result, **post):
return_url = post.pop('return_url', '')
def _get_return_url(self, result, **pdt_data):
return_url = pdt_data.pop('return_url', '')

if not return_url:
return_url = '/payment/process' if result else '/shop/cart'

return return_url

@http.route('/payment/lyra/return', type='http', auth='public', methods=['POST', 'GET'], csrf=False)
def lyra_return(self, **post):
@http.route(
_return_url, type='http', auth='public', methods=['POST', 'GET'], csrf=False,
save_session=False
)
def lyra_return_from_checkout(self, **pdt_data):
# Check payment result and create transaction.
_logger.info('Lyra Collect: entering _handle_feedback with post data %s', pprint.pformat(post))
request.env['payment.transaction'].sudo()._handle_feedback_data('lyra', post)
_logger.info('Lyra Collect: entering _from_notification with data %s', pprint.pformat(pdt_data))

try:
# Check the origin of the notification
tx_sudo = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('lyra', pdt_data)

# Handle the notification data
tx_sudo._handle_notification_data('lyra', pdt_data)
except ValidationError:
_logger.exception("Lyra Collect: Unable to handle the return notification data; skipping to acknowledge.")

return request.redirect('/payment/status')

@http.route('/payment/lyra/ipn', type='http', auth='public', methods=['POST'], csrf=False)
@http.route(_notify_url, type='http', auth='public', methods=['POST'], csrf=False,
save_session=False
)
def lyra_ipn(self, **post):
# Check payment result and create transaction.
_logger.info('Lyra Collect: entering IPN _handle_feedback with post data %s', pprint.pformat(post))
result = request.env['payment.transaction'].sudo()._handle_feedback_data('lyra', post)
_logger.info('Lyra Collect: entering IPN _get_tx_from_notification with post data %s', pprint.pformat(post))

try:
result = request.env['payment.transaction'].sudo()._get_tx_from_notification_data('lyra', post)

# Handle the notification data
result._handle_notification_data('lyra', post)
except ValidationError: #Acknowledge the notification to avoid getting spammed
_logger.exception("Lyra Collect: Unable to handle the IPN notification data; skipping to acknowledge.")
return 'Bad request received.'

return 'Accepted payment, order has been updated.' if result else 'Payment failure, order has been cancelled.'
31 changes: 31 additions & 0 deletions payment_lyra/data/payment_icon_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
# Copyright © Lyra Network.
# This file is part of Lyra Collect plugin for Odoo. See COPYING.md for license details.
#
# Author: Lyra Network (https://www.lyra.com)
# Copyright: Copyright © Lyra Network
# License: http://www.gnu.org/licenses/agpl.html GNU Affero General Public License (AGPL v3)
-->

<odoo>

<record id="payment_icon_cc_lyracb" model="payment.icon">
<field name="sequence">10</field>
<field name="name">Lyra CB</field>
<field name="image" type="base64" file="payment_lyra/static/src/img/cb.png"/>
</record>

<record id="payment_icon_cc_lyravisa" model="payment.icon">
<field name="sequence">20</field>
<field name="name">Lyra Visa</field>
<field name="image" type="base64" file="payment_lyra/static/src/img/visa.png"/>
</record>

<record id="payment_icon_cc_lyramastercard" model="payment.icon">
<field name="sequence">30</field>
<field name="name">Lyra MasterCard</field>
<field name="image" type="base64" file="payment_lyra/static/src/img/mastercard.png"/>
</record>

</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@

<odoo>
<data noupdate="1">
<record id="payment_acquirer_lyra" model="payment.acquirer">
<record id="payment_provider_lyra" model="payment.provider">
<field name="name"><![CDATA[Lyra Collect - Standard payment]]></field>
<field name="display_as">Payment by credit card</field>
<field name="payment_icon_ids"
eval="[(6, 0, [
ref('payment_lyra.payment_icon_cc_lyracb'),
ref('payment_lyra.payment_icon_cc_lyravisa'),
ref('payment_lyra.payment_icon_cc_lyramastercard'),
])]"/>
<field name="image" type="base64" file="payment_lyra/static/src/img/logo.png" />
<field name="image_128" type="base64" file="payment_lyra/static/src/img/logo.png" />
<field name="provider">lyra</field>
<field name="code">lyra</field>
<field name="state">test</field>
<field name="company_id" ref="base.main_company" />
<field name="redirect_form_view_id" ref="lyra_acquirer_button" />
<field name="redirect_form_view_id" ref="lyra_provider_button" />
<field name="environment">test</field>
<field name="pre_msg"><![CDATA[<p>You will be redirected to the Lyra Collect website after clicking on the payment button.</p>]]></field>

Expand All @@ -28,14 +35,6 @@
<field name="lyra_redirect_success_timeout">5</field>
<field name="lyra_redirect_error_timeout">5</field>
<field name="lyra_return_mode">GET</field>

<field name="description" type="html">
<p><![CDATA[Accept payments with Lyra Collect secure payment gateway.]]></p>
<ul class="list-inline">
<li class="list-inline-item"><i class="fa fa-check" />Online Payment</li>
<li class="list-inline-item"><i class="fa fa-check" />eCommerce</li>
</ul>
</field>
</record>

<record id="payment_method_lyra" model="account.payment.method">
Expand All @@ -45,7 +44,7 @@
</record>
</data>

<function model="payment.acquirer" name="multi_add">
<value>/data/payment_acquirer_data_multi.xml</value>
<function model="payment.provider" name="multi_add">
<value>/data/payment_provider_data_multi.xml</value>
</function>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@

<odoo>
<data noupdate="1">
<record id="payment_acquirer_lyramulti" model="payment.acquirer">
<record id="payment_provider_lyramulti" model="payment.provider">
<field name="name"><![CDATA[Lyra Collect - Payment in installments]]></field>
<field name="display_as">Payment by credit card in installments</field>
<field name="payment_icon_ids"
eval="[(6, 0, [
ref('payment_lyra.payment_icon_cc_lyracb'),
ref('payment_lyra.payment_icon_cc_lyravisa'),
ref('payment_lyra.payment_icon_cc_lyramastercard'),
])]"/>
<field name="image" type="base64" file="payment_lyra/static/src/img/logo.png" />
<field name="image_128" type="base64" file="payment_lyra/static/src/img/logo.png" />
<field name="provider">lyramulti</field>
<field name="code">lyramulti</field>
<field name="state">test</field>
<field name="company_id" ref="base.main_company" />
<field name="redirect_form_view_id" ref="lyra_acquirer_button" />
<field name="redirect_form_view_id" ref="lyra_provider_button" />
<field name="environment">test</field>
<field name="pre_msg"><![CDATA[<p>You will be redirected to the Lyra Collect website after clicking on the payment button.</p>]]></field>

Expand All @@ -31,14 +38,6 @@
<field name="lyra_redirect_success_timeout">5</field>
<field name="lyra_redirect_error_timeout">5</field>
<field name="lyra_return_mode">GET</field>

<field name="description" type="html">
<p><![CDATA[Accept payments in installments with Lyra Collect secure payment gateway.]]></p>
<ul class="list-inline">
<li class="list-inline-item"><i class="fa fa-check" />Online Payment</li>
<li class="list-inline-item"><i class="fa fa-check" />eCommerce</li>
</ul>
</field>
</record>

<record id="payment_method_lyramulti" model="account.payment.method">
Expand Down
5 changes: 2 additions & 3 deletions payment_lyra/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
'LANGUAGE': 'en',

'GATEWAY_VERSION': 'V2',
'PLUGIN_VERSION': '2.0.3',
'CMS_IDENTIFIER': 'Odoo_15',
'PLUGIN_VERSION': '3.0.0',
'CMS_IDENTIFIER': 'Odoo_16',
}

LYRA_LANGUAGES = {
Expand Down Expand Up @@ -133,7 +133,6 @@
'ONEY_3X_4X': u'Paiement en 3 ou 4 fois Oney',
'ONEY_ENSEIGNE': u'Cartes enseignes Oney',
'PAYDIREKT': u'Paydirekt',
'PAYLIB': u'Paylib',
'PAYPAL': u'PayPal',
'PAYPAL_SB': u'PayPal Sandbox',
'PICWIC': u'Carte Picwic',
Expand Down
Loading

0 comments on commit f650830

Please sign in to comment.