[REF] payment_*: adapt to payment changes

This commit is contained in:
Victor Feyens
2022-09-06 13:32:19 +02:00
parent 61b8c0c1a2
commit 4d6bd1ce33
124 changed files with 180 additions and 525 deletions
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'adyen')
def uninstall_hook(cr, registry):
+1
View File
@@ -15,6 +15,7 @@
'data/payment_acquirer_data.xml', # Depends on views/payment_adyen_templates.xml
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'assets': {
'web.assets_frontend': [
@@ -7,10 +7,4 @@
<field name="allow_tokenization">True</field>
</record>
<record id="payment_method_adyen" model="account.payment.method">
<field name="name">Adyen</field>
<field name="code">adyen</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_token
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['adyen'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -140,12 +140,6 @@ class PaymentAcquirer(models.Model):
"""
return f'ODOO_PARTNER_{partner_id}'
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'adyen':
return super()._get_default_payment_method_id()
return self.env.ref('payment_adyen.payment_method_adyen').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('adyen', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class AdyenCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.adyen = cls._prepare_acquirer('adyen', update_values={
'adyen_merchant_account': 'dummy',
+9 -5
View File
@@ -6,11 +6,7 @@ from . import models
from odoo.exceptions import UserError
from odoo.tools import config
from odoo.addons.payment import reset_payment_acquirer
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'alipay')
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def pre_init_hook(cr):
@@ -18,3 +14,11 @@ def pre_init_hook(cr):
raise UserError(
"This module is deprecated and cannot be installed. "
"Consider installing the Payment Acquirer: AsiaPay module instead.")
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'alipay')
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'alipay')
+1
View File
@@ -14,6 +14,7 @@
],
'application': False,
'pre_init_hook': 'pre_init_hook',
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -19,10 +19,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_alipay" model="account.payment.method">
<field name="name">Alipay</field>
<field name="code">alipay</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['alipay'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -69,12 +69,6 @@ class PaymentAcquirer(models.Model):
else: # test environment
return 'https://openapi.alipaydev.com/gateway.do'
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'alipay':
return super()._get_default_payment_method_id()
return self.env.ref('payment_alipay.payment_method_alipay').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('alipay', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class AlipayCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.currency_yuan = cls._prepare_currency('CNY')
cls.alipay = cls._prepare_acquirer('alipay', update_values={
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'aps')
def uninstall_hook(cr, registry):
+1
View File
@@ -14,6 +14,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_aps" model="account.payment.method">
<field name="name">Amazon Payment Services</field>
<field name="code">aps</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,13 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['aps'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -59,12 +59,6 @@ class PaymentAcquirer(models.Model):
signing_string = ''.join([key, sign_data, key])
return hashlib.sha256(signing_string.encode()).hexdigest()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'aps':
return super()._get_default_payment_method_id()
return self.env.ref('payment_aps.payment_method_aps').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('aps', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.http_common import PaymentHttpCommon
class APSCommon(PaymentHttpCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.aps = cls._prepare_acquirer('aps', update_values={
'aps_merchant_identifier': '123456abc',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'asiapay')
def uninstall_hook(cr, registry):
+1
View File
@@ -15,6 +15,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_asiapay" model="account.payment.method">
<field name="name">AsiaPay</field>
<field name="code">asiapay</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,13 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['asiapay'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -86,12 +86,6 @@ class PaymentAcquirer(models.Model):
shasign.update(signing_string.encode())
return shasign.hexdigest()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'asiapay':
return super()._get_default_payment_method_id()
return self.env.ref('payment_asiapay.payment_method_asiapay').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('asiapay', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class AsiaPayCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.asiapay = cls._prepare_acquirer('asiapay', update_values={
'asiapay_merchant_id': '123456789',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'authorize')
def uninstall_hook(cr, registry):
+1
View File
@@ -14,6 +14,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'assets': {
'web.assets_frontend': [
@@ -7,10 +7,4 @@
<field name="allow_tokenization">True</field>
</record>
<record id="payment_method_authorize" model="account.payment.method">
<field name="name">Authorize.Net</field>
<field name="code">authorize</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_token
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['authorize'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -146,12 +146,6 @@ class PaymentAcquirer(models.Model):
return self.authorize_currency_id
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'authorize':
return super()._get_default_payment_method_id()
return self.env.ref('payment_authorize.payment_method_authorize').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('authorize', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class AuthorizeCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.authorize = cls._prepare_acquirer('authorize', update_values={
'authorize_login': 'dummy',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'buckaroo')
def uninstall_hook(cr, registry):
+1
View File
@@ -14,6 +14,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_buckaroo" model="account.payment.method">
<field name="name">Buckaroo</field>
<field name="code">buckaroo</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['buckaroo'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -64,12 +64,6 @@ class PaymentAcquirer(models.Model):
# Calculate the SHA-1 hash over the signing string
return sha1(sign_string.encode('utf-8')).hexdigest()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'buckaroo':
return super()._get_default_payment_method_id()
return self.env.ref('payment_buckaroo.payment_method_buckaroo').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('buckaroo', ['buckaroo_website_key', 'buckaroo_secret_key'])
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class BuckarooCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.buckaroo = cls._prepare_acquirer('buckaroo', update_values={
'buckaroo_website_key': 'dummy',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'transfer')
def uninstall_hook(cr, registry):
+1
View File
@@ -16,6 +16,7 @@
'payment_custom/static/src/js/post_processing.js',
],
},
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -39,7 +39,16 @@ class PaymentAcquirer(models.Model):
})
def _transfer_ensure_pending_msg_is_set(self):
for acquirer in self.filtered(lambda a: a.provider == 'custom' and not a.pending_msg):
transfer_acquirers_without_msg = self.filtered(
lambda a: a.provider == 'custom' and not a.pending_msg)
if not transfer_acquirers_without_msg:
return
account_payment = self.env['ir.module.module']._get('account_payment')
if account_payment.state != 'installed':
return
for acquirer in transfer_acquirers_without_msg:
company_id = acquirer.company_id.id
# filter only bank accounts marked as visible
accounts = self.env['account.journal'].search([
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'test')
def uninstall_hook(cr, registry):
+1
View File
@@ -16,6 +16,7 @@ It should never be used in production environment. Make sure to disable it befor
'views/payment_transaction_views.xml',
'data/payment_acquirer_data.xml',
],
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'assets': {
'web.assets_frontend': [
@@ -8,10 +8,4 @@
<field name="allow_tokenization">True</field>
</record>
<record id="payment_method_demo" model="account.payment.method">
<field name="name">Demo</field>
<field name="code">demo</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_token
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['demo'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -36,9 +36,3 @@ class PaymentAcquirer(models.Model):
def _check_acquirer_state(self):
if self.filtered(lambda a: a.provider == 'demo' and a.state not in ('test', 'disabled')):
raise UserError(_("Demo acquirers should never be enabled."))
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'demo':
return super()._get_default_payment_method_id()
return self.env.ref('payment_demo.payment_method_demo').id
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class PaymentDemoCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.acquirer = cls._prepare_acquirer(provider='demo')
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'flutterwave')
def uninstall_hook(cr, registry):
@@ -15,6 +15,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -7,10 +7,4 @@
<field name="allow_tokenization">True</field>
</record>
<record id="payment_method_flutterwave" model="account.payment.method">
<field name="name">Flutterwave</field>
<field name="code">flutterwave</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_token
from . import payment_transaction
@@ -1,13 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['flutterwave'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -100,12 +100,6 @@ class PaymentAcquirer(models.Model):
)
return response.json()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'flutterwave':
return super()._get_default_payment_method_id()
return self.env.ref('payment_flutterwave.payment_method_flutterwave').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('flutterwave', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class FlutterwaveCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.flutterwave = cls._prepare_acquirer('flutterwave', update_values={
'flutterwave_public_key': 'FLWPUBK_TEST-abcdef-X',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'mercado_pago')
def uninstall_hook(cr, registry):
@@ -15,6 +15,7 @@
'data/payment_acquirer_data.xml', # Depends on views/payment_mercado_pago_templates.xml
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_mercado_pago" model="account.payment.method">
<field name="name">Mercado Pago</field>
<field name="code">mercado_pago</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['mercado_pago'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -81,13 +81,6 @@ class PaymentAcquirer(models.Model):
)
return response.json()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'mercado_pago':
return super()._get_default_payment_method_id()
return self.env.ref('payment_mercado_pago.payment_method_mercado_pago').id
def _neutralize(self):
super()._neutralize()
+2 -2
View File
@@ -8,8 +8,8 @@ class MercadoPagoCommon(PaymentCommon):
MP_PAYMENT_ID = '1234567890'
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.acquirer = cls._prepare_acquirer('mercado_pago', update_values={
'mercado_pago_access_token': 'TEST-4850554046279901-TEST-TEST',
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'mollie')
def uninstall_hook(cr, registry):
+1
View File
@@ -18,6 +18,7 @@
'data/payment_acquirer_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3'
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_mollie" model="account.payment.method">
<field name="name">Mollie</field>
<field name="code">mollie</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,13 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['mollie'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -38,12 +38,6 @@ class PaymentAcquirer(models.Model):
return acquirers
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'mollie':
return super()._get_default_payment_method_id()
return self.env.ref('payment_mollie.payment_method_mollie').id
def _mollie_make_request(self, endpoint, data=None, method='POST'):
""" Make a request at mollie endpoint.
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class MollieCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.mollie = cls._prepare_acquirer('mollie', update_values={
'mollie_api_key': 'dummy',
+9 -5
View File
@@ -6,11 +6,7 @@ from . import models
from odoo.exceptions import UserError
from odoo.tools import config
from odoo.addons.payment import reset_payment_acquirer
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'ogone')
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def pre_init_hook(cr):
@@ -18,3 +14,11 @@ def pre_init_hook(cr):
raise UserError(
"This module is deprecated and cannot be installed. "
"Consider installing the Payment Acquirer: Stripe module instead.")
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'ogone')
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'ogone')
+1
View File
@@ -14,6 +14,7 @@
],
'application': False,
'pre_init_hook': 'pre_init_hook',
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -21,10 +21,4 @@
<field name="allow_tokenization">True</field>
</record>
<record id="payment_method_ogone" model="account.payment.method">
<field name="name">Ogone</field>
<field name="code">ogone</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_token
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['ogone'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -132,12 +132,6 @@ class PaymentAcquirer(models.Model):
raise ValidationError("Ogone: " + _("The communication with the API failed."))
return response.content
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'ogone':
return super()._get_default_payment_method_id()
return self.env.ref('payment_ogone.payment_method_ogone').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('ogone', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class OgoneCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.ogone = cls._prepare_acquirer('ogone', update_values={
'ogone_pspid': 'dummy',
+3
View File
@@ -45,6 +45,9 @@ class OgoneTest(OgoneCommon, PaymentHttpCommon):
@freeze_time('2011-11-02 12:00:21') # Freeze time for consistent singularization behavior
def test_reference_is_computed_based_on_document_name(self):
""" Test computation of reference prefixes based on the provided invoice. """
if not self.env['ir.module.module']._get('account').state == 'installed':
self.skipTest('account module not installed')
invoice = self.env['account.move'].create({})
reference = self.env['payment.transaction']._compute_reference(
self.ogone.provider, invoice_ids=[Command.set([invoice.id])]
+5 -1
View File
@@ -3,7 +3,11 @@
from . import controllers
from . import models
from odoo.addons.payment import reset_payment_acquirer
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'paypal')
def uninstall_hook(cr, registry):
+1
View File
@@ -15,6 +15,7 @@
'data/payment_paypal_email_data.xml',
],
'application': True,
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -6,10 +6,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_paypal" model="account.payment.method">
<field name="name">Paypal</field>
<field name="code">paypal</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
-1
View File
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['paypal'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -78,12 +78,6 @@ class PaymentAcquirer(models.Model):
}
self.env['mail.mail'].sudo().create(mail_values).send()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'paypal':
return super()._get_default_payment_method_id()
return self.env.ref('payment_paypal.payment_method_paypal').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('paypal', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class PaypalCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.paypal = cls._prepare_acquirer('paypal', update_values={
'paypal_email_account': 'dummy@test.mail.com',
+9 -5
View File
@@ -6,11 +6,7 @@ from . import models
from odoo.exceptions import UserError
from odoo.tools import config
from odoo.addons.payment import reset_payment_acquirer
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'payulatam')
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def pre_init_hook(cr):
@@ -18,3 +14,11 @@ def pre_init_hook(cr):
raise UserError(
"This module is deprecated and cannot be installed. "
"Consider installing the Payment Acquirer: Mercado Pago module instead.")
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'payulatam')
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'payulatam')
+1
View File
@@ -14,6 +14,7 @@
],
'application': False,
'pre_init_hook': 'pre_init_hook',
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -21,10 +21,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_payulatam" model="account.payment.method">
<field name="name">payulatam</field>
<field name="code">payulatam</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction
@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['payulatam'] = {'mode': 'unique', 'domain': [('type', '=', 'bank')]}
return res
@@ -69,12 +69,6 @@ class PaymentAcquirer(models.Model):
])
return md5(data_string.encode('utf-8')).hexdigest()
def _get_default_payment_method_id(self):
self.ensure_one()
if self.provider != 'payulatam':
return super()._get_default_payment_method_id()
return self.env.ref('payment_payulatam.payment_method_payulatam').id
def _neutralize(self):
super()._neutralize()
self._neutralize_fields('payulatam', [
+2 -2
View File
@@ -6,8 +6,8 @@ from odoo.addons.payment.tests.common import PaymentCommon
class PayULatamCommon(PaymentCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.payulatam = cls._prepare_acquirer('payulatam', update_values={
'payulatam_account_id': 'dummy',
@@ -46,6 +46,9 @@ class PayULatamTest(PayULatamCommon, PaymentHttpCommon):
@freeze_time('2011-11-02 12:00:21') # Freeze time for consistent singularization behavior
def test_reference_is_computed_based_on_document_name(self):
""" Test computation of reference prefixes based on the provided invoice. """
if not self.env['ir.module.module']._get('account').state == 'installed':
self.skipTest('account module not installed')
invoice = self.env['account.move'].create({})
reference = self.env['payment.transaction']._compute_reference(
self.payulatam.provider, invoice_ids=[Command.set([invoice.id])]
+9 -5
View File
@@ -6,11 +6,7 @@ from . import models
from odoo.exceptions import UserError
from odoo.tools import config
from odoo.addons.payment import reset_payment_acquirer
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'payumoney')
from odoo.addons.payment import setup_provider, reset_payment_acquirer
def pre_init_hook(cr):
@@ -18,3 +14,11 @@ def pre_init_hook(cr):
raise UserError(
"This module is deprecated and cannot be installed. "
"Consider installing the Payment Acquirer: Razorpay module instead.")
def post_init_hook(cr, registry):
setup_provider(cr, registry, 'payumoney')
def uninstall_hook(cr, registry):
reset_payment_acquirer(cr, registry, 'payumoney')
+1
View File
@@ -14,6 +14,7 @@
],
'application': False,
'pre_init_hook': 'pre_init_hook',
'post_init_hook': 'post_init_hook',
'uninstall_hook': 'uninstall_hook',
'license': 'LGPL-3',
}
@@ -21,10 +21,4 @@
<field name="redirect_form_view_id" ref="redirect_form"/>
</record>
<record id="payment_method_payumoney" model="account.payment.method">
<field name="name">PayUmoney</field>
<field name="code">payumoney</field>
<field name="payment_type">inbound</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_payment_method
from . import payment_acquirer
from . import payment_transaction

Some files were not shown because too many files have changed in this diff Show More