summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2019-07-19 13:52:05 +0000
committerVictor Feyens <vfe@odoo.com>2019-08-12 08:45:50 +0000
commit9940bdb32aba0ac5c88ce56489be34322f5c066a (patch)
tree7d229d856f6ba7393f6f88c8f40d341b59aa379e
parentf0e059e6010605b5cce2a3055ed3aaf7730534fa (diff)
[REF] payment : messaging and payment display
Co-Authored-By: William Andre <wan@odoo.com>
-rw-r--r--addons/account_payment/views/account_portal_templates.xml3
-rw-r--r--addons/payment/controllers/portal.py5
-rw-r--r--addons/payment/data/payment_acquirer_data.xml9
-rw-r--r--addons/payment/models/payment_acquirer.py14
-rw-r--r--addons/payment/views/payment_portal_templates.xml19
-rw-r--r--addons/payment/views/payment_templates.xml4
-rw-r--r--addons/payment/views/payment_views.xml6
-rw-r--r--addons/payment/wizards/payment_acquirer_onboarding_wizard.py4
-rw-r--r--addons/payment_transfer/data/payment_acquirer_data.xml9
-rw-r--r--addons/payment_transfer/models/payment.py16
-rw-r--r--addons/payment_transfer/views/payment_views.xml8
-rw-r--r--addons/website_event_sale/static/tests/tours/website_event_sale.js2
-rw-r--r--addons/website_sale/static/tests/tours/website_sale_buy.js2
13 files changed, 51 insertions, 50 deletions
diff --git a/addons/account_payment/views/account_portal_templates.xml b/addons/account_payment/views/account_portal_templates.xml
index 9bb739202bd..a48a322ba75 100644
--- a/addons/account_payment/views/account_portal_templates.xml
+++ b/addons/account_payment/views/account_portal_templates.xml
@@ -132,8 +132,7 @@
<t t-if="success == 'pay_invoice'">
<t t-set="payment_tx_id" t-value="invoice.get_portal_last_transaction()"/>
<span t-if='payment_tx_id.acquirer_id.done_msg' t-raw="payment_tx_id.acquirer_id.done_msg"/>
- <span t-if='payment_tx_id.acquirer_id.post_msg' t-raw="payment_tx_id.acquirer_id.post_msg"/>
- <div t-if="payment_tx_id.acquirer_id.post_msg and payment_tx_id.acquirer_id.provider == 'transfer' and invoice.ref">
+ <div t-if="payment_tx_id.acquirer_id.pending_msg and payment_tx_id.acquirer_id.provider == 'transfer' and invoice.ref">
<b>Communication: </b><span t-esc='invoice.ref'/>
</div>
</t>
diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py
index 8817134b8b6..f4cb0e679c0 100644
--- a/addons/payment/controllers/portal.py
+++ b/addons/payment/controllers/portal.py
@@ -79,7 +79,7 @@ class PaymentProcessing(http.Controller):
}
# populate the returned dictionnary with the transactions data
for tx in payment_transaction_ids:
- message_to_display = tx.acquirer_id[tx.state + '_msg'] if tx.state in ['done', 'pending', 'cancel', 'error'] else None
+ message_to_display = tx.acquirer_id[tx.state + '_msg'] if tx.state in ['done', 'pending', 'cancel'] else None
result['transactions'].append({
'reference': tx.reference,
'state': tx.state,
@@ -280,9 +280,6 @@ class WebsitePayment(http.Controller):
elif tx.state == 'pending':
status = 'warning'
message = tx.acquirer_id.pending_msg
- else:
- status = 'danger'
- message = tx.acquirer_id.error_msg
PaymentProcessing.remove_payment_transaction(tx)
return request.render('payment.confirm', {'tx': tx, 'status': status, 'message': message})
else:
diff --git a/addons/payment/data/payment_acquirer_data.xml b/addons/payment/data/payment_acquirer_data.xml
index 00d60e03933..781a04658c4 100644
--- a/addons/payment/data/payment_acquirer_data.xml
+++ b/addons/payment/data/payment_acquirer_data.xml
@@ -14,6 +14,7 @@
<record id="payment_acquirer_buckaroo" model="payment.acquirer">
<field name="name">Buckaroo</field>
+ <field name="display_as">Credit Card (powered by Buckaroo)</field>
<field name="image_128" type="base64" file="payment_buckaroo/static/src/img/buckaroo_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_buckaroo"/>
@@ -36,6 +37,7 @@
<record id="payment_acquirer_ingenico" model="payment.acquirer">
<field name="name">Ingenico</field>
+ <field name="display_as">Credit Card (powered by Ingenico)</field>
<field name="sequence">2</field>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="image_128" type="base64" file="payment_ingenico/static/src/img/ingenico_icon.png"/>
@@ -60,6 +62,7 @@
<record id="payment_acquirer_adyen" model="payment.acquirer">
<field name="name">Adyen</field>
+ <field name="display_as">Credit Card (powered by Adyen)</field>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="image_128" type="base64" file="payment_adyen/static/src/img/adyen_icon.png"/>
<field name="module_id" ref="base.module_payment_adyen"/>
@@ -85,6 +88,7 @@
<record id="payment_acquirer_authorize" model="payment.acquirer">
<field name="name">Authorize.net</field>
+ <field name="display_as">Credit Card (powered by Authorize)</field>
<field name="sequence">3</field>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="image_128" type="base64" file="payment_authorize/static/src/img/authorize_icon.png"/>
@@ -126,6 +130,7 @@
<record id="payment_acquirer_sips" model="payment.acquirer">
<field name="name">Sips</field>
+ <field name="display_as">Credit Card (powered by Sips)</field>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="image_128" type="base64" file="payment_sips/static/src/img/sips_icon.png"/>
<field name="module_id" ref="base.module_payment_sips"/>
@@ -178,6 +183,7 @@
<record id="payment_acquirer_stripe" model="payment.acquirer">
<field name="name">Stripe</field>
+ <field name="display_as">Credit Card (powered by Stripe)</field>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="image_128" type="base64" file="payment_stripe/static/src/img/stripe_icon.png"/>
<field name="module_id" ref="base.module_payment_stripe"/>
@@ -207,6 +213,7 @@
<record id="payment_acquirer_payu" model="payment.acquirer">
<field name="name">PayUmoney</field>
+ <field name="display_as">Credit Card (powered by PayUmoney)</field>
<field name="image_128" type="base64" file="payment_payumoney/static/src/img/payumoney_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_payumoney"/>
@@ -230,6 +237,7 @@
<record id="payment_acquirer_payulatam" model="payment.acquirer">
<field name="name">PayU Latam</field>
+ <field name="display_as">Credit Card (powered by PayU Latam)</field>
<field name="image_128" type="base64" file="payment_payulatam/static/src/img/payulatam_icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_payulatam"/>
@@ -252,6 +260,7 @@
<record id="payment_acquirer_alipay" model="payment.acquirer">
<field name="name">Alipay</field>
+ <field name="display_as">Credit Card (powered by Alipay)</field>
<field name="image_128" type="base64" file="payment_alipay/static/description/icon.png"/>
<field name="view_template_id" ref="default_acquirer_button"/>
<field name="module_id" ref="base.module_payment_alipay"/>
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index bbe6fa81c69..036da717066 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -66,10 +66,11 @@ class PaymentAcquirer(models.Model):
name = fields.Char('Name', required=True, translate=True)
color = fields.Integer('Color', compute='_compute_color', store=True)
+ display_as = fields.Char('Displayed as', translate=True, help="How the acquirer is displayed to the customers.")
description = fields.Html('Description')
sequence = fields.Integer('Sequence', default=10, help="Determine the display order")
provider = fields.Selection(
- selection=[('manual', 'Manual Configuration')], string='Provider',
+ selection=[('manual', 'Custom Payment Form')], string='Provider',
default='manual', required=True)
company_id = fields.Many2one(
'res.company', 'Company',
@@ -116,9 +117,10 @@ class PaymentAcquirer(models.Model):
pre_msg = fields.Html(
'Help Message', translate=True,
help='Message displayed to explain and help the payment process.')
- post_msg = fields.Html(
- 'Thanks Message', translate=True,
- help='Message displayed after having done the payment process.')
+ auth_msg = fields.Html(
+ 'Authorize Message', translate=True,
+ default=lambda s: _('Your payment has been authorized.'),
+ help='Message displayed if payment is authorized.')
pending_msg = fields.Html(
'Pending Message', translate=True,
default=lambda s: _('Your payment has been successfully processed but is waiting for approval.'),
@@ -131,10 +133,6 @@ class PaymentAcquirer(models.Model):
'Cancel Message', translate=True,
default=lambda s: _('Your payment has been cancelled.'),
help='Message displayed, if order is cancel during the payment process.')
- error_msg = fields.Html(
- 'Error Message', translate=True,
- default=lambda s: _('<i>Error,</i> Please be aware that an error occurred during the transaction. The order has been confirmed but will not be paid. Do not hesitate to contact us if you have any questions on the status of your order.'),
- help='Message displayed, if error is occur during the payment process.')
save_token = fields.Selection([
('none', 'Never'),
('ask', 'Let the customer decide'),
diff --git a/addons/payment/views/payment_portal_templates.xml b/addons/payment/views/payment_portal_templates.xml
index d09b7a6d779..75d4008173b 100644
--- a/addons/payment/views/payment_portal_templates.xml
+++ b/addons/payment/views/payment_portal_templates.xml
@@ -45,9 +45,6 @@
<div class="wrap">
<div class="container o_website_payment">
<h1>Payment</h1>
- <div t-if="error_msg" class="alert alert-danger" role="alert">
- <t t-esc="error_msg"/>
- </div>
<div class="row mt32 mb32">
<div class="col-lg-7">
<p><b>Reference:</b> <t t-esc="reference"/></p>
@@ -78,9 +75,6 @@
<div class="col-lg-6">
<div>
<div t-attf-class="alert alert-#{status}" t-raw="message" role="status"/>
- <div class="panel-body" t-if="tx.acquirer_id.post_msg">
- <t t-raw="tx.acquirer_id.post_msg"/>
- </div>
<div class="form-group row">
<label for="form_partner_name" class="col-md-3 col-form-label">From</label>
<div class="col-md-9">
@@ -129,13 +123,11 @@
To be called with the 'payment_tx_id' value.
-->
- <t t-set="thanks_msg" t-value="payment_tx_id.acquirer_id.post_msg"/>
- <t t-set="thanks_msg" t-value="thanks_msg and thanks_msg != '&lt;p&gt;&lt;br&gt;&lt;/p&gt;' and thanks_msg"/>
<div t-if="payment_tx_id and payment_tx_id.state == 'pending'" class="alert alert-warning alert-dismissable" role="status">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">&amp;times;</button>
<span t-if='payment_tx_id.acquirer_id.pending_msg' t-raw="payment_tx_id.acquirer_id.pending_msg"/>
<span t-if='thanks_msg' t-raw="thanks_msg"/>
- <div t-if="thanks_msg and payment_tx_id.acquirer_id.provider == 'transfer' and reference">
+ <div t-if="payment_tx_id.acquirer_id.provider == 'transfer' and reference">
<b>Communication: </b><span t-esc='reference'/>
</div>
<div t-if="(payment_tx_id.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (payment_tx_id.acquirer_id.qr_code == True) and (payment_tx_id.currency_id.name == 'EUR')">
@@ -148,13 +140,10 @@
</div>
</div>
</div>
- <div t-if="payment_tx_id and payment_tx_id.state == 'authorized'" class="alert alert-success alert-dismissable" role="alert">
+ <div t-if="payment_tx_id and payment_tx_id.state == 'authorized' and payment_tx_id.acquirer_id.authorize_implemented" class="alert alert-success alert-dismissable" role="alert">
<button type="button" class="close" data-dismiss="alert" title="Dismiss" aria-label="Dismiss">&amp;times;</button>
- Your payment has been authorized.
- <span t-if='thanks_msg' t-raw="thanks_msg"/>
- <div t-if="thanks_msg and payment_tx_id.acquirer_id.provider == 'transfer' and reference">
- <b>Communication: </b><span t-esc='reference'/>
- </div>
+ <!-- Your payment has been authorized. -->
+ <span t-if='payment_tx_id.acquirer_id.auth_msg' t-raw="payment_tx_id.acquirer_id.auth_msg"/>
</div>
<div t-if="payment_tx_id and payment_tx_id.state == 'done'" class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" title="Dismiss" aria-label="Dismiss">&amp;times;</button>
diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml
index 029672dc046..bdecb6a5e1c 100644
--- a/addons/payment/views/payment_templates.xml
+++ b/addons/payment/views/payment_templates.xml
@@ -63,7 +63,7 @@
t-att-class="'d-none' if (acquirers_count==1 and pms_count==0) else ''"
t-att-checked="acquirers_count==1 and pms_count==0 or acquirers[0] == acq"/>
</t>
- <span class="payment_option_name" t-esc="acq.name"/>
+ <span class="payment_option_name" t-esc="acq.display_as or acq.name"/>
<t t-if="acq_extra_fees and acq_extra_fees.get(acq)">
<span class="badge badge-pill badge-secondary"> + <t t-esc="acq_extra_fees[acq]" t-options='{"widget": "monetary", "display_currency": acq_extra_fees["currency_id"]}'/> Fee </span>
</t>
@@ -86,7 +86,7 @@
<t t-set="i" t-value="i+1"/>
</t>
</ul>
- <div><t t-raw="acq.pre_msg"/></div>
+ <div t-raw="acq.pre_msg" class="text-muted ml-3"/>
</div>
<t t-if="acq.payment_flow == 'form'">
<div t-attf-id="o_payment_form_acq_{{acq.id}}"
diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml
index 1968e13790b..cd510d60d77 100644
--- a/addons/payment/views/payment_views.xml
+++ b/addons/payment/views/payment_views.xml
@@ -48,6 +48,7 @@
<page string="Configuration">
<group name="acquirer_config">
<group string="Payment Form" name="payment_form">
+ <field name="display_as" placeholder="If not defined, the acquirer name will be used."/>
<field name="payment_icon_ids" widget="many2many_tags"/>
<field name="save_token" widget="radio" attrs="{'invisible': ['|', ('token_implemented', '=', False), ('payment_flow', '=', 's2s')]}"/>
<field name="capture_manually" attrs="{'invisible': [('authorize_implemented', '=', False)]}"/>
@@ -76,12 +77,11 @@
</page>
<page string="Messages" attrs="{'invisible': [('module_id', '=', True), ('module_state', '!=', 'installed')]}">
<group>
- <field name="pre_msg" invisible="1"/>
- <field name="post_msg"/>
+ <field name="pre_msg"/>
+ <field name="auth_msg" attrs="{'invisible': [('authorize_implemented', '=', False)]}"/>
<field name="pending_msg"/>
<field name="done_msg"/>
<field name="cancel_msg"/>
- <field name="error_msg"/>
</group>
</page>
</notebook>
diff --git a/addons/payment/wizards/payment_acquirer_onboarding_wizard.py b/addons/payment/wizards/payment_acquirer_onboarding_wizard.py
index 1c29cc2a0d6..c6b4607fc22 100644
--- a/addons/payment/wizards/payment_acquirer_onboarding_wizard.py
+++ b/addons/payment/wizards/payment_acquirer_onboarding_wizard.py
@@ -77,7 +77,7 @@ class PaymentWizard(models.TransientModel):
journal = manual_payment.journal_id
self._payment_acquirer_onboarding_cache['manual_name'] = manual_payment['name']
- self._payment_acquirer_onboarding_cache['manual_post_msg'] = manual_payment['post_msg']
+ self._payment_acquirer_onboarding_cache['manual_post_msg'] = manual_payment['pending_msg']
self._payment_acquirer_onboarding_cache['journal_name'] = journal.name if journal.name != "Bank" else ""
self._payment_acquirer_onboarding_cache['acc_number'] = journal.bank_acc_number
@@ -131,7 +131,7 @@ class PaymentWizard(models.TransientModel):
'Please create one from the Payment Acquirer menu.'
))
manual_acquirer.name = self.manual_name
- manual_acquirer.post_msg = self.manual_post_msg
+ manual_acquirer.pending_msg = self.manual_post_msg
manual_acquirer.state = 'enabled'
journal = manual_acquirer.journal_id
diff --git a/addons/payment_transfer/data/payment_acquirer_data.xml b/addons/payment_transfer/data/payment_acquirer_data.xml
index 47f4986778b..46801109433 100644
--- a/addons/payment_transfer/data/payment_acquirer_data.xml
+++ b/addons/payment_transfer/data/payment_acquirer_data.xml
@@ -12,6 +12,15 @@
<field name="pre_msg"><![CDATA[
<p>Transfer information will be provided when clicking 'Pay Now'.</p>]]>
</field>
+ <field name="pending_msg">
+ <![CDATA[
+ <h3>Please make a payment to: </h3>
+ <ul>
+ <li>Bank:&nbsp;</li>
+ <li>Account Number:</li>
+ <li>Account Holder: </li>
+ </ul>]]>
+ </field>
</record>
</data>
</odoo>
diff --git a/addons/payment_transfer/models/payment.py b/addons/payment_transfer/models/payment.py
index c363f551253..96a6167d919 100644
--- a/addons/payment_transfer/models/payment.py
+++ b/addons/payment_transfer/models/payment.py
@@ -52,17 +52,17 @@ class TransferPaymentAcquirer(models.Model):
@api.model
def create(self, values):
- """ Hook in create to create a default post_msg. This is done in create
- to have access to the name and other creation values. If no post_msg
- or a void post_msg is given at creation, generate a default one. """
- if values.get('provider') == 'transfer' and not values.get('post_msg'):
- values['post_msg'] = self._format_transfer_data()
+ """ Hook in create to create a default pending_msg. This is done in create
+ to have access to the name and other creation values. If no pending_msg
+ or a void pending_msg is given at creation, generate a default one. """
+ if values.get('provider') == 'transfer' and not values.get('pending_msg'):
+ values['pending_msg'] = self._format_transfer_data()
return super(TransferPaymentAcquirer, self).create(values)
def write(self, values):
- """ Hook in write to create a default post_msg. See create(). """
- if all(not acquirer.post_msg and acquirer.provider != 'transfer' for acquirer in self) and values.get('provider') == 'transfer':
- values['post_msg'] = self._format_transfer_data()
+ """ Hook in write to create a default pending_msg. See create(). """
+ if not values.get('pending_msg', False) and all(not acquirer.pending_msg and acquirer.provider != 'transfer' for acquirer in self) and values.get('provider') == 'transfer':
+ values['pending_msg'] = self._format_transfer_data()
return super(TransferPaymentAcquirer, self).write(values)
diff --git a/addons/payment_transfer/views/payment_views.xml b/addons/payment_transfer/views/payment_views.xml
index a126bb67626..659c1cbfe52 100644
--- a/addons/payment_transfer/views/payment_views.xml
+++ b/addons/payment_transfer/views/payment_views.xml
@@ -6,15 +6,15 @@
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<page name="acquirer_credentials" position="attributes">
- <attribute name="attrs">{'invisible': [('provider', '=', 'transfer')]}</attribute>
+ <attribute name="attrs">{'invisible': [('provider', 'in', ['manual', 'transfer'])]}</attribute>
</page>
- <field name="done_msg" position="attributes">
+ <field name="pre_msg" position="attributes">
<attribute name="attrs">{'invisible': [('provider', '=', 'transfer')]}</attribute>
</field>
- <field name="cancel_msg" position="attributes">
+ <field name="done_msg" position="attributes">
<attribute name="attrs">{'invisible': [('provider', '=', 'transfer')]}</attribute>
</field>
- <field name="error_msg" position="attributes">
+ <field name="cancel_msg" position="attributes">
<attribute name="attrs">{'invisible': [('provider', '=', 'transfer')]}</attribute>
</field>
</field>
diff --git a/addons/website_event_sale/static/tests/tours/website_event_sale.js b/addons/website_event_sale/static/tests/tours/website_event_sale.js
index cc47240105c..7dd94afb52c 100644
--- a/addons/website_event_sale/static/tests/tours/website_event_sale.js
+++ b/addons/website_event_sale/static/tests/tours/website_event_sale.js
@@ -85,7 +85,7 @@ tour.register('event_buy_tickets', {
},
{
content: "Last step",
- trigger: '.oe_website_sale:contains("Pending... The order will be validated after the payment.")',
+ trigger: '.oe_website_sale:contains("Please make a payment to:")',
timeout: 30000,
}
]
diff --git a/addons/website_sale/static/tests/tours/website_sale_buy.js b/addons/website_sale/static/tests/tours/website_sale_buy.js
index 952f0cd5f00..436e99d4be3 100644
--- a/addons/website_sale/static/tests/tours/website_sale_buy.js
+++ b/addons/website_sale/static/tests/tours/website_sale_buy.js
@@ -75,7 +75,7 @@ tour.register('shop_buy_product', {
},
{
content: "finish",
- trigger: '.oe_website_sale:contains("Pending... The order will be validated after the payment.")',
+ trigger: '.oe_website_sale:contains("Please make a payment to:")',
timeout: 30000,
}
]