Refactor imports in payment router
- Move local imports of user_create and user_delete to top level - Clean up function bodies
This commit is contained in:
@@ -7,7 +7,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from decimal import Decimal
|
||||
from .. import crud, models, schemas, database
|
||||
from ..services import payment_service
|
||||
from ..services import payment_service, user_create, user_delete
|
||||
from ..services.payment_service import parse_authnet_response
|
||||
from ..constants import TransactionStatus, TransactionType, STATE_ID_TO_ABBREVIATION
|
||||
from config import load_config
|
||||
@@ -98,7 +98,6 @@ def update_card_for_customer(customer_id: int, card_id: int, card_info: schemas.
|
||||
# If payment profile ID is null, refresh from Authorize.Net to sync
|
||||
if not db_card.auth_net_payment_profile_id:
|
||||
logger.debug(f"Payment profile ID is null for card {card_id}, refreshing from Authorize.Net")
|
||||
from ..services import user_create
|
||||
user_create.refresh_customer_payment_profiles(db, customer_id, db_customer.auth_net_profile_id)
|
||||
|
||||
# Re-fetch the card to get the updated payment profile ID
|
||||
@@ -107,7 +106,6 @@ def update_card_for_customer(customer_id: int, card_id: int, card_info: schemas.
|
||||
|
||||
# Delete existing payment profile if it exists
|
||||
if db_card.auth_net_payment_profile_id:
|
||||
from ..services import user_delete
|
||||
delete_success = user_delete._delete_payment_profile(
|
||||
db_customer.auth_net_profile_id, db_card.auth_net_payment_profile_id
|
||||
)
|
||||
@@ -291,7 +289,6 @@ def authorize_saved_card(customer_id: int, transaction_req: schemas.TransactionA
|
||||
logger.debug(f"🔧 DETECTED PAYMENT PROFILE ISSUE - Triggering auto-recovery for customer {customer_id}")
|
||||
|
||||
# Auto-recover: Refresh payment profiles before transaction
|
||||
from ..services import user_create
|
||||
recovery_success = user_create.refresh_customer_payment_profiles(
|
||||
db, customer_id, db_customer.auth_net_profile_id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user