[IMP] payment, payment_test: missing payment token identifier

Before this commit payment tokens had no name for Test Payment Acquirer

After this commit tokens generated by Test Payment Acquirer have a name
that combines the last 4 digits of the card number and the card account
holder name

https://github.com/odoo/odoo/issues/50965

closes odoo/odoo#61848

X-original-commit: e20f0650acbd1a7a918375a70ec5c89606523a7b
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Benoit Socias
2020-11-17 12:08:11 +00:00
parent 90546e4aaa
commit 317266d4e3
3 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ msgstr ""
#. openerp-web
#: code:addons/payment/static/src/js/payment_form.js:0
#, python-format
msgid "<p>This card is currently linked to the following records:<p/>"
msgid "This card is currently linked to the following records:"
msgstr ""
#. module: payment
@@ -1926,7 +1926,7 @@ msgstr ""
#. openerp-web
#: code:addons/payment/static/src/js/payment_form.js:0
#, python-format
msgid "We are not able to add your payment method at the moment.</p>"
msgid "We are not able to add your payment method at the moment."
msgstr ""
#. module: payment
+4 -4
View File
@@ -63,7 +63,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
this.$('#payment_error').remove();
var messageResult = '<div class="alert alert-danger mb4" id="payment_error">';
if (title != '') {
messageResult = messageResult + '<b>' + _.str.escapeHTML(title) + ':</b></br>';
messageResult = messageResult + '<b>' + _.str.escapeHTML(title) + ':</b><br/>';
}
messageResult = messageResult + _.str.escapeHTML(message) + '</div>';
$acquirerForm.append(messageResult);
@@ -448,7 +448,7 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
self.displayError(
_t('Server error'),
_t("We are not able to add your payment method at the moment.</p>") +
_t("We are not able to add your payment method at the moment.") +
self._parseError(error)
);
});
@@ -517,10 +517,10 @@ publicWidget.registry.PaymentForm = publicWidget.Widget.extend({
// if there's records linked to this payment method
var content = '';
result[pm_id].forEach(function (sub) {
content += '<p><a href="' + sub.url + '" title="' + sub.description + '">' + sub.name + '</a><p/>';
content += '<p><a href="' + sub.url + '" title="' + sub.description + '">' + sub.name + '</a></p>';
});
content = $('<div>').html(_t('<p>This card is currently linked to the following records:<p/>') + content);
content = $('<div>').html('<p>' + _t('This card is currently linked to the following records:') + '</p>' + content);
// Then we display the list of the records and ask the user if he really want to remove the payment method.
new Dialog(self, {
title: _t('Warning!'),
@@ -31,7 +31,8 @@ class PaymentAcquirerTest(models.Model):
payment_token = self.env['payment.token'].sudo().create({
'acquirer_ref': uuid4(),
'acquirer_id': int(data['acquirer_id']),
'partner_id': int(data['partner_id'])
'partner_id': int(data['partner_id']),
'name': 'XXXXXXXXXXXX%s - %s' % (data['cc_number'][-4:], data['cc_holder_name'])
})
return payment_token