Fixed e00007 error
This commit is contained in:
@@ -28,6 +28,9 @@ class TransactionType(enum.IntEnum):
|
||||
CHARGE = 0
|
||||
AUTHORIZE = 1
|
||||
CAPTURE = 3
|
||||
|
||||
|
||||
|
||||
# --- NEW CIM CORE FUNCTIONS ---
|
||||
STATE_ID_TO_ABBREVIATION = {
|
||||
0: "MA",
|
||||
@@ -54,7 +57,7 @@ def _parse_authnet_response(response: Optional[AuthNetResponse]) -> Tuple[Transa
|
||||
else:
|
||||
print("DEBUG: No messages attribute")
|
||||
|
||||
if response is not None and hasattr(response, 'messages') and response.messages.resultCode == "Ok":
|
||||
if response.messages.resultCode == "Ok":
|
||||
print("DEBUG: Taking APPROVED path")
|
||||
status = TransactionStatus.APPROVED
|
||||
auth_net_transaction_id = None
|
||||
@@ -491,8 +494,11 @@ def _nuclear_e00121_payment_profile_cleanup(db: Session, customer_id: int, card_
|
||||
customer = crud.get_customer(db, customer_id)
|
||||
|
||||
# Format card data for recreation
|
||||
exp_year = card.expiration_year.zfill(4) if len(card.expiration_year) < 4 else card.expiration_year
|
||||
exp_month = card.expiration_month.zfill(2) if len(card.expiration_month) < 2 else card.expiration_month
|
||||
# Convert to string first to handle cases where database returns int instead of string
|
||||
exp_year_str = str(card.expiration_year)
|
||||
exp_month_str = str(card.expiration_month)
|
||||
exp_year = exp_year_str.zfill(4) if len(exp_year_str) < 4 else exp_year_str
|
||||
exp_month = exp_month_str.zfill(2) if len(exp_month_str) < 2 else exp_month_str
|
||||
exp_date = f"{exp_year}-{exp_month}"
|
||||
|
||||
card_create_data = schemas.CardCreate(
|
||||
|
||||
@@ -24,6 +24,10 @@ def test_transaction_router():
|
||||
"""Test endpoint to verify transaction router is loaded"""
|
||||
return {"test": "transaction router is working"}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@transaction_router.get("/transaction/delivery/{delivery_id}", summary="Get pre-authorization transaction for a delivery")
|
||||
def get_delivery_transaction(delivery_id: int, db: Session = Depends(database.get_db)):
|
||||
"""
|
||||
@@ -98,7 +102,7 @@ def _parse_authnet_response(response):
|
||||
"""
|
||||
Parse Authorize.Net response for transaction status
|
||||
"""
|
||||
if response is not None and hasattr(response, 'messages') and response.messages.resultCode == "Ok":
|
||||
if response.messages.resultCode == "Ok":
|
||||
status = TransactionStatus.APPROVED
|
||||
rejection_reason = None
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user