Skip to content

Commit b6adbb4

Browse files
committed
chore: linting errors
1 parent 27772f8 commit b6adbb4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

enterprise_access/apps/api/v1/views/customer_billing.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,14 @@ def create_enterprise_admin_portal_session(self, request, **kwargs):
243243
try:
244244
customer_portal_session = stripe.billing_portal.Session.create(
245245
customer=stripe_customer_id,
246-
return_url="https://enterprise-checkout.stage.edx.org/billing-details/success",
246+
return_url=f"{origin_url}/billing-details/success",
247247
)
248248
except stripe.error.StripeError as e:
249-
# Generic catch-all for other Stripe errors
250249
logger.exception(
251250
f"StripeError creating billing portal session for CheckoutIntent {checkout_intent}: {e}",
252251
)
253252
return Response(customer_portal_session, status=status.HTTP_422_UNPROCESSABLE_ENTITY)
254-
except Exception as e:
255-
# Any other unexpected error
253+
except Exception as e: # pylint: disable=broad-except
256254
logger.exception(
257255
f"General exception creating billing portal session for CheckoutIntent {checkout_intent}: {e}",
258256
)
@@ -264,6 +262,7 @@ def create_enterprise_admin_portal_session(self, request, **kwargs):
264262
status=status.HTTP_200_OK,
265263
content_type='application/json',
266264
)
265+
267266
@extend_schema(
268267
tags=[CUSTOMER_BILLING_API_TAG],
269268
summary='Create a new Customer Portal Session from the enterprise checkout MFE.',
@@ -294,29 +293,27 @@ def create_checkout_portal_session(self, request, pk=None):
294293
return Response(customer_portal_session, status=status.HTTP_404_NOT_FOUND)
295294

296295
if not checkout_intent:
297-
logger.error(f"No checkout intent for id {checkout_intent_id}")
296+
logger.error(f"No checkout intent for id {pk}")
298297
return Response(customer_portal_session, status=status.HTTP_404_NOT_FOUND)
299298

300299
stripe_customer_id = checkout_intent.stripe_customer_id
301300
enterprise_slug = checkout_intent.enterprise_slug
302301

303302
if not (stripe_customer_id or enterprise_slug):
304-
logger.error(f"No stripe customer id or enterprise slug associated to checkout_intent_id:{checkout_intent_id}")
303+
logger.error(f"No stripe customer id or enterprise slug associated to checkout_intent_id:{pk}")
305304
return Response(customer_portal_session, status=status.HTTP_404_NOT_FOUND)
306305

307306
try:
308307
customer_portal_session = stripe.billing_portal.Session.create(
309308
customer=stripe_customer_id,
310-
return_url="https://enterprise-checkout.stage.edx.org/billing-details/success",
309+
return_url=f"{origin_url}/billing-details/success",
311310
)
312311
except stripe.error.StripeError as e:
313-
# Generic catch-all for other Stripe errors
314312
logger.exception(
315313
f"StripeError creating billing portal session for CheckoutIntent {checkout_intent}: {e}",
316314
)
317315
return Response(customer_portal_session, status=status.HTTP_422_UNPROCESSABLE_ENTITY)
318-
except Exception as e:
319-
# Any other unexpected error
316+
except Exception as e: # pylint: disable=broad-except
320317
logger.exception(
321318
f"General exception creating billing portal session for CheckoutIntent {checkout_intent}: {e}",
322319
)

0 commit comments

Comments
 (0)