major claude changes

This commit is contained in:
2026-01-28 21:54:54 -05:00
parent 76e881d939
commit 1832c8ab62
15 changed files with 423 additions and 296 deletions

View File

@@ -1,5 +1,8 @@
import logging
import authorizenet.apicontrollers as controllers
from authorizenet import apicontractsv1
logger = logging.getLogger(__name__)
from .. import crud, database, schemas
from config import load_config
from sqlalchemy.orm import Session
@@ -73,7 +76,7 @@ def verify_customer_authorize_account(db: Session, customer_id: int) -> dict:
# Enhanced profile validation - check multiple conditions for profile existence
profile_valid = _is_profile_valid(response)
if not profile_valid:
print(f"Profile {customer.auth_net_profile_id} for customer {customer_id} is invalid/not found. Nulling out in database.")
logger.debug(f"Profile {customer.auth_net_profile_id} for customer {customer_id} is invalid/not found. Nulling out in database.")
# Profile not found or invalid - set auth_net_profile_id to NULL in database
try:
@@ -81,9 +84,9 @@ def verify_customer_authorize_account(db: Session, customer_id: int) -> dict:
customer.auth_net_profile_id = None
db.add(customer) # Mark for update
db.commit() # Persist the change
print(f"Successfully nulled out auth_net_profile_id for customer {customer_id}")
logger.debug(f"Successfully nulled out auth_net_profile_id for customer {customer_id}")
except Exception as update_error:
print(f"Failed to update customer auth_net_profile_id to NULL: {update_error}")
logger.debug(f"Failed to update customer auth_net_profile_id to NULL: {update_error}")
db.rollback() # Rollback on error
return {
@@ -112,7 +115,7 @@ def verify_customer_authorize_account(db: Session, customer_id: int) -> dict:
}
except Exception as e:
print(f"Error verifying customer authorize account for customer {customer_id}: {str(e)}")
logger.debug(f"Error verifying customer authorize account for customer {customer_id}: {str(e)}")
return {
"profile_exists": False,
"has_payment_methods": False,
@@ -163,7 +166,7 @@ def _is_profile_valid(response) -> bool:
return True
except Exception as e:
print(f"Error validating profile response: {str(e)}")
logger.debug(f"Error validating profile response: {str(e)}")
return False
@@ -204,5 +207,5 @@ def _get_customer_profile(profile_id: str):
return response
except Exception as e:
print(f"Error getting customer profile {profile_id}: {str(e)}")
logger.debug(f"Error getting customer profile {profile_id}: {str(e)}")
return None