Files
odoo_source/addons/payment/views/payment_templates.xml
T
tbe-odoo ffcd95aaa9 [IMP] website_sale: Added S2S payment with new payment form
- Added the support of form payment.
- Fixed payment form's errors not being displayed.
- Fixed a crash when paying on e-commerce with a saved token.
(dev commit, need to clean the code)
2017-08-24 11:20:14 +02:00

102 lines
6.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="Payment Assets Backend" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/payment/static/src/less/payment_acquirer.less"/>
</xpath>
</template>
<template id="payment_tokens_list" name="Payment Tokens list">
<!--
Variables description:
- 'submit_txt' the text displayed inside the submit button
- 'submit_class' the css classes to style the submit button
- 'icon_class' font awesome class (e.g. 'fa-trash', 'fa-lock')
- 'form_action' the URI to the page that will handle the form values
- 'pms' the tokens
- 'checked_pm_id' the payment token that should be checked (for radio buttons)
- 'mode' can take two values, either 'payment' or 'manage'. 'manage' displays the add a new card and delete buttons. 'payment'
display a form that is used to pay and send the information to the form action url.
- 's2s_acquirers' the list of the server2server acquirers
- 'form_acquirers' the list of the payment acquirers to pay with forms
- 'verify_validity' if we need to verify if the payment method is valid when adding a new one
-->
<form t-if="s2s_acquirers or pms or form_acquirers" method="post" t-att-action="form_action if form_action else '#'" class="o_payment_form">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input type="hidden" t-if="verify_validity==True" name="verify_validity" value="1"/>
<div class="panel panel-default">
<t t-foreach="s2s_acquirers" t-as="acq">
<div class="panel-body">
<label>
<t t-if="mode == 'manage'">
<input type="radio" t-att-data-acquirer-id="acq.id" t-att-data-s2s-payment="true" name="pm_id" t-attf-value="new_{{acq.id}}" t-att-class="'hidden' if (len(s2s_acquirers)==1) else ''" t-att-checked="len(s2s_acquirers) == 1"/>
</t>
<t t-else="">
<input type="radio" t-att-data-acquirer-id="acq.id" t-att-data-s2s-payment="true" name="pm_id" t-attf-value="new_{{acq.id}}" t-att-class="'hidden' if (len(s2s_acquirers)==1 and len(pms)==0) else ''" t-att-checked="len(s2s_acquirers)==1 and len(pms)==0"/>
</t>
<t t-esc="acq.name"/>
</label>
<ul class="pull-right list-inline">
<t t-foreach="acq.payment_option_ids" t-as="pm_option">
<li>
<span t-field="pm_option.image_small"
t-options='{"widget": "image", "alt-field": "name"}' />
</li>
</t>
</ul>
</div>
<div t-attf-id="o_payment_add_token_acq_{{acq.id}}" t-attf-class="panel-footer {{'hidden' if (len(s2s_acquirers)&gt;1 and len(pms)==0 and s2s_acquirers[0]!=acq) else 'hidden' if len(pms)&gt;0 else ''}}">
<div class="clearfix">
<t t-raw="acq.form" t-att-data-acquirer-id="acquirer.id"/>
</div>
</div>
</t>
<t tif="mode == 'payment'" t-foreach="form_acquirers" t-as="acq">
<div class="panel-body">
<label>
<!-- TBE TODO: Tout le schmilblick du hidden et checked (pareil pour le s2s juste au dessus) -->
<input type="radio" t-att-data-acquirer-id="acq.id" t-att-data-form-payment="true" name="pm_id" t-attf-value="form_{{acq.id}}"/>
<t t-esc="acq.name"/>
</label>
</div>
<div t-attf-id="o_payment_form_acq_{{acq.id}}" class="panel-footer hidden">
You'll be redirected to the <t t-esc="acq.provider"/> website after clicking on the payment button.
<t t-raw="acq.form"/>
</div>
</t>
<t t-foreach="pms" t-as="pm">
<div class="panel-body">
<label>
<input t-if="mode == 'payment'" type="radio" name="pm_id" t-att-value="pm.id" t-att-checked="checked_pm_id == pm.id"/>
<t t-esc="pm.name"/>
<t t-if="pm.verified">
<i class="fa fa-check text-success" title="This payment method is verified by our system."></i>
</t>
<t t-else="">
<i class="fa fa-close text-danger" title="This payment method has not been verified by our system."></i>
</t>
</label>
<button t-if="mode == 'manage'" name="delete_pm" t-att-value="pm.id" class="btn btn-primary btn-xs pull-right">
<i class="fa fa-trash"></i> Delete
</button>
</div>
</t>
</div>
<div class="pull-right">
<button t-if="mode == 'payment'" id="o_payment_form_pay" type="submit" t-att-class="submit_class if submit_class else 'btn btn-primary btn-lg mb8 mt8'">
<t t-if="submit_txt">
<i t-if="icon_class" t-attf-class="fa {{icon_class}}"/>
<t t-esc="submit_txt"/>
</t>
<t t-else="">
<i class="fa fa-lock"> Pay</i>
</t>
</button>
<button t-if="mode == 'manage'" id="o_payment_form_add_pm" class="btn btn-primary btn-lg mb8 mt8">
<i class="fa fa-plus-circle"> Add new card</i>
</button>
</div>
</form>
</template>
</odoo>