@@ -278,7 +278,7 @@ def autocomplete_with_wallet(self, payment):
278278
279279 This method charges a stored payment method without user interaction.
280280 Uses get_renew_data() to retrieve both payment_method_id and customer_id.
281-
281+
282282 If 3D Secure or other authentication is required, raises RedirectNeeded.
283283 """
284284 stripe .api_key = self .api_key
@@ -290,7 +290,7 @@ def autocomplete_with_wallet(self, payment):
290290
291291 payment_method_id = renew_data ["token" ]
292292 customer_id = renew_data .get ("customer_id" )
293-
293+
294294 if not customer_id :
295295 raise PaymentError (
296296 "No customer_id found for recurring payment. "
@@ -311,7 +311,7 @@ def autocomplete_with_wallet(self, payment):
311311 "payment_id" : payment .pk if not self .use_token else None ,
312312 },
313313 }
314-
314+
315315 intent = stripe .PaymentIntent .create (** intent_params )
316316
317317 payment .transaction_id = intent .id
@@ -329,8 +329,7 @@ def autocomplete_with_wallet(self, payment):
329329 if intent .next_action and intent .next_action .type == "redirect_to_url" :
330330 redirect_url = intent .next_action .redirect_to_url .url
331331 raise RedirectNeeded (redirect_url )
332- else :
333- raise PaymentError (f"Payment requires action: { intent .next_action } " )
332+ raise PaymentError (f"Payment requires action: { intent .next_action } " )
334333
335334 elif intent .status in ["requires_payment_method" , "canceled" ]:
336335 # Payment failed
@@ -356,7 +355,7 @@ def autocomplete_with_wallet(self, payment):
356355 def _store_payment_method_from_session (self , payment , session_info ):
357356 """
358357 Extract and store PaymentMethod and Customer from successful Checkout Session.
359-
358+
360359 Called after payment is confirmed to store payment method for future recurring charges.
361360 Extracts customer_id from PaymentIntent (created by Stripe Checkout) and passes
362361 it to implementer via set_renew_token().
@@ -398,7 +397,9 @@ def _store_payment_method_from_session(self, payment, session_info):
398397 except stripe .error .StripeError as e :
399398 # Failed to retrieve payment method, but payment was successful
400399 # Don't fail the payment, just log the error
401- logger .exception ("Failed to store PaymentMethod for payment %s: %s" , payment .id , e )
400+ logger .exception (
401+ "Failed to store PaymentMethod for payment %s: %s" , payment .id , e
402+ )
402403
403404 def process_data (self , payment , request ):
404405 """Processes the event sent by stripe.
0 commit comments