Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
devksingh4 committed Dec 12, 2023
1 parent 2dea279 commit cd433ae
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions code/aad-enroll/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def lambda_handler(event, context):
aws_aad_secret = get_secret_value(AAD_SECRET_ID, client)

secret = aws_stripe_secret['AAD_ENROLL_ENDPOINT_SECRET']
stripe.api_key = aws_stripe_secret['STRIPE_KEY_CHECKOUT']
try:
if event["queryStringParameters"]["test"]:
print("Using test key")
Expand All @@ -93,9 +94,17 @@ def lambda_handler(event, context):
'body': "Invalid Payload."
}
line_items = None
parsedBody = None
try:
parsedBody = json.loads(body)
except:
return {
'statusCode': 421,
'body': "Invalid JSON Payload."
}
try:
line_items = stripe.checkout.Session.retrieve(
event['data']['object']['id'],
parsedBody['data']['object']['id'],
expand=['line_items'],
).line_items
except Exception:
Expand All @@ -106,7 +115,6 @@ def lambda_handler(event, context):
}
print(line_items)
try:
parsedBody = json.loads(body)
cancel_url = parsedBody['data']['object']['cancel_url']
success_url = parsedBody['data']['object']['success_url']
if cancel_url != "https://acm.illinois.edu/#/membership" or success_url != "https://acm.illinois.edu/#/paid":
Expand Down

0 comments on commit cd433ae

Please sign in to comment.