small fixes working great

This commit is contained in:
2025-10-06 21:14:18 -04:00
parent 23a11a7009
commit f0096add0a
7 changed files with 28 additions and 565 deletions

View File

@@ -59,16 +59,16 @@ def _parse_authnet_response(response: Optional[AuthNetResponse]) -> Tuple[Transa
print("DEBUG: No messages attribute")
if response.messages.resultCode == "Ok":
print("DEBUG: Taking APPROVED path")
print("✅✅ DEBUG: Taking APPROVED path")
status = TransactionStatus.APPROVED
auth_net_transaction_id = None
# Extract transaction ID with proper error handling
try:
if hasattr(response, 'transactionResponse') and response.transactionResponse:
if hasattr(response, 'transactionResponse') and response.transactionResponse is not None:
if hasattr(response.transactionResponse, 'transId') and response.transactionResponse.transId:
auth_net_transaction_id = str(response.transactionResponse.transId)
print(f"DEBUG: FOUND transaction ID: {auth_net_transaction_id}")
print(f"✅✅ DEBUG: FOUND transaction ID: {auth_net_transaction_id}")
else:
print("DEBUG: transactionResponse exists but no transId")
else:
@@ -82,7 +82,7 @@ def _parse_authnet_response(response: Optional[AuthNetResponse]) -> Tuple[Transa
print(dir(response.transactionResponse))
rejection_reason = None
print(f"DEBUG: APPROVED - ID: {auth_net_transaction_id}, rejection: {rejection_reason}")
print(f"✅✅✅ DEBUG: APPROVED - ID: {auth_net_transaction_id}, rejection: {rejection_reason}")
else:
print("DEBUG: Taking DECLINED path")
@@ -92,7 +92,7 @@ def _parse_authnet_response(response: Optional[AuthNetResponse]) -> Tuple[Transa
if response is not None:
# Handle transaction response errors
if hasattr(response, 'transactionResponse') and response.transactionResponse:
if hasattr(response, 'transactionResponse') and response.transactionResponse is not None:
if hasattr(response.transactionResponse, 'errors') and response.transactionResponse.errors:
print("DEBUG: Using transactionResponse.errors")
try:
@@ -123,7 +123,7 @@ def _parse_authnet_response(response: Optional[AuthNetResponse]) -> Tuple[Transa
print(f"DEBUG: Exception parsing message error: {e}")
rejection_reason = "Failed to parse message error"
print(f"DEBUG: FINAL RESULT - Status: {status}, ID: {auth_net_transaction_id}, Reason: {rejection_reason}")
print(f"✅✅✅ DEBUG: FINAL RESULT - Status: {status}, ID: {auth_net_transaction_id}, Reason: {rejection_reason}")
return status, auth_net_transaction_id, rejection_reason
@router.post("/customers/{customer_id}/cards", summary="Add a new payment card for a customer")