diff options
| author | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-10-20 14:02:27 +0000 |
|---|---|---|
| committer | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-11-04 15:50:01 +0000 |
| commit | cbca0e103bda3bce92779bbb2a718b210a71846f (patch) | |
| tree | 4d1ad9f1f3915367299b4bc74a18d05d0ce36ddf | |
| parent | 0719f1dd9471705c7486236adb74d5825173831b (diff) | |
[FIX] sale: keep card info on form save
Configure card payment provider (stripe, Authorize, etc) in test mode
Allow the customer to decide if saving payment info
Go to web shop, fill cart and checkout
Select provider and check "save payment method"
After payment the card info is not saved:
the related check variable is overridden in the process.
Note: this occur only when using the provider site.
S2S payment via Odoo follows a different flow
opw-2335237
closes odoo/odoo#61346
X-original-commit: dc18fdba1d4e0d38df0ebce4eed46f8ad08f4821
Related: odoo/enterprise#14593
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
| -rw-r--r-- | addons/sale/controllers/portal.py | 4 | ||||
| -rw-r--r-- | addons/sale/models/sale.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py index d6ca334e5e2..e02361680a0 100644 --- a/addons/sale/controllers/portal.py +++ b/addons/sale/controllers/portal.py @@ -286,7 +286,7 @@ class CustomerPortal(CustomerPortal): # Create transaction vals = { 'acquirer_id': acquirer_id, - 'type': order._get_payment_type(), + 'type': order._get_payment_type(save_token), 'return_url': order.get_portal_url(), } @@ -296,7 +296,7 @@ class CustomerPortal(CustomerPortal): order, submit_txt=_('Pay & Confirm'), render_values={ - 'type': order._get_payment_type(), + 'type': order._get_payment_type(save_token), 'alias_usage': _('If we store your payment information on our server, subscription payments will be made automatically.'), } ) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index a3eaad48200..418252d9b54 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1020,7 +1020,7 @@ Reason(s) of this behavior could be: 'currency_id': currency.id, 'partner_id': partner.id, 'sale_order_ids': [(6, 0, self.ids)], - 'type': self[0]._get_payment_type(), + 'type': self[0]._get_payment_type(vals.get('type')=='form_save'), }) transaction = self.env['payment.transaction'].create(vals) @@ -1077,9 +1077,9 @@ Reason(s) of this behavior could be: return self.get_portal_url(query_string='&%s' % auth_param) return super(SaleOrder, self)._get_share_url(redirect, signup_partner, pid) - def _get_payment_type(self): + def _get_payment_type(self, tokenize=False): self.ensure_one() - return 'form' + return 'form_save' if tokenize else 'form' def _get_portal_return_action(self): """ Return the action used to display orders when returning from customer portal. """ |
