When registering a payment token, validating it using a payment of a small amount followed by a refund allows ensuring that the method is valid (i.e. checksumming the card number simple ensure the number is valid but not that the card exists). This commit introduces a generic approach that must be implemented for each acquirer that has tokenization support. This commit also introduces a generic payment token registration/usage template that can be adapted according to one's need. payment_ogone: add support for tokens validation
68 lines
3.6 KiB
XML
68 lines
3.6 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:
|
|
- 'payment' set this variable when you're doing a payment, this will allow to display the radio buttons for each tokens and show the submit button
|
|
- 'show_delete' when you want to display the delete button for each token
|
|
- 'show_radio' when you want to display the radio button for each token
|
|
- 'show_submit' when you want to display the submit button at the bottom of the form
|
|
- 'submit_txt' the text displayed inside the submit button
|
|
- 'submit_class' the css classes to style the submit button
|
|
- '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)
|
|
-->
|
|
<form id="payment_tokens_list" method="post" t-att-action="form_action if form_action else '#'">
|
|
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
|
<table class="table table-hover table-striped table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th>Payment Methods</th>
|
|
<th t-if="show_verification_status">Status</th>
|
|
<th t-if="show_delete"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<t t-foreach="pms" t-as="pm">
|
|
<tr>
|
|
<td>
|
|
<t t-if="show_radio or payment">
|
|
<div class="radio">
|
|
<label><input type="radio" name="pm_id" t-att-value="pm.id" t-att-checked="checked_pm_id == pm.id"/><t t-esc="pm.short_name"/></label>
|
|
</div>
|
|
</t>
|
|
<t t-else="1">
|
|
<p><t t-esc="pm.short_name"/></p>
|
|
</t>
|
|
</td>
|
|
<td t-if="show_verification_status"><t t-esc="'Verified' if pm.verified else 'Not Verified'"/></td>
|
|
<td t-if="show_delete"><button type="submit" name="delete_pm_id" t-att-value="pm.id" class="btn btn-xs btn-primary pull-right"><i class="fa fa-trash"> Delete</i></button></td>
|
|
</tr>
|
|
</t>
|
|
<tr t-if="(payment or show_submit) and not delete">
|
|
<th t-if="show_verification_status"></th>
|
|
<th t-if="show_delete"></th>
|
|
<th>
|
|
<button type="submit" t-att-class="submit_class if submit_class else 'btn btn-primary btn-sm mb8 mt8 pull-right'">
|
|
<t t-if="submit_txt">
|
|
<t t-raw="submit_txt"/>
|
|
</t>
|
|
<t t-else="1">
|
|
<span class="fa fa-lock"></span> Pay
|
|
</t>
|
|
</button>
|
|
</th>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</template>
|
|
</odoo>
|