Skip to content
Snippets Groups Projects
Commit 1ebd6735 authored by Jay Patel's avatar Jay Patel Committed by Richard Mathot
Browse files

[IMP] payment, website_sale: post-payment messages on acquirers

parent 2b8c63a7
Branches
Tags
No related merge requests found
......@@ -82,6 +82,10 @@ class PaymentAcquirer(osv.Model):
('at_pay_confirm', 'At payment confirmation'),
('at_pay_now', 'At payment')],
string='Order Confirmation', required=True),
'pending_msg': fields.html('Pending Message', translate=True, help='Message displayed, if order is in pending state after having done the payment process.'),
'done_msg': fields.html('Done Message', translate=True, help='Message displayed, if order is done successfully after having done the payment process.'),
'cancel_msg': fields.html('Cancel Message', translate=True, help='Message displayed, if order is cancel during the payment process.'),
'error_msg': fields.html('Error Message', translate=True, help='Message displayed, if error is occur during the payment process.'),
# Fees
'fees_active': fields.boolean('Compute fees'),
'fees_dom_fixed': fields.float('Fixed domestic fees'),
......@@ -97,6 +101,10 @@ class PaymentAcquirer(osv.Model):
'validation': 'automatic',
'website_published': True,
'auto_confirm': 'at_pay_confirm',
'pending_msg': '<i>Pending,</i> Your online payment has been successfully processed. But your order is not validated yet.',
'done_msg': '<i>Done,</i> Your online payment has been successfully processed. Thank you for your order.',
'cancel_msg': '<i>Cancel,</i> Your payment has been cancelled.',
'error_msg': '<i>Error,</i> An error occurred. We cannot process your payment for the moment, please try again later.'
}
def _check_required_if_provider(self, cr, uid, ids, context=None):
......
......@@ -35,30 +35,46 @@
attrs="{'invisible': [('fees_active', '=', False)]}"/>
</group>
</group>
<group name="acquirer_display">
<field name="pre_msg"/>
<field name="post_msg"/>
<label for="view_template_id"/>
<div>
<field name="view_template_id" nolabel="1"/>
<div>
This template renders the acquirer button with all necessary values.
It is be rendered with qWeb with the following evaluation context:
<ul>
<li>tx_url: transaction URL to post the form</li>
<li>acquirer: payment.acquirer browse record</li>
<li>user: current user browse record</li>
<li>reference: the transaction reference number</li>
<li>currency: the transaction currency browse record</li>
<li>amount: the transaction amount, a float</li>
<li>partner: the buyer partner browse record, not necessarily set</li>
<li>partner_values: specific values about the buyer, for example coming from a shipping form</li>
<li>tx_values: transaction values</li>
<li>context: the current context dictionary</li>
</ul>
</div>
</div>
</group>
<notebook>
<page string="Message">
<group>
<field name="pre_msg"/>
<field name="post_msg"/>
</group>
</page>
<page string="Status">
<group>
<field name="pending_msg"/>
<field name="done_msg"/>
<field name="cancel_msg"/>
<field name="error_msg"/>
</group>
</page>
<page string="Configuration">
<group name="acquirer_display">
<label for="view_template_id"/>
<div>
<field name="view_template_id" nolabel="1"/>
<div>
This template renders the acquirer button with all necessary values.
It is be rendered with qWeb with the following evaluation context:
<ul>
<li>tx_url: transaction URL to post the form</li>
<li>acquirer: payment.acquirer browse record</li>
<li>user: current user browse record</li>
<li>reference: the transaction reference number</li>
<li>currency: the transaction currency browse record</li>
<li>amount: the transaction amount, a float</li>
<li>partner: the buyer partner browse record, not necessarily set</li>
<li>partner_values: specific values about the buyer, for example coming from a shipping form</li>
<li>tx_values: transaction values</li>
<li>context: the current context dictionary</li>
</ul>
</div>
</div>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
......
......@@ -89,7 +89,7 @@
</tbody>
</table>
<div class="row">
<div class="row" name="total">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
......
......@@ -18,6 +18,7 @@ OpenERP E-Commerce
'views/payment.xml',
'views/sale_order.xml',
'views/snippets.xml',
'views/report_shop_saleorder.xml',
'res_config_view.xml',
'security/ir.model.access.csv',
'security/website_sale.xml',
......
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_shop_saleorder_document" inherit_id="sale.report_saleorder_document">
<xpath expr="//div[@name='total']" position="after">
<t t-if="doc.payment_acquirer_id.name">
<table class="table table-condensed mt32 mb32">
<thead>
<tr>
<th>Payment Information</th>
<th class="text-right">Total</th>
</tr>
</thead>
<tbody class="sale_tbody">
<tr>
<td>
<strong>Payment Method:</strong> <t t-esc="doc.payment_acquirer_id.name"/><br />
<strong>Payment Status:</strong>
<t t-if="doc.payment_acquirer_id.auto_confirm == 'none'">
<t t-raw="doc.payment_acquirer_id.pending_msg"/>
</t>
<t t-if="doc.payment_acquirer_id.auto_confirm == 'at_pay_confirm'">
<t t-if="doc.payment_tx_id.state == 'pending'">
<t t-raw="doc.payment_acquirer_id.pending_msg"/>
</t>
<t t-if="doc.payment_tx_id.state == 'done'">
<t t-raw="doc.payment_acquirer_id.done_msg"/>
</t>
<t t-if="doc.payment_tx_id.state == 'cancel'">
<t t-raw="doc.payment_acquirer_id.cancel_msg"/>
</t>
<t t-if="doc.payment_tx_id.state == 'error'">
<t t-raw="doc.payment_acquirer_id.error_msg"/>
</t>
</t>
</td>
<td class="text-right">
<span t-field="doc.amount_total"
t-field-options='{"widget": "monetary", "display_currency": "doc.pricelist_id.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
</t>
</xpath>
</template>
</data>
</openerp>
......@@ -1165,6 +1165,21 @@
</table>
<div class="clearfix"/>
<div class="oe_structure"/>
<h3 class="text-left"><strong>Payment information:</strong></h3>
<table class="table">
<tbody>
<tr>
<td colspan="2">
<t t-call="website_sale.payment_confirmation_status"/>
</td>
<td class="text-right" width="100"><strong>Total:</strong></td>
<td class="text-right" width="100">
<strong t-field="order.amount_total"
t-field-options='{"widget": "monetary", "display_currency": "order.pricelist_id.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-3 col-md-offset-1 text-muted">
......@@ -1243,6 +1258,29 @@
</table>
</template>
<!-- payment acquirer information -->
<template id="payment_confirmation_status">
<strong>Payment Method:</strong> <t t-esc="order.payment_acquirer_id.name"/><br />
<strong>Payment Status:</strong>
<t t-if="order.payment_acquirer_id.auto_confirm == 'none'">
<t t-raw="order.payment_acquirer_id.pending_msg"/>
</t>
<t t-if="order.payment_acquirer_id.auto_confirm == 'at_pay_confirm'">
<t t-if="order.payment_tx_id.state == 'pending'">
<t t-raw="order.payment_acquirer_id.pending_msg"/>
</t>
<t t-if="order.payment_tx_id.state == 'done'">
<t t-raw="order.payment_acquirer_id.done_msg"/>
</t>
<t t-if="order.payment_tx_id.state == 'cancel'">
<t t-raw="order.payment_acquirer_id.cancel_msg"/>
</t>
<t t-if="order.payment_tx_id.state == 'error'">
<t t-raw="order.payment_acquirer_id.error_msg"/>
</t>
</t>
</template>
<template id="website.layout_footer_copyright" inherit_id="website.layout" name="Footer Copyright">
<xpath expr="//footer" position="inside">
<div class="container mt16 mb8">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment