fixed error code
This commit is contained in:
@@ -115,6 +115,9 @@ def create_customer_profile(customer: schemas.Customer, card_info: schemas.CardC
|
|||||||
logger.error(f"Full API Response: {pprint.pformat(vars(response))}")
|
logger.error(f"Full API Response: {pprint.pformat(vars(response))}")
|
||||||
raise ValueError(error_msg)
|
raise ValueError(error_msg)
|
||||||
|
|
||||||
|
except ValueError:
|
||||||
|
# Re-raise specific ValueError messages we already set above (like E00039)
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"A critical exception occurred during the API call: {traceback.format_exc()}")
|
logger.error(f"A critical exception occurred during the API call: {traceback.format_exc()}")
|
||||||
raise ValueError("Could not connect to the payment gateway.")
|
raise ValueError("Could not connect to the payment gateway.")
|
||||||
|
|||||||
@@ -115,11 +115,15 @@ def create_user_account(db: Session, customer_id: int) -> dict:
|
|||||||
try:
|
try:
|
||||||
auth_profile_id, _ = payment_service.create_customer_profile(customer, card_info)
|
auth_profile_id, _ = payment_service.create_customer_profile(customer, card_info)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.error(f"API call failed: {e}")
|
error_str = str(e)
|
||||||
|
logger.error(f"API call failed: {error_str}")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"success": False,
|
"success": False,
|
||||||
"message": f"Failed to create customer profile: {str(e)}",
|
"message": f"Failed to create customer profile: {error_str}",
|
||||||
"profile_id": None
|
"profile_id": None,
|
||||||
|
"error_detail": error_str,
|
||||||
|
"is_duplicate": "E00039" in error_str
|
||||||
}
|
}
|
||||||
|
|
||||||
if not auth_profile_id:
|
if not auth_profile_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user