|
@@ -755,19 +755,28 @@ async def stripe_webhook(request: Request, background_tasks: BackgroundTasks):
|
|
|
checkout = event["data"]["object"]
|
|
checkout = event["data"]["object"]
|
|
|
|
|
|
|
|
if "client_reference_id" in checkout:
|
|
if "client_reference_id" in checkout:
|
|
|
- status_res = update_status_order(
|
|
|
|
|
- event["type"],
|
|
|
|
|
- checkout["client_reference_id"],
|
|
|
|
|
- settings.git_repo,
|
|
|
|
|
- settings.local_db.filepath,
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- if status_res is False:
|
|
|
|
|
- main_logger.error("stripe-webhook error: order could not be updated.")
|
|
|
|
|
- raise HTTPException(
|
|
|
|
|
- status_code=400, detail="Order could not be updated."
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ status_res = update_status_order(
|
|
|
|
|
+ event["type"],
|
|
|
|
|
+ checkout["client_reference_id"],
|
|
|
|
|
+ settings.git_repo,
|
|
|
|
|
+ settings.local_db.filepath,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ if status_res is False:
|
|
|
|
|
+ main_logger.error("stripe-webhook error: order could not be updated.")
|
|
|
|
|
+ raise HTTPException(
|
|
|
|
|
+ status_code=400, detail="Order could not be updated."
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ except KeyError as e:
|
|
|
|
|
+ main_logger.error(f"stripe-webhook error: Missing key in order data: {e}")
|
|
|
|
|
+ # Continue processing - we want to still try to send the email
|
|
|
|
|
+
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ main_logger.error(f"stripe-webhook error: Unexpected error updating order: {e}")
|
|
|
|
|
+ # Continue processing
|
|
|
|
|
+
|
|
|
if event["type"] in [
|
|
if event["type"] in [
|
|
|
"checkout.session.completed",
|
|
"checkout.session.completed",
|
|
|
"checkout.session.async_payment_succeeded",
|
|
"checkout.session.async_payment_succeeded",
|