Skip to content
Open
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
4 changes: 2 additions & 2 deletions payment_lyra/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

{
'name': 'Lyra Collect Payment Provider',
'version': '4.2.0',
'version': '18.0.4.2.2',
'summary': 'Accept payments with Lyra Collect secure payment gateway.',
'category': 'Accounting/Payment Providers',
'author': 'Lyra Network',
'website': 'https://www.lyra.com/',
'license': 'AGPL-3',
'depends': ['payment'],
'depends': ['payment','sale'],
'data': [
'views/payment_provider_views.xml',
'views/payment_lyra_templates.xml',
Expand Down
26 changes: 13 additions & 13 deletions payment_lyra/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@
}

LYRA_LANGUAGES = {
'cn': _lt("Chinese"),
'de': _lt("German"),
'es': _lt("Spanish"),
'en': _lt("English"),
'fr': _lt("French"),
'it': _lt("Italian"),
'jp': _lt("Japanese"),
'nl': _lt("Dutch"),
'pl': _lt("Polish"),
'pt': _lt("Portuguese"),
'ru': _lt("Russian"),
'sv': _lt("Swedish"),
'tr': _lt("Turkish"),
'cn': "Chinese",
'de': "German",
'es': "Spanish",
'en': "English",
'fr': "French",
'it': "Italian",
'jp': "Japanese",
'nl': "Dutch",
'pl': "Polish",
'pt': "Portuguese",
'ru': "Russian",
'sv': "Swedish",
'tr': "Turkish",
}

LYRA_CARDS = {
Expand Down
2 changes: 1 addition & 1 deletion payment_lyra/helpers/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def generate_trans_id():
return str(delta).rjust(6, '0')

def lang_translate(callback, v):
return _(v)
return v

def check_hash(post, key):
return hmac.new(key.encode("utf-8"), eval(json.dumps(post, ensure_ascii=False)).get("kr-answer").encode("utf-8"), hashlib.sha256).hexdigest() == eval(json.dumps(post, ensure_ascii=False)).get("kr-hash")
Expand Down
11 changes: 6 additions & 5 deletions payment_lyra/models/payment_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def _lyra_compute_multi_warning(self):
for provider in self:
provider.lyra_multi_warning = (constants.LYRA_PLUGIN_FEATURES.get('restrictmulti') == True) if (provider.code == 'lyramulti') else False

@staticmethod
def lyra_get_doc_field_value():
docs_uri = constants.LYRA_ONLINE_DOC_URI
doc_field_html = ''
Expand All @@ -65,7 +66,7 @@ def _get_entry_modes(self):
return [(c, l) for c, l in modes.items()]

def _get_default_entry_mode(self):
module_upgrade = request.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')])
module_upgrade = self.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')])
if module_upgrade:
return ("redirect")

Expand Down Expand Up @@ -123,7 +124,7 @@ def _get_default_entry_mode(self):
lyra_embedded_compact_mode = fields.Selection(string='Compact mode', help='This option allows to display the embedded payment fields in a compact mode.', selection=[('0', 'Disabled'), ('1', 'Enabled')], default='0')
lyra_embedded_payment_attempts = fields.Char(string='Payment attempts number for cards', help='Maximum number of payment by cards retries after a failed payment (between 0 and 2). If blank, the gateway default value is 2.')

image = fields.Char()
image = fields.Char("Image (OSB)")
environment = fields.Char()

lyra_redirect = False
Expand All @@ -144,7 +145,7 @@ def _get_compatible_providers(self, *args, currency_id=None, **kwargs):
@api.model
def multi_add(self, filename, noupdate):
if (constants.LYRA_PLUGIN_FEATURES.get('multi') == True):
module_upgrade = request.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')])
module_upgrade = self.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')])
file = path.join(path.dirname(path.dirname(path.abspath(__file__)))) + filename
mode = 'update' if module_upgrade else 'init'
convert_xml_import(self.env, 'payment_lyra', file, None, mode, noupdate)
Expand Down Expand Up @@ -272,7 +273,7 @@ def lyra_form_generate_values(self, values):
return lyra_tx_values

def lyra_generate_values_from_order(self, data):
sale_order = request.env['sale.order'].sudo().search([('id', '=', data['order_id'])]).exists()
sale_order = self.env['sale.order'].sudo().search([('id', '=', data['order_id'])]).exists()

currency = self._lyra_get_currency(data['currency_id'])
amount = float(sale_order.amount_total)
Expand Down Expand Up @@ -420,7 +421,7 @@ def _lyra_get_currency(self, currency_id):
def _lyra_get_inline_form_values(
self, amount, currency, partner_id, is_validation, payment_method_sudo, sale_order_id, **kwargs
):
sale_order = request.env['sale.order'].sudo().search([('id', '=', sale_order_id)]).exists()
sale_order = self.env['sale.order'].sudo().search([('id', '=', sale_order_id)]).exists()
values = {
"provider_id": self.id,
"provider_code" : "lyra",
Expand Down
2 changes: 1 addition & 1 deletion payment_lyra/views/payment_lyra_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</template>

<template id="lyra_inline_embedded">
<t t-set="payment_provider_model" t-value="request.env['payment.provider'].search([('code', '=', 'lyra')])[0]" />
<t t-set="payment_provider_model" t-value="request.env['payment.provider'].sudo().search([('code', '=', 'lyra')])[0]" />
<t t-set="inline_form_values"
t-value="payment_provider_model._lyra_get_inline_form_values(
amount,
Expand Down
2 changes: 1 addition & 1 deletion payment_lyra/views/payment_provider_views_multi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<field name="inherit_id" ref="payment.payment_provider_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='lyra_gateway_access']" position="before">
<field name="lyra_multi_warning" invisible="1"/>
<field name="lyra_multi_warning" invisible="1"/><!--required by OSB -->
<div style="background: none repeat scroll 0 0 #FFFFE0; border: 1px solid #E6DB55; font-size: 13px; margin: 0 0 20px; padding: 10px;"
invisible="code != 'lyramulti' or lyra_multi_warning == False">
<p>
Expand Down