[FIX] payment_stripe: fix can pay a cancelled order

Issue

	- Install eCommerce, Stripe
	- Setup stripe for testing
	- Order something
	- Open stripe payment interface (not with odoo)
	- Go back with the stripe interface button

	Order Cancelled

	- Go back with browser back button
	- Enter your data

	Can pay but order still cancelled so
	you paid for nothing

Cause

	I fixed a linked error in
	b8b9a04ff5b5b2ba40b26632

	but I didn't mind that we should cancel
	the stripe payment intent too

Solution

	Cancel the stripe payment intent so that
	filling the stripe form by following
	those step will returns an error from
	stripe

OPW-2282946

closes odoo/odoo#53819

X-original-commit: 5acb2a649a2f2490725283c7f4cff5a5183d8ed0
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
This commit is contained in:
jvm-odoo
2020-06-29 14:38:56 +00:00
parent 45138611bc
commit 9b2c05742d
+1
View File
@@ -296,6 +296,7 @@ class PaymentTransactionStripe(models.Model):
return True
if status == 'requires_payment_method':
self._set_transaction_cancel()
self.acquirer_id._stripe_request('payment_intents/%s/cancel' % self.stripe_payment_intent)
return False
else:
error = tree.get("failure_message") or tree.get('error', {}).get('message')