[MERGE] [IMP] payment modules: added provider selection field that is different from the name. This allows to distinguish name and provider. Provider is a more technical field, used to call some specific methods (<provider>_method_name). The name field is used for display on the website.
Added name on payment.transaction views. Added sale_order_id field on transaction form view; the field is already present and used but was not displayed. Transfer is now called Wire Transfer. Code and views udpated accordingly. bzr revid: tde@openerp.com-20140404125931-msfyk21jx3gsyfj6
This commit is contained in:
commit
ba52cde0b5
|
@ -52,8 +52,15 @@ class PaymentAcquirer(osv.Model):
|
||||||
_name = 'payment.acquirer'
|
_name = 'payment.acquirer'
|
||||||
_description = 'Payment Acquirer'
|
_description = 'Payment Acquirer'
|
||||||
|
|
||||||
|
def _get_providers(self, cr, uid, context=None):
|
||||||
|
return []
|
||||||
|
|
||||||
|
# indirection to ease inheritance
|
||||||
|
_provider_selection = lambda self, *args, **kwargs: self._get_providers(*args, **kwargs)
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', required=True),
|
'name': fields.char('Name', required=True),
|
||||||
|
'provider': fields.selection(_provider_selection, string='Provider', required=True),
|
||||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||||
'pre_msg': fields.html('Message', help='Message displayed to explain and help the payment process.'),
|
'pre_msg': fields.html('Message', help='Message displayed to explain and help the payment process.'),
|
||||||
'post_msg': fields.html('Thanks Message', help='Message displayed after having done the payment process.'),
|
'post_msg': fields.html('Thanks Message', help='Message displayed after having done the payment process.'),
|
||||||
|
@ -84,10 +91,10 @@ class PaymentAcquirer(osv.Model):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_required_if_provider(self, cr, uid, ids, context=None):
|
def _check_required_if_provider(self, cr, uid, ids, context=None):
|
||||||
""" If the field has 'required_if_provider="<name>"' attribute, then it
|
""" If the field has 'required_if_provider="<provider>"' attribute, then it
|
||||||
required if record.name is <name>. """
|
required if record.provider is <provider>. """
|
||||||
for acquirer in self.browse(cr, uid, ids, context=context):
|
for acquirer in self.browse(cr, uid, ids, context=context):
|
||||||
if any(c for c, f in self._all_columns.items() if getattr(f.column, 'required_if_provider', None) == acquirer.name and not acquirer[c]):
|
if any(c for c, f in self._all_columns.items() if getattr(f.column, 'required_if_provider', None) == acquirer.provider and not acquirer[c]):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -98,8 +105,8 @@ class PaymentAcquirer(osv.Model):
|
||||||
def get_form_action_url(self, cr, uid, id, context=None):
|
def get_form_action_url(self, cr, uid, id, context=None):
|
||||||
""" Returns the form action URL, for form-based acquirer implementations. """
|
""" Returns the form action URL, for form-based acquirer implementations. """
|
||||||
acquirer = self.browse(cr, uid, id, context=context)
|
acquirer = self.browse(cr, uid, id, context=context)
|
||||||
if hasattr(self, '%s_get_form_action_url' % acquirer.name):
|
if hasattr(self, '%s_get_form_action_url' % acquirer.provider):
|
||||||
return getattr(self, '%s_get_form_action_url' % acquirer.name)(cr, uid, id, context=context)
|
return getattr(self, '%s_get_form_action_url' % acquirer.provider)(cr, uid, id, context=context)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def form_preprocess_values(self, cr, uid, id, reference, amount, currency_id, tx_id, partner_id, partner_values, tx_values, context=None):
|
def form_preprocess_values(self, cr, uid, id, reference, amount, currency_id, tx_id, partner_id, partner_values, tx_values, context=None):
|
||||||
|
@ -178,7 +185,7 @@ class PaymentAcquirer(osv.Model):
|
||||||
})
|
})
|
||||||
|
|
||||||
# compute fees
|
# compute fees
|
||||||
fees_method_name = '%s_compute_fees' % acquirer.name
|
fees_method_name = '%s_compute_fees' % acquirer.provider
|
||||||
if hasattr(self, fees_method_name):
|
if hasattr(self, fees_method_name):
|
||||||
fees = getattr(self, fees_method_name)(
|
fees = getattr(self, fees_method_name)(
|
||||||
cr, uid, id, tx_data['amount'], tx_data['currency_id'], partner_data['country_id'], context=None)
|
cr, uid, id, tx_data['amount'], tx_data['currency_id'], partner_data['country_id'], context=None)
|
||||||
|
@ -237,7 +244,7 @@ class PaymentAcquirer(osv.Model):
|
||||||
partner_values, tx_values, context=context)
|
partner_values, tx_values, context=context)
|
||||||
|
|
||||||
# call <name>_form_generate_values to update the tx dict with acqurier specific values
|
# call <name>_form_generate_values to update the tx dict with acqurier specific values
|
||||||
cust_method_name = '%s_form_generate_values' % (acquirer.name)
|
cust_method_name = '%s_form_generate_values' % (acquirer.provider)
|
||||||
if hasattr(self, cust_method_name):
|
if hasattr(self, cust_method_name):
|
||||||
method = getattr(self, cust_method_name)
|
method = getattr(self, cust_method_name)
|
||||||
partner_values, tx_values = method(cr, uid, id, partner_values, tx_values, context=context)
|
partner_values, tx_values = method(cr, uid, id, partner_values, tx_values, context=context)
|
||||||
|
@ -383,14 +390,14 @@ class PaymentTransaction(osv.Model):
|
||||||
acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)
|
acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)
|
||||||
|
|
||||||
# compute fees
|
# compute fees
|
||||||
custom_method_name = '%s_compute_fees' % acquirer.name
|
custom_method_name = '%s_compute_fees' % acquirer.provider
|
||||||
if hasattr(Acquirer, custom_method_name):
|
if hasattr(Acquirer, custom_method_name):
|
||||||
fees = getattr(Acquirer, custom_method_name)(
|
fees = getattr(Acquirer, custom_method_name)(
|
||||||
cr, uid, acquirer.id, values.get('amount', 0.0), values.get('currency_id'), values.get('country_id'), context=None)
|
cr, uid, acquirer.id, values.get('amount', 0.0), values.get('currency_id'), values.get('country_id'), context=None)
|
||||||
values['fees'] = float_round(fees, 2)
|
values['fees'] = float_round(fees, 2)
|
||||||
|
|
||||||
# custom create
|
# custom create
|
||||||
custom_method_name = '%s_create' % acquirer.name
|
custom_method_name = '%s_create' % acquirer.provider
|
||||||
if hasattr(self, custom_method_name):
|
if hasattr(self, custom_method_name):
|
||||||
values.update(getattr(self, custom_method_name)(cr, uid, values, context=context))
|
values.update(getattr(self, custom_method_name)(cr, uid, values, context=context))
|
||||||
|
|
||||||
|
@ -469,7 +476,7 @@ class PaymentTransaction(osv.Model):
|
||||||
|
|
||||||
if values.get('acquirer_id'):
|
if values.get('acquirer_id'):
|
||||||
acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)
|
acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)
|
||||||
custom_method_name = '_%s_s2s_send' % acquirer.name
|
custom_method_name = '_%s_s2s_send' % acquirer.provider
|
||||||
if hasattr(self, custom_method_name):
|
if hasattr(self, custom_method_name):
|
||||||
tx_id, result = getattr(self, custom_method_name)(cr, uid, values, cc_values, context=context)
|
tx_id, result = getattr(self, custom_method_name)(cr, uid, values, cc_values, context=context)
|
||||||
|
|
||||||
|
@ -482,7 +489,7 @@ class PaymentTransaction(osv.Model):
|
||||||
tx = self.browse(cr, uid, tx_id, context=context)
|
tx = self.browse(cr, uid, tx_id, context=context)
|
||||||
invalid_parameters = None
|
invalid_parameters = None
|
||||||
|
|
||||||
invalid_param_method_name = '_%s_s2s_get_invalid_parameters' % tx.acquirer_id.name
|
invalid_param_method_name = '_%s_s2s_get_invalid_parameters' % tx.acquirer_id.provider
|
||||||
if hasattr(self, invalid_param_method_name):
|
if hasattr(self, invalid_param_method_name):
|
||||||
invalid_parameters = getattr(self, invalid_param_method_name)(cr, uid, tx, data, context=context)
|
invalid_parameters = getattr(self, invalid_param_method_name)(cr, uid, tx, data, context=context)
|
||||||
|
|
||||||
|
@ -493,7 +500,7 @@ class PaymentTransaction(osv.Model):
|
||||||
_logger.error(_error_message)
|
_logger.error(_error_message)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
feedback_method_name = '_%s_s2s_validate' % tx.acquirer_id.name
|
feedback_method_name = '_%s_s2s_validate' % tx.acquirer_id.provider
|
||||||
if hasattr(self, feedback_method_name):
|
if hasattr(self, feedback_method_name):
|
||||||
return getattr(self, feedback_method_name)(cr, uid, tx, data, context=context)
|
return getattr(self, feedback_method_name)(cr, uid, tx, data, context=context)
|
||||||
|
|
||||||
|
@ -503,7 +510,7 @@ class PaymentTransaction(osv.Model):
|
||||||
""" Get the tx status. """
|
""" Get the tx status. """
|
||||||
tx = self.browse(cr, uid, tx_id, context=context)
|
tx = self.browse(cr, uid, tx_id, context=context)
|
||||||
|
|
||||||
invalid_param_method_name = '_%s_s2s_get_tx_status' % tx.acquirer_id.name
|
invalid_param_method_name = '_%s_s2s_get_tx_status' % tx.acquirer_id.provider
|
||||||
if hasattr(self, invalid_param_method_name):
|
if hasattr(self, invalid_param_method_name):
|
||||||
return getattr(self, invalid_param_method_name)(cr, uid, tx, context=context)
|
return getattr(self, invalid_param_method_name)(cr, uid, tx, context=context)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
parent='base.menu_administration'/>
|
parent='base.menu_administration'/>
|
||||||
|
|
||||||
<record id="acquirer_form" model="ir.ui.view">
|
<record id="acquirer_form" model="ir.ui.view">
|
||||||
<field name="name">acquirer.form</field>
|
<field name="name">payment.acquirer.form</field>
|
||||||
<field name="model">payment.acquirer</field>
|
<field name="model">payment.acquirer</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Payment Acquirer" version="7.0">
|
<form string="Payment Acquirer" version="7.0">
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
<group name="acquirer_base">
|
<group name="acquirer_base">
|
||||||
<group>
|
<group>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="provider"/>
|
||||||
<field name="company_id"/>
|
<field name="company_id"/>
|
||||||
<field name="website_published"/>
|
<field name="website_published"/>
|
||||||
<field name="env"/>
|
<field name="env"/>
|
||||||
|
@ -62,10 +63,12 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="acquirer_list" model="ir.ui.view">
|
<record id="acquirer_list" model="ir.ui.view">
|
||||||
|
<field name="name">payment.acquirer.list</field>
|
||||||
<field name="model">payment.acquirer</field>
|
<field name="model">payment.acquirer</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Payment Acquirers">
|
<tree string="Payment Acquirers">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="provider"/>
|
||||||
<field name="website_published"/>
|
<field name="website_published"/>
|
||||||
<field name="env"/>
|
<field name="env"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
@ -73,10 +76,15 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="acquirer_search" model="ir.ui.view">
|
<record id="acquirer_search" model="ir.ui.view">
|
||||||
|
<field name="name">payment.acquirer.search</field>
|
||||||
<field name="model">payment.acquirer</field>
|
<field name="model">payment.acquirer</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search>
|
<search>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="provider"/>
|
||||||
|
<group expand="0" string="Group By...">
|
||||||
|
<filter string="Provider" name="provider" domain="[]" context="{'group_by': 'provider'}"/>
|
||||||
|
</group>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -95,6 +103,7 @@
|
||||||
sequence='10' />
|
sequence='10' />
|
||||||
|
|
||||||
<record id="transaction_form" model="ir.ui.view">
|
<record id="transaction_form" model="ir.ui.view">
|
||||||
|
<field name="name">payment.transaction.form</field>
|
||||||
<field name="model">payment.transaction</field>
|
<field name="model">payment.transaction</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Payment Transactions" version="7.0">
|
<form string="Payment Transactions" version="7.0">
|
||||||
|
@ -138,6 +147,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="transaction_list" model="ir.ui.view">
|
<record id="transaction_list" model="ir.ui.view">
|
||||||
|
<field name="name">payment.transaction.list</field>
|
||||||
<field name="model">payment.transaction</field>
|
<field name="model">payment.transaction</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Payment Transactions">
|
<tree string="Payment Transactions">
|
||||||
|
@ -151,6 +161,7 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="transaction" model="ir.ui.view">
|
<record id="transaction" model="ir.ui.view">
|
||||||
|
<field name="name">payment.transaction.search</field>
|
||||||
<field name="model">payment.transaction</field>
|
<field name="model">payment.transaction</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search>
|
<search>
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="payment_acquirer_adyen" model="payment.acquirer">
|
<record id="payment_acquirer_adyen" model="payment.acquirer">
|
||||||
<field name="name">adyen</field>
|
<field name="name">Adyen</field>
|
||||||
|
<field name="provider">adyen</field>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="view_template_id" ref="adyen_acquirer_button"/>
|
<field name="view_template_id" ref="adyen_acquirer_button"/>
|
||||||
<field name="env">test</field>
|
<field name="env">test</field>
|
||||||
|
|
|
@ -26,14 +26,14 @@ class AcquirerAdyen(osv.Model):
|
||||||
|
|
||||||
- yhpp: hosted payment page: pay.shtml for single, select.shtml for multiple
|
- yhpp: hosted payment page: pay.shtml for single, select.shtml for multiple
|
||||||
"""
|
"""
|
||||||
if env == 'prod':
|
return {
|
||||||
return {
|
'adyen_form_url': 'https://%s.adyen.com/hpp/pay.shtml' % env,
|
||||||
'adyen_form_url': 'https://prod.adyen.com/hpp/pay.shtml',
|
}
|
||||||
}
|
|
||||||
else:
|
def _get_providers(self, cr, uid, context=None):
|
||||||
return {
|
providers = super(AcquirerAdyen, self)._get_providers(cr, uid, context=context)
|
||||||
'adyen_form_url': 'https://test.adyen.com/hpp/pay.shtml',
|
providers.append(['adyen', 'Adyen'])
|
||||||
}
|
return providers
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'adyen_merchant_account': fields.char('Merchant Account', required_if_provider='adyen'),
|
'adyen_merchant_account': fields.char('Merchant Account', required_if_provider='adyen'),
|
||||||
|
@ -54,7 +54,7 @@ class AcquirerAdyen(osv.Model):
|
||||||
:return string: shasign
|
:return string: shasign
|
||||||
"""
|
"""
|
||||||
assert inout in ('in', 'out')
|
assert inout in ('in', 'out')
|
||||||
assert acquirer.name == 'adyen'
|
assert acquirer.provider == 'adyen'
|
||||||
|
|
||||||
if inout == 'in':
|
if inout == 'in':
|
||||||
keys = "paymentAmount currencyCode shipBeforeDate merchantReference skinCode merchantAccount sessionValidity shopperEmail shopperReference recurringContract allowedMethods blockedMethods shopperStatement merchantReturnData billingAddressType deliveryAddressType offset".split()
|
keys = "paymentAmount currencyCode shipBeforeDate merchantReference skinCode merchantAccount sessionValidity shopperEmail shopperReference recurringContract allowedMethods blockedMethods shopperStatement merchantReturnData billingAddressType deliveryAddressType offset".split()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="inherit_id" ref="payment.acquirer_form"/>
|
<field name="inherit_id" ref="payment.acquirer_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
||||||
<group attrs="{'invisible': [('name', '!=', 'adyen')]}">
|
<group attrs="{'invisible': [('provider', '!=', 'adyen')]}">
|
||||||
<field name="adyen_merchant_account"/>
|
<field name="adyen_merchant_account"/>
|
||||||
<field name="adyen_skin_code"/>
|
<field name="adyen_skin_code"/>
|
||||||
<field name="adyen_skin_hmac_key"/>
|
<field name="adyen_skin_hmac_key"/>
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="payment_acquirer_ogone" model="payment.acquirer">
|
<record id="payment_acquirer_ogone" model="payment.acquirer">
|
||||||
<field name="name">ogone</field>
|
<field name="name">Credit Card</field>
|
||||||
|
<field name="provider">ogone</field>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="view_template_id" ref="ogone_acquirer_button"/>
|
<field name="view_template_id" ref="ogone_acquirer_button"/>
|
||||||
<field name="env">test</field>
|
<field name="env">test</field>
|
||||||
|
|
|
@ -36,6 +36,11 @@ class PaymentAcquirerOgone(osv.Model):
|
||||||
'ogone_afu_agree_url': 'https://secure.ogone.com/ncol/%s/AFU_agree.asp' % (env,),
|
'ogone_afu_agree_url': 'https://secure.ogone.com/ncol/%s/AFU_agree.asp' % (env,),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_providers(self, cr, uid, context=None):
|
||||||
|
providers = super(PaymentAcquirerOgone, self)._get_providers(cr, uid, context=context)
|
||||||
|
providers.append(['ogone', 'Ogone'])
|
||||||
|
return providers
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'ogone_pspid': fields.char('PSPID', required_if_provider='ogone'),
|
'ogone_pspid': fields.char('PSPID', required_if_provider='ogone'),
|
||||||
'ogone_userid': fields.char('API User ID', required_if_provider='ogone'),
|
'ogone_userid': fields.char('API User ID', required_if_provider='ogone'),
|
||||||
|
@ -57,7 +62,7 @@ class PaymentAcquirerOgone(osv.Model):
|
||||||
:return string: shasign
|
:return string: shasign
|
||||||
"""
|
"""
|
||||||
assert inout in ('in', 'out')
|
assert inout in ('in', 'out')
|
||||||
assert acquirer.name == 'ogone'
|
assert acquirer.provider == 'ogone'
|
||||||
key = getattr(acquirer, 'ogone_shakey_' + inout)
|
key = getattr(acquirer, 'ogone_shakey_' + inout)
|
||||||
|
|
||||||
def filter_key(key):
|
def filter_key(key):
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="inherit_id" ref="payment.acquirer_form"/>
|
<field name="inherit_id" ref="payment.acquirer_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
||||||
<group attrs="{'invisible': [('name', '!=', 'ogone')]}">
|
<group attrs="{'invisible': [('provider', '!=', 'ogone')]}">
|
||||||
<field name="ogone_pspid"/>
|
<field name="ogone_pspid"/>
|
||||||
<field name="ogone_userid"/>
|
<field name="ogone_userid"/>
|
||||||
<field name="ogone_password"/>
|
<field name="ogone_password"/>
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="payment_acquirer_paypal" model="payment.acquirer">
|
<record id="payment_acquirer_paypal" model="payment.acquirer">
|
||||||
<field name="name">paypal</field>
|
<field name="name">Paypal</field>
|
||||||
|
<field name="provider">paypal</field>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="view_template_id" ref="paypal_acquirer_button"/>
|
<field name="view_template_id" ref="paypal_acquirer_button"/>
|
||||||
<field name="env">test</field>
|
<field name="env">test</field>
|
||||||
|
|
|
@ -34,6 +34,11 @@ class AcquirerPaypal(osv.Model):
|
||||||
'paypal_rest_url': 'https://api.sandbox.paypal.com/v1/oauth2/token',
|
'paypal_rest_url': 'https://api.sandbox.paypal.com/v1/oauth2/token',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_providers(self, cr, uid, context=None):
|
||||||
|
providers = super(AcquirerPaypal, self)._get_providers(cr, uid, context=context)
|
||||||
|
providers.append(['paypal', 'Paypal'])
|
||||||
|
return providers
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'paypal_email_account': fields.char('Paypal Email ID', required_if_provider='paypal'),
|
'paypal_email_account': fields.char('Paypal Email ID', required_if_provider='paypal'),
|
||||||
'paypal_seller_account': fields.char(
|
'paypal_seller_account': fields.char(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<field name="inherit_id" ref="payment.acquirer_form"/>
|
<field name="inherit_id" ref="payment.acquirer_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
<xpath expr='//group[@name="acquirer_display"]' position='after'>
|
||||||
<group attrs="{'invisible': [('name', '!=', 'paypal')]}">
|
<group attrs="{'invisible': [('provider', '!=', 'paypal')]}">
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="paypal_email_account"/>
|
<field name="paypal_email_account"/>
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="payment_acquirer_transfer" model="payment.acquirer">
|
<record id="payment_acquirer_transfer" model="payment.acquirer">
|
||||||
<field name="name">transfer</field>
|
<field name="name">Wire Transfer</field>
|
||||||
|
<field name="provider">transfer</field>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="view_template_id" ref="transfer_acquirer_button"/>
|
<field name="view_template_id" ref="transfer_acquirer_button"/>
|
||||||
<field name="validation">manual</field>
|
<field name="validation">manual</field>
|
||||||
|
|
|
@ -14,6 +14,11 @@ _logger = logging.getLogger(__name__)
|
||||||
class TransferPaymentAcquirer(osv.Model):
|
class TransferPaymentAcquirer(osv.Model):
|
||||||
_inherit = 'payment.acquirer'
|
_inherit = 'payment.acquirer'
|
||||||
|
|
||||||
|
def _get_providers(self, cr, uid, context=None):
|
||||||
|
providers = super(TransferPaymentAcquirer, self)._get_providers(cr, uid, context=context)
|
||||||
|
providers.append(['transfer', 'Wire Transfer'])
|
||||||
|
return providers
|
||||||
|
|
||||||
def transfer_get_form_action_url(self, cr, uid, id, context=None):
|
def transfer_get_form_action_url(self, cr, uid, id, context=None):
|
||||||
return '/payment/transfer/feedback'
|
return '/payment/transfer/feedback'
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ OpenERP E-Commerce
|
||||||
'data/website_sale_data.xml',
|
'data/website_sale_data.xml',
|
||||||
'views/website_sale.xml',
|
'views/website_sale.xml',
|
||||||
'views/website_sale_backend.xml',
|
'views/website_sale_backend.xml',
|
||||||
|
'views/payment.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/website_sale.xml',
|
'security/website_sale.xml',
|
||||||
],
|
],
|
||||||
|
|
|
@ -709,7 +709,8 @@ class Ecommerce(http.Controller):
|
||||||
message = '<p>The payment seems to have been canceled.</p>'
|
message = '<p>The payment seems to have been canceled.</p>'
|
||||||
elif state == 'pending' and tx.acquirer_id.validation == 'manual':
|
elif state == 'pending' and tx.acquirer_id.validation == 'manual':
|
||||||
message = '<p>Your transaction is waiting confirmation.</p>'
|
message = '<p>Your transaction is waiting confirmation.</p>'
|
||||||
message += tx.acquirer_id.post_msg
|
if tx.acquirer_id.post_msg:
|
||||||
|
message += tx.acquirer_id.post_msg
|
||||||
else:
|
else:
|
||||||
message = '<p>Your transaction is waiting confirmation.</p>'
|
message = '<p>Your transaction is waiting confirmation.</p>'
|
||||||
validation = tx.acquirer_id.validation
|
validation = tx.acquirer_id.validation
|
||||||
|
|
|
@ -73,11 +73,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "select payment",
|
title: "select payment",
|
||||||
element: '#payment_method label:has(img[title="transfer"]) input',
|
element: '#payment_method label:has(img[title="Wire Transfer"]) input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Pay Now",
|
title: "Pay Now",
|
||||||
waitFor: '#payment_method label:has(input:checked):has(img[title="transfer"])',
|
waitFor: '#payment_method label:has(input:checked):has(img[title="Wire Transfer"])',
|
||||||
element: '.oe_sale_acquirer_button .btn[name="submit"]:visible',
|
element: '.oe_sale_acquirer_button .btn[name="submit"]:visible',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="transaction_form_website_sale" model="ir.ui.view">
|
||||||
|
<field name="name">payment.transaction.form.website_sale</field>
|
||||||
|
<field name="model">payment.transaction</field>
|
||||||
|
<field name="inherit_id" ref="payment.transaction_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='reference']" position="after">
|
||||||
|
<field name="sale_order_id"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
|
@ -958,7 +958,7 @@
|
||||||
<input t-att-value="acquirer.id" type="radio" name="acquirer" t-att-checked="acquirers[0] == acquirer"/>
|
<input t-att-value="acquirer.id" type="radio" name="acquirer" t-att-checked="acquirers[0] == acquirer"/>
|
||||||
<img class="media-object" style="width: 60px; display: inline-block;"
|
<img class="media-object" style="width: 60px; display: inline-block;"
|
||||||
t-att-title="acquirer.name"
|
t-att-title="acquirer.name"
|
||||||
t-att-src="'/payment_%s/static/src/img/%s_icon.png' % (acquirer.name, acquirer.name)"/>
|
t-att-src="'/payment_%s/static/src/img/%s_icon.png' % (acquirer.provider, acquirer.provider)"/>
|
||||||
<span t-field="acquirer.name"/>
|
<span t-field="acquirer.name"/>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue