[FIX] payment_stripe: save token
- Configure Stripe with 'Save Cards' set to 'Let the customer decide' or 'Always'. - Go to the eCommerce, buy an item - Use Stripe to pay, make sure to check 'Save my payment data' No payment token is saved. It occurs because 2 calls are performed to `/shop/payment/transaction`. The second call, which is used to record the transaction, doesn't contain the `save_token` parameter is not sent. Ideally, we should only make a single call, but since Stripe works a bit differently, we can't prevent it (in stable, at least). Therefore, we work around it by searching the checkbox value. opw-2008275 closes odoo/odoo#34242 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -105,9 +105,17 @@ odoo.define('payment_stripe.stripe', function(require) {
|
||||
var invoice_num = get_input_value("invoice_num");
|
||||
var merchant = get_input_value("merchant");
|
||||
|
||||
// Search if the user wants to save the credit card information
|
||||
var form_save_token = false;
|
||||
var acquirer_form = $('#o_payment_form_acq_' + acquirer_id);
|
||||
if (acquirer_form.length) {
|
||||
form_save_token = acquirer_form.find('input[name="o_payment_form_save_token"]').prop('checked');
|
||||
}
|
||||
|
||||
ajax.jsonRpc(payment_tx_url, 'call', {
|
||||
acquirer_id: acquirer_id,
|
||||
access_token: access_token,
|
||||
save_token: form_save_token,
|
||||
}).then(function(data) {
|
||||
var $pay_stripe = $('#pay_stripe').detach();
|
||||
try { provider_form[0].innerHTML = data; } catch (e) {}
|
||||
|
||||
Reference in New Issue
Block a user