[FIX] payment_stripe: always create a customer for one-shot payments

Following commit ac90aa07, the Customer object was no longer created on
Stripe for one-shot (non-recurring) payments made with Stripe. This
prevented Radar (Stripe's fraud detection tool) to work effectively as
it could not rely on the customer's name and addresses anymore (see
https://docs.stripe.com/radar/integration#recommendations).

This commit forces the creation of a Customer object even for one-shot
payments.

opw-3694379

closes odoo/odoo#155276

X-original-commit: 20efda51fefcc50861d9c73a483b4291e5b7e85d
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Antoine Vandevenne (anv)
2024-02-26 08:26:06 +00:00
parent e24c53906a
commit 68053409ef
@@ -164,10 +164,10 @@ class PaymentTransaction(models.Model):
'mandate': self.token_id.stripe_mandate or None,
})
else:
customer = self._stripe_create_customer()
payment_intent_payload['customer'] = customer['id']
if self.tokenize:
customer = self._stripe_create_customer()
payment_intent_payload.update(
customer=customer['id'],
setup_future_usage='off_session',
**self._stripe_prepare_mandate_options(),
)