[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#61351 X-original-commit: dc18fdba1d4e0d38df0ebce4eed46f8ad08f4821 Related: odoo/enterprise#14597 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
This commit is contained in:
@@ -287,7 +287,7 @@ class CustomerPortal(portal.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(),
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ class CustomerPortal(portal.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.'),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1027,7 +1027,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)
|
||||
@@ -1084,9 +1084,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. """
|
||||
|
||||
Reference in New Issue
Block a user