diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2019-06-19 12:53:54 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2019-06-19 13:00:02 +0000 |
| commit | 25745d8515212b37c4eaeaf091ef9addf232f1cc (patch) | |
| tree | 7eecf23021135c79db2fe42c2af2e38fd66044f6 /addons/payment_stripe/static | |
| parent | 4f3497c220c8cb16a69fe394379625b0b5dc59b4 (diff) | |
[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>
Diffstat (limited to 'addons/payment_stripe/static')
| -rw-r--r-- | addons/payment_stripe/static/src/js/stripe.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js index 7d8d20a0590..ec60ec4fbc5 100644 --- a/addons/payment_stripe/static/src/js/stripe.js +++ b/addons/payment_stripe/static/src/js/stripe.js @@ -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) {} |
