Before this commit, the payment providers (e.g., Stripe, Adyen...) available for payment were displayed on the payment forms. The customer had to select one to process their payment. After that, the customer had to select their preferred payment method (e.g., Credit Card, Bancontact...) from a list of payment methods supported by the selected provider over which the website administrator had close to no control. This was making the payment forms confusing because the payment methods were displayed sometimes more than once, if at all, in a non-controlled order, and behind the selection of a payment provider that customers should not have to deal with. As the payment method was selected in an iframe or directly on the provider's website, the information on the selection payment method was not available in Odoo. This posed many problems, among which were the impossibility of assessing whether a specific feature (e.g., tokenization, refunds, manual capture...) was available, not being able to easily identify payment tokens through the payment method logo, listing available payment methods on the website, sorting and fine-grained configuration of the available payment method, subpar payment method-specific display on the payment form (e.g., PayPal that requires displaying a "Pay with PayPal" button), etc. In this commit, the payment providers are thus replaced by the payment methods on the payment forms. All contextually available (depending on the country, currency, requested feature...) payment methods are displayed one after the other on a single-level list and in the order configured by the website administrator. Each payment method is "powered by" (i.e., linked) to a single payment provider: the first one, by model order, to support it. This allows, for example, offering the PayPal payment method through Mollie, which charges low processing fees, while also offering Klarna through Stripe, which supports more payment methods but charges higher processing fees. While doing so, the two different payment forms, "Checkout" and "Manage", are also merged together in a new, configurable case-by-case, payment form that is entirely redesigned to offer a better user experience. After payment, the information on the selected payment method is saved on the transaction and eventual payment record and updated with the information received from the provider. task-2882677 closes odoo/odoo#120446 Related: odoo/upgrade#5103 Related: odoo/documentation#5717 Related: odoo/enterprise#40666 Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com> Co-authored-by: Anita (anko) <anko@odoo.com> Co-authored-by: Brieuc-brd <brd@odoo.com> Co-authored-by: Valeriya (vchu) <vchu@odoo.com>
140 lines
8.0 KiB
XML
140 lines
8.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<!-- Insert the donation form inside the payment form's <form/> element. -->
|
|
<template id="website_payment.payment_form" inherit_id="payment.form">
|
|
<xpath expr="//div[@id='o_payment_form_options']" position="before">
|
|
<t t-if="is_donation" t-call="website_payment.donation_information"/>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- Display of /donation/pay -->
|
|
<template id="website_payment.donation_pay" name="Donation payment">
|
|
<t t-call="portal.frontend_layout">
|
|
<t t-set="page_title" t-value="'Donation'"/>
|
|
<t t-set="additional_title"><t t-out="page_title"/></t>
|
|
<div class="wrap">
|
|
<div class="oe_structure" id="oe_structure_website_payment_donation_1"/>
|
|
<div class="container mb-3">
|
|
<!-- Portal breadcrumb -->
|
|
<t t-call="payment.portal_breadcrumb"/>
|
|
<!-- Payment page -->
|
|
<div class="row">
|
|
<div class="col-lg-7">
|
|
<div t-if="not amount" class="alert alert-info">
|
|
There is nothing to pay.
|
|
</div>
|
|
<div t-elif="not currency" class="alert alert-warning">
|
|
<strong>Warning</strong> The currency is missing or incorrect.
|
|
</div>
|
|
<div t-elif="not payment_methods_sudo and not tokens_sudo"
|
|
class="alert alert-warning"
|
|
>
|
|
<strong>No suitable payment option could be found.</strong><br/>
|
|
If you believe that it is an error, please contact the website administrator.
|
|
</div>
|
|
<t t-else="" t-call="payment.form"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="oe_structure" id="oe_structure_website_payment_donation_2"/>
|
|
</div>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="website_payment.donation_information" name="Donation Information">
|
|
<h3 class="o_page_header mt16 mb4">Donation</h3>
|
|
<div class="row">
|
|
<div t-attf-class="mb-3 #{error.get('name') and 'o_has_error' or ''} col-lg-12 div_name">
|
|
<label class="col-form-label fw-bold" for="name">Name
|
|
<span class="s_website_form_mark"> *</span>
|
|
</label>
|
|
<input t-att-readonly="'1' if 'name' in partner_details and partner_id else None" type="text" name="name" t-attf-class="form-control #{error.get('name') and 'is-invalid' or ''}" t-att-value="partner_details.get('name')" />
|
|
</div>
|
|
<div class="w-100"/>
|
|
<div t-attf-class="mb-3 #{error.get('email') and 'o_has_error' or ''} col-lg-6" id="div_email">
|
|
<label class="col-form-label fw-bold" for="email">Email
|
|
<span class="s_website_form_mark"> *</span>
|
|
</label>
|
|
<input t-att-readonly="'1' if 'email' in partner_details and partner_id else None" type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="partner_details.get('email')" />
|
|
</div>
|
|
<t t-set="country_id" t-value="partner_details.get('country_id')"/>
|
|
<div t-attf-class="mb-3 #{error.get('country_id') and 'o_has_error' or ''} col-lg-6 div_country">
|
|
<label class="col-form-label fw-bold" for="country_id">Country
|
|
<span class="s_website_form_mark"> *</span>
|
|
</label>
|
|
<select t-att-disabled="'1' if country_id and partner_id else None" id="country_id" name="country_id" t-attf-class="form-select #{error.get('country_id') and 'is-invalid' or ''}">
|
|
<option value="">Country...</option>
|
|
<t t-foreach="countries" t-as="c">
|
|
<option t-att-value="c.id" t-att-selected="c.id == (country_id or -1)">
|
|
<t t-out="c.name" />
|
|
</option>
|
|
</t>
|
|
</select>
|
|
</div>
|
|
<div class="w-100"/>
|
|
<div class="mb-3 col-lg-12 o_donation_payment_form">
|
|
<div class="col-lg-6 px-0">
|
|
<label class="col-form-label fw-bold">Amount (<t t-out="currency.symbol"/>)</label>
|
|
<t t-set="donation_layout" t-value="donation_options.get('customAmount')"/>
|
|
<t t-set="prefilled_options" t-value="donation_options.get('prefilledOptions')"/>
|
|
<t t-if="prefilled_options">
|
|
<t t-foreach="donation_amounts" t-as="donation_amount">
|
|
<div class="form-check my-2">
|
|
<t t-set="is_checked" t-value="float(amount) == float(donation_amount)"/>
|
|
<t t-set="has_checked" t-value="has_checked or is_checked"/>
|
|
<input name="o_donation_amount"
|
|
class="form-check-input"
|
|
type="radio"
|
|
t-attf-id="amount_#{donation_amount_index}"
|
|
t-att-value="donation_amount"
|
|
t-att-checked="is_checked or None"
|
|
/>
|
|
<label class="form-check-label mt-0" t-attf-for="amount_#{donation_amount_index}">
|
|
<t t-out="donation_amount"/>
|
|
<span t-if="donation_options.get('descriptions')" class="text-muted fst-italic ms-1">
|
|
- <t t-out="donation_descriptions[donation_amount_index]"/>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
</t>
|
|
<div t-attf-class="form-check my-2 #{not donation_layout and 'd-none' or ''}">
|
|
<input class="form-check-input" type="radio" id="other_amount" name="amount"
|
|
t-att-value="amount" t-att-checked="not has_checked or None"/>
|
|
<label class="form-check-label mt-0 d-block" for="other_amount"/>
|
|
<t t-call="website_payment.donation_input">
|
|
<t t-set="amount" t-value="not has_checked and amount or ''"/>
|
|
</t>
|
|
</div>
|
|
</t>
|
|
<t t-else="">
|
|
<t t-call="website_payment.donation_input"/>
|
|
</t>
|
|
</div>
|
|
<div class="col-lg-12 px-0">
|
|
<div class="form-check mt-3">
|
|
<input class="form-check-input" type="checkbox" value="" id="donation_comment_checkbox"/>
|
|
<label class="form-check-label" for="donation_comment_checkbox">Write us a comment</label>
|
|
</div>
|
|
<textarea class="form-control d-none mt-2" id="donation_comment" placeholder="Your comment"/>
|
|
</div>
|
|
</div>
|
|
<input type="hidden" name="donation_recipient_email" t-att-value="donation_options.get('donationEmail')"/>
|
|
<div class="w-100"/>
|
|
</div>
|
|
<h3 class="o_page_header mt16 mb4">Payment Details</h3>
|
|
</template>
|
|
|
|
<template id="website_payment.donation_input" name="Donation input">
|
|
<input name="o_donation_amount"
|
|
type="number"
|
|
class="form-control o_amount_input"
|
|
t-att-min="donation_options.get('minimumAmount')"
|
|
t-att-max="donation_options.get('maximumAmount')"
|
|
t-att-value="amount"
|
|
placeholder="Custom Amount"
|
|
/>
|
|
</template>
|
|
|
|
</odoo>
|