@@ -179,45 +179,45 @@ def create_checkout_session(self, request, *args, **kwargs):
179
179
180
180
@extend_schema (
181
181
tags = [CUSTOMER_BILLING_API_TAG ],
182
- summary = 'Create a new Customer Portal Session.' ,
182
+ summary = 'Create a new Customer Portal Session from the CheckoutMFE .' ,
183
183
)
184
184
@action (
185
185
detail = True ,
186
186
methods = ['get' ],
187
- url_path = 'create-portal-session' ,
187
+ url_path = 'create-checkout- portal-session' ,
188
188
)
189
189
# TODO: determine permission on this API, must be authenticated at the very least
190
190
# # UUID in path is used as the "permission object" for role-based auth.
191
191
# @permission_required(
192
192
# CUSTOMER_BILLING_CREATE_PORTAL_SESSION_PERMISSION,
193
193
# fn=lambda request, pk: pk
194
194
# )
195
- def create_portal_session (self , request , ** kwargs ):
195
+ def create_checkout_portal_session (self , request , ** kwargs ):
196
196
"""
197
197
Create a new Customer Portal Session. Response dict contains "url" key
198
198
that should be attached to a button that the customer clicks.
199
199
200
200
Response structure defined here: https://docs.stripe.com/api/customer_portal/sessions/create
201
201
"""
202
202
customer_portal_session = None
203
- checkout_intent_id = str (kwargs ['pk' ])
204
- checkout_intent = CheckoutIntent .objects .get (id = checkout_intent_id )
203
+ stripe_customer_id = str (kwargs ['pk' ])
204
+ # checkout_intent = CheckoutIntent.objects.get(id=checkout_intent_id)
205
205
206
- if not checkout_intent :
207
- logger .error (f"No checkout intent for id { checkout_intent_id } " )
208
- return Response (customer_portal_session , status = status .HTTP_404_NOT_FOUND )
206
+ # if not checkout_intent:
207
+ # logger.error(f"No checkout intent for id {checkout_intent_id}")
208
+ # return Response(customer_portal_session, status=status.HTTP_404_NOT_FOUND)
209
+ #
210
+ # stripe_customer_id = checkout_intent.stripe_customer_id
211
+ # enterprise_slug = checkout_intent.enterprise_slug
209
212
210
- stripe_customer_id = checkout_intent .stripe_customer_id
211
- enterprise_slug = checkout_intent .enterprise_slug
212
-
213
- if not (stripe_customer_id or enterprise_slug ):
214
- logger .error (f"No stripe customer id or enterprise slug associated to checkout_intent_id:{ checkout_intent_id } " )
215
- return Response (customer_portal_session , status = status .HTTP_404_NOT_FOUND )
213
+ # if not (stripe_customer_id or enterprise_slug):
214
+ # logger.error(f"No stripe customer id or enterprise slug associated to checkout_intent_id:{checkout_intent_id}")
215
+ # return Response(customer_portal_session, status=status.HTTP_404_NOT_FOUND)
216
216
217
217
try :
218
218
customer_portal_session = stripe .billing_portal .Session .create (
219
219
customer = stripe_customer_id ,
220
- return_url = f"https://portal.edx.org/ { enterprise_slug } " ,
220
+ return_url = f"https://google.com " ,
221
221
)
222
222
except stripe .error .StripeError as e :
223
223
# Generic catch-all for other Stripe errors
0 commit comments