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
3 changes: 3 additions & 0 deletions l10n_mx_edi_extends/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import models
28 changes: 28 additions & 0 deletions l10n_mx_edi_extends/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Part of Ktrine. See LICENSE file for full copyright and licensing details.

{
'name': 'EDI Payment Extension',
'version': '12.0.0.0',
'depends': [
'l10n_mx_edi'
],
'external_dependencies': {},
'author': 'Eduwebgroup',
'website': 'https://www.eduwebgroup.com',
'summary': 'EDI Payment Extension',
'description': """
EDI Payment Extension
""",
'category': 'Hidden',
'data': [
'views/payment_acquirer_views.xml',
],
'qweb': [],
'css': [],
'images': [],
'demo': [],
'installable': True,
'auto_install': False,
'application': True,
}
4 changes: 4 additions & 0 deletions l10n_mx_edi_extends/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-

from . import payment_acquirer
from . import payment_transaction
40 changes: 40 additions & 0 deletions l10n_mx_edi_extends/models/payment_acquirer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-

from odoo import models, fields, api, _


class PaymentAcquirer(models.Model):
######################
# Private attributes #
######################
_inherit = "payment.acquirer"
###################
# Default methods #
###################

######################
# Fields declaration #
######################
l10n_mx_edi_payment_method_id = fields.Many2one(string="Payment Way",
comodel_name="l10n_mx_edi.payment.method")

##############################
# Compute and search methods #
##############################

############################
# Constrains and onchanges #
############################

#########################
# CRUD method overrides #
#########################

##################
# Action methods #
##################

####################
# Business methods #
####################

43 changes: 43 additions & 0 deletions l10n_mx_edi_extends/models/payment_transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-

from odoo import models, fields, api, _


class PaymentTransaction(models.Model):
######################
# Private attributes #
######################
_inherit = "payment.transaction"
###################
# Default methods #
###################

######################
# Fields declaration #
######################

##############################
# Compute and search methods #
##############################

############################
# Constrains and onchanges #
############################

#########################
# CRUD method overrides #
#########################

##################
# Action methods #
##################

####################
# Business methods #
####################
@api.multi
def _prepare_account_payment_vals(self):
self.ensure_one()
res = super(PaymentTransaction, self)._prepare_account_payment_vals()
res["l10n_mx_edi_payment_method_id"] = self.acquirer_id.l10n_mx_edi_payment_method_id.id if self.acquirer_id.l10n_mx_edi_payment_method_id else False,
return res
15 changes: 15 additions & 0 deletions l10n_mx_edi_extends/views/payment_acquirer_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="payment_acquirer_view_form_inherit" model="ir.ui.view">
<field name="name">payment.acquirer.view.form.inherit</field>
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='acquirer_config']" position="inside">
<field name="l10n_mx_edi_payment_method_id"/>
</xpath>
</field>
</record>
</data>
</odoo>
5 changes: 3 additions & 2 deletions payment_affipay/models/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ def _affipay_ecommerce_request(self, url, eager_refresh=False, retries=2, **kwar
"Affipay: Retrying request on %s. (%i retries left)" % (url, retries))
retries -= 1
return self._affipay_ecommerce_request(url, retries=retries, **kwargs)
raise e
err = res_json.get("error", "Error")
err_code = err.get("httpStatusCode", 400)
err_description = err.get(
"description", "Something is wrong with the request")
raise ValidationError("affipay Error: %s %s" % (err_code, err_description))
raise AffipayError("affipay Error: %s %s" % (err_code, err_description))

def _affipay_refresh_access_token(self):
self.ensure_one()
Expand All @@ -226,7 +227,7 @@ def _affipay_refresh_access_token(self):
})
if not data.get("access_token"):
_logger.error(json.dumps(data))
raise ValidationError("No access token given.")
raise AffipayError("No access token given.")
self.affipay_access_token = data.get("access_token")
return self.affipay_access_token

Expand Down
2 changes: 1 addition & 1 deletion payment_affipay/views/payment_affipay_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<input type="text" name="cc_expiry" id="cc_expiry" class="form-control" maxlength="7" placeholder="Expires (MM / YY)" data-is-required="true"/>
</div>
<div t-att-class="'form-group col-md-6 col-lg-2'">
<input type="text" name="cc_cvc" id="cc_cvc" class="form-control" maxlength="4" placeholder="CVC" data-is-required="true"/>
<input type="password" name="cc_cvc" id="cc_cvc" class="form-control" maxlength="4" placeholder="CVC" data-is-required="true"/>
</div>
</div>
</template>
Expand Down