[ADD] [MOV] payment_acquirer: added transfer payment acquirer
Only dummy module currently. Allowed to remove some old stuff from payment_acquirer. bzr revid: tde@openerp.com-20131108094444-to0kgzkl2agqkdps
This commit is contained in:
parent
553870b59e
commit
04e6a95cd5
|
@ -29,7 +29,6 @@
|
|||
'depends': ['decimal_precision', 'mail'],
|
||||
'data': [
|
||||
'views/payment_acquirer_views.xml',
|
||||
'data/payment_acquirer_data.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<!-- Paypal -->
|
||||
<!--
|
||||
<template id="paypal_acquirer_view">
|
||||
<form t-if="object.company_id.paypal_account" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_self">
|
||||
<input type="hidden" name="cmd" value="_xclick"/>
|
||||
<input type="hidden" name="business" t-att-value="object.company_id.paypal_account"/>
|
||||
<input type="hidden" name="item_name" t-attf-value="#{object.company_id.name} #{reference}"/>
|
||||
<input type="hidden" name="item_number" t-att-value="reference"/>
|
||||
<input type="hidden" name="amount" t-att-value="amount"/>
|
||||
<input type="hidden" name="currency_code" t-att-value="currency.name"/>
|
||||
<input t-if="return_url" type="hidden" name="return_url" t-att-value="return_url"/>
|
||||
<input t-if="cancel_url" type="hidden" name="cancel_url" t-att-value="cancel_url"/>
|
||||
<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
||||
</form>
|
||||
</template> -->
|
||||
|
||||
<!-- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_xclick">
|
||||
<input type="hidden" name="business" value="alfred@gmail.com">
|
||||
<input type="hidden" name="lc" value="US">
|
||||
<input type="hidden" name="item_name" value="object_name">
|
||||
<input type="hidden" name="item_number" value="object_id">
|
||||
<input type="hidden" name="amount" value="23.00">
|
||||
<input type="hidden" name="currency_code" value="USD">
|
||||
<input type="hidden" name="button_subtype" value="services">
|
||||
<input type="hidden" name="no_note" value="0">
|
||||
<input type="hidden" name="tax_rate" value="21.000">
|
||||
<input type="hidden" name="shipping" value="2.00">
|
||||
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
|
||||
<input type="image" src="https://www.paypalobjects.com/fr_XC/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/fr_XC/i/scr/pixel.gif" width="1" height="1">
|
||||
</form> -->
|
||||
|
||||
|
||||
|
||||
<!-- <record id="paypal_acquirer" model="payment.acquirer">
|
||||
<field name="acquirer">paypal</field>
|
||||
<field name="form_template_id" ref="paypal_acquirer_view"/>
|
||||
<field name="type_id" ref="paypal"/>
|
||||
</record> -->
|
||||
|
||||
<!-- Virement -->
|
||||
|
||||
<!-- <template id="virement_acquirer_view">
|
||||
<div>
|
||||
<table>
|
||||
<tr><td>Numero de compte: </td><td></td></tr>
|
||||
<tr><td>Communication: </td><td><t t-esc="reference"/></td></tr>
|
||||
</table>
|
||||
<a t-att-href="return_url" class="btn btn-primary">Validate & Pay <span class="icon-long-arrow-right"/></a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<record id="virement_acquirer" model="payment.acquirer">
|
||||
<field name="acquirer">virement</field>
|
||||
<field name="form_template_id" ref="virement_acquirer_view"/>
|
||||
<field name="type_id" ref="virement"/>
|
||||
</record> -->
|
||||
</data>
|
||||
</openerp>
|
|
@ -168,9 +168,10 @@ class PaymentTransaction(osv.Model):
|
|||
def create(self, cr, uid, values, context=None):
|
||||
if not 'name' in values and 'reference' in values:
|
||||
values['name'] = values['reference']
|
||||
if values.get('partner_id'):
|
||||
if values.get('partner_id'): # @TDENOTE: not sure
|
||||
values.update(self.on_change_partner_id(cr, uid, None, values.get('partner_id'), context=context)['values'])
|
||||
|
||||
# call custom create method if defined (i.e. ogone_create for ogone)
|
||||
if values.get('acquirer_id'):
|
||||
acquirer = self.pool['payment.acquirer'].browse(cr, uid, values.get('acquirer_id'), context=context)
|
||||
custom_method_name = '%s_create' % acquirer.name
|
||||
|
|
|
@ -132,5 +132,6 @@
|
|||
id='payment_transaction_menu'
|
||||
parent='root_payment_menu'
|
||||
sequence='20' />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import models
|
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Transfer Payment acquirer',
|
||||
'category': 'Hidden',
|
||||
'summary': 'Transfer Payment acquirer',
|
||||
'version': '0.1',
|
||||
'description': """Transfer Payment acquirer""",
|
||||
'author': 'OpenERP SA',
|
||||
'depends': ['payment_acquirer'],
|
||||
'data': [
|
||||
'views/transfer.xml',
|
||||
'data/transfer.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="payment_acquirer_transfer" model="payment.acquirer">
|
||||
<field name="name">transfer</field>
|
||||
<field name="form_template_id" ref="transfer_acquirer_button"/>
|
||||
<field name="env">test</field>
|
||||
<field name="portal_published" eval="False"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import payment_acquirer
|
|
@ -0,0 +1,36 @@
|
|||
# -*- coding: utf-'8' "-*-"
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import osv
|
||||
# from openerp.osv import fields
|
||||
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TransferPaymentAcquirer(osv.Model):
|
||||
_name = 'payment.acquirer'
|
||||
_description = 'Online Payment Acquirer'
|
||||
|
||||
|
||||
class TransferPaymentTransaction(osv.Model):
|
||||
_inherit = ['payment.transaction']
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import common
|
|
@ -0,0 +1,66 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 20123TODAY OpenERP S.A. <http://www.openerp.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.tests import common
|
||||
|
||||
|
||||
class PaymentAcquirerCommon(common.TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PaymentAcquirerCommon, self).setUp()
|
||||
self.payment_acquirer = self.registry('payment.acquirer')
|
||||
self.payment_transaction = self.registry('payment.transaction')
|
||||
|
||||
self.currency_euro_id = self.registry('res.currency').search(
|
||||
self.cr, self.uid, [('name', '=', 'EUR')], limit=1)[0]
|
||||
self.currency_euro = self.registry('res.currency').browse(
|
||||
self.cr, self.uid, self.currency_euro_id)
|
||||
country_belgium_id = self.registry('res.country').search(
|
||||
self.cr, self.uid, [('code', 'like', 'BE')], limit=1)[0]
|
||||
|
||||
# dict partner values
|
||||
self.buyer_values = {
|
||||
'name': 'Norbert Buyer',
|
||||
'lang': 'en_US',
|
||||
'email': 'norbert.buyer@example.com',
|
||||
'street': 'Huge Street',
|
||||
'street2': '2/543',
|
||||
'phone': '0032 12 34 56 78',
|
||||
'city': 'Sin City',
|
||||
'zip': '1000',
|
||||
'country_id': country_belgium_id,
|
||||
'country_name': 'Belgium',
|
||||
}
|
||||
|
||||
# test partner
|
||||
self.buyer_id = self.registry('res.partner').create(
|
||||
self.cr, self.uid, {
|
||||
'name': 'Norbert Buyer',
|
||||
'lang': 'en_US',
|
||||
'email': 'norbert.buyer@example.com',
|
||||
'street': 'Huge Street',
|
||||
'street2': '2/543',
|
||||
'phone': '0032 12 34 56 78',
|
||||
'city': 'Sin City',
|
||||
'zip': '1000',
|
||||
'country_id': country_belgium_id,
|
||||
}
|
||||
)
|
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem
|
||||
name='Payments'
|
||||
id='root_payment_menu'
|
||||
parent='base.menu_administration'/>
|
||||
|
||||
<record id="acquirer_form" model="ir.ui.view">
|
||||
<field name="model">payment.acquirer</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment Acquirer" version="7.0">
|
||||
<group col="1">
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/><h1><field name="name"/></h1>
|
||||
<div class="oe_edit_only"><field name="portal_published"/><label for="portal_published"/></div>
|
||||
<field name="env"/>
|
||||
</div>
|
||||
<group string="Form Template">
|
||||
<div>
|
||||
<p>
|
||||
This is an HTML form template to submit a payment through this acquirer.
|
||||
The template will be rendered with qWeb, so it may use qWeb expressions.
|
||||
The qWeb evaluation context provides:
|
||||
<ul>
|
||||
<li>reference: the reference number of the document to pay</li>
|
||||
<li>currency: the currency record in which the document is issued (e.g. currency.name could be EUR)</li>
|
||||
<li>amount: the total amount to pay, as a float</li>
|
||||
<li>amount_str: the total amount to pay, as a string with the account precision</li>
|
||||
<li>object: the browse record on which the payment form is rendered (usually an invoice or sales order record)</li>
|
||||
<li>user_id: the current user browse record</li>
|
||||
<li>context: the current context dictionary</li>
|
||||
</ul>
|
||||
If the template renders to an empty result in a certain context it will be ignored, as if it was inactive.
|
||||
</p>
|
||||
</div>
|
||||
<field name="view_template_id" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="acquirer_list" model="ir.ui.view">
|
||||
<field name="model">payment.acquirer</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Payment Acquirers">
|
||||
<field name="name"/>
|
||||
<field name="portal_published"/>
|
||||
<field name="env"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="acquirer_search" model="ir.ui.view">
|
||||
<field name="model">payment.acquirer</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_payment_acquirer">
|
||||
<field name="name">Payment Acquirers</field>
|
||||
<field name="res_model">payment.acquirer</field>
|
||||
<field name='view_type'>form</field>
|
||||
<field name='view_mode'>tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action='action_payment_acquirer'
|
||||
id='payment_acquirer_menu'
|
||||
parent='root_payment_menu'
|
||||
sequence='10' />
|
||||
|
||||
<record model="ir.ui.view" id="transaction_form">
|
||||
<field name="model">payment.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment Transactions" version="7.0">
|
||||
<group>
|
||||
<field name="date_create"/>
|
||||
<field name="date_validate"/>
|
||||
<field name="acquirer_id"/>
|
||||
<field name="state"/>
|
||||
<field name="state_message"/>
|
||||
<field name="amount"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="reference"/>
|
||||
<field name="name"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="partner_name"/>
|
||||
<field name="partner_email"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="transaction_list">
|
||||
<field name="model">payment.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Payment Transactions">
|
||||
<field name="partner_id"/>
|
||||
<field name="partner_name"/>
|
||||
<field name="state"/>
|
||||
<field name="reference"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="transaction">
|
||||
<field name="model">payment.transaction</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="partner_id"/>
|
||||
<field name="partner_name"/>
|
||||
<field name="reference"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_payment_transaction">
|
||||
<field name="name">Payment Transactions</field>
|
||||
<field name="res_model">payment.transaction</field>
|
||||
<field name='view_type'>form</field>
|
||||
<field name='view_mode'>tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action='action_payment_transaction'
|
||||
id='payment_transaction_menu'
|
||||
parent='root_payment_menu'
|
||||
sequence='20' />
|
||||
|
||||
<!-- templates -->
|
||||
<template id="transfer_acquirer_button">
|
||||
<div>
|
||||
<table>
|
||||
<tr><td>Bank account</td><td></td></tr>
|
||||
<tr><td>Communication</td><td><t t-esc="reference"/></td></tr>
|
||||
</table>
|
||||
<a t-att-href="return_url" class="btn btn-primary">Validate & Pay <span class="icon-long-arrow-right"/></a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue