summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2013-11-07 18:23:05 +0100
committerThibault Delavallée <tde@openerp.com>2013-11-07 18:23:05 +0100
commitf586b49e58069ba54294d8ef65abe3cfb6c5c807 (patch)
treebf8f1d223a2bd2aaf3cdf98cf6eca3380ed5ce41
parent7fe88852168423e45cc8f6d83c13102867b94431 (diff)
[ADD] website_payment: basically, a module to test
payments. Just to have a basic interface to click and see what happen. bzr revid: tde@openerp.com-20131107172305-giegilb90zll82x6
-rw-r--r--addons/website_payment/__init__.py22
-rw-r--r--addons/website_payment/__openerp__.py35
-rw-r--r--addons/website_payment/controllers/__init__.py1
-rw-r--r--addons/website_payment/controllers/main.py90
-rw-r--r--addons/website_payment/doc/changelog.rst9
-rw-r--r--addons/website_payment/doc/index.rst10
-rw-r--r--addons/website_payment/views/website_payment_templates.xml42
7 files changed, 209 insertions, 0 deletions
diff --git a/addons/website_payment/__init__.py b/addons/website_payment/__init__.py
new file mode 100644
index 00000000000..edccdf73182
--- /dev/null
+++ b/addons/website_payment/__init__.py
@@ -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 controllers
diff --git a/addons/website_payment/__openerp__.py b/addons/website_payment/__openerp__.py
new file mode 100644
index 00000000000..4368363c312
--- /dev/null
+++ b/addons/website_payment/__openerp__.py
@@ -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': 'Payment (test mainly)',
+ 'category': 'Website',
+ 'summary': 'Payment Acquirer (TMP / WIP)',
+ 'version': '1.0',
+ 'description': """
+ """,
+ 'author': 'OpenERP SA',
+ 'depends': ['website', 'payment_acquirer'],
+ 'data': [
+ 'views/website_payment_templates.xml',
+ ],
+ 'installable': True,
+}
diff --git a/addons/website_payment/controllers/__init__.py b/addons/website_payment/controllers/__init__.py
new file mode 100644
index 00000000000..8ee9bae18d9
--- /dev/null
+++ b/addons/website_payment/controllers/__init__.py
@@ -0,0 +1 @@
+import main
diff --git a/addons/website_payment/controllers/main.py b/addons/website_payment/controllers/main.py
new file mode 100644
index 00000000000..fd7c78c3521
--- /dev/null
+++ b/addons/website_payment/controllers/main.py
@@ -0,0 +1,90 @@
+# -*- 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.addons.web import http
+from openerp.addons.web.http import request
+from openerp.addons.website.models import website
+
+
+class WebsitePayment(http.Controller):
+
+ @website.route([
+ '/payment/paypal/test',
+ ], type='http', auth="public")
+ def paypal_test(self, **post):
+ """ TODO
+ """
+ cr, uid, context = request.cr, request.uid, request.context
+ acquirer_obj = request.registry['payment.acquirer']
+ payment_obj = request.registry['payment.transaction']
+ currency_obj = request.registry['res.currency']
+
+ paypal_id = acquirer_obj.search(cr, uid, [('name', '=', 'paypal')], limit=1, context=context)[0]
+
+ currency_id = currency_obj.search(cr, uid, [('name', '=', 'EUR')], limit=1, context=context)[0]
+ currency = currency_obj.browse(cr, uid, currency_id, context=context)
+
+ paypal_form = acquirer_obj.render(cr, uid, paypal_id, 'reference', 0.01, currency, context=context)
+ paypal = acquirer_obj.browse(cr, uid, paypal_id, context=context)
+
+ values = {
+ 'acquirer': paypal,
+ 'acquirer_form': paypal_form,
+ }
+ return request.website.render("website_payment.index_paypal", values)
+
+ @website.route([
+ '/payment/ogone/test',
+ ], type='http', auth="public")
+ def ogone_test(self, **post):
+ """ TODO
+ """
+ cr, uid, context = request.cr, request.uid, request.context
+ acquirer_obj = request.registry['payment.acquirer']
+ payment_obj = request.registry['payment.transaction']
+ currency_obj = request.registry['res.currency']
+
+ ogone_id = acquirer_obj.search(cr, uid, [('name', '=', 'ogone')], limit=1, context=context)[0]
+
+ currency_id = currency_obj.search(cr, uid, [('name', '=', 'EUR')], limit=1, context=context)[0]
+ currency = currency_obj.browse(cr, uid, currency_id, context=context)
+
+ nbr_tx = payment_obj.search(cr, uid, [], count=True, context=context)
+ tx_id = payment_obj.create(cr, uid, {
+ 'reference': '%s' % (nbr_tx),
+ 'amount': 1.95,
+ 'currency_id': currency_id,
+ 'acquirer_id': ogone_id,
+ }, context=context)
+
+ partner_values = {
+ 'name': 'Norbert Poilu',
+ 'lang': 'fr_FR',
+ }
+
+ ogone_form = acquirer_obj.render(cr, uid, ogone_id, None, None, None, tx_id=tx_id, partner_values=partner_values, context=context)
+ ogone = acquirer_obj.browse(cr, uid, ogone_id, context=context)
+
+ values = {
+ 'acquirer': ogone,
+ 'acquirer_form': ogone_form,
+ }
+ return request.website.render("website_payment.index_ogone", values)
diff --git a/addons/website_payment/doc/changelog.rst b/addons/website_payment/doc/changelog.rst
new file mode 100644
index 00000000000..8b6131b5806
--- /dev/null
+++ b/addons/website_payment/doc/changelog.rst
@@ -0,0 +1,9 @@
+.. _changelog:
+
+Changelog
+=========
+
+`trunk (saas-3)`
+----------------
+
+ - created ``website_blog`` menu, build on defunct document_page module.
diff --git a/addons/website_payment/doc/index.rst b/addons/website_payment/doc/index.rst
new file mode 100644
index 00000000000..953748fd48d
--- /dev/null
+++ b/addons/website_payment/doc/index.rst
@@ -0,0 +1,10 @@
+Blog Module documentation topics
+''''''''''''''''''''''''''''''''
+
+Changelog
+'''''''''
+
+.. toctree::
+ :maxdepth: 1
+
+ changelog.rst
diff --git a/addons/website_payment/views/website_payment_templates.xml b/addons/website_payment/views/website_payment_templates.xml
new file mode 100644
index 00000000000..03b045bf716
--- /dev/null
+++ b/addons/website_payment/views/website_payment_templates.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+ <!-- Layout add nav and footer -->
+ <template id="header_footer_custom" inherit_id="website.layout">
+ <xpath expr="//header//ul[@id='top_menu']/li[@name='contactus']" position="before">
+ <li><a t-attf-href="/payment/paypal/test">Test (Paypal)</a></li>
+ </xpath>
+ <xpath expr="//header//ul[@id='top_menu']/li[@name='contactus']" position="before">
+ <li><a t-attf-href="/payment/ogone/test">Test (Ogone)</a></li>
+ </xpath>
+ </template>
+
+ <!-- Page -->
+ <template id="index_paypal" name="Paypal (Test)" page="True">
+ <t t-call="website.layout">
+ <div id="wrap">
+ <div class="container mt16 js_website_blog">
+ <div class="row">
+ Paypal payment
+ <t t-raw="acquirer_form"/>
+ </div>
+ </div>
+ </div>
+ </t>
+ </template>
+
+ <template id="index_ogone" name="Ogone (Test)" page="True">
+ <t t-call="website.layout">
+ <div id="wrap">
+ <div class="container mt16 js_website_blog">
+ <div class="row">
+ Ogone payment
+ <t t-raw="acquirer_form"/>
+ </div>
+ </div>
+ </div>
+ </t>
+ </template>
+
+</data>
+</openerp>