Adding authnet not tested

This commit is contained in:
2025-09-15 15:30:30 -04:00
parent 5a6bcc0700
commit 47e3fb443b
6 changed files with 285 additions and 157 deletions

View File

@@ -18,7 +18,7 @@ def update_customer_auth_net_profile_id(db: Session, customer_id: int, profile_i
return db_customer
def create_customer_card(db: Session, customer_id: int, card_info: schemas.CardCreate, payment_profile_id: str):
last_four = card_info.card_number[-4:]
last_four_digits = card_info.card_number[-4:]
try:
exp_year, exp_month = map(int, card_info.expiration_date.split('-'))
except ValueError:
@@ -26,10 +26,10 @@ def create_customer_card(db: Session, customer_id: int, card_info: schemas.CardC
raise ValueError("Expiration date must be in YYYY-MM format")
db_card = models.Card(
customer_id=customer_id,
user_id=customer_id,
auth_net_payment_profile_id=payment_profile_id,
last_four=last_four,
card_brand="Unknown", # Use a library like 'creditcard' to detect this from the number
last_four_digits=last_four_digits,
type_of_card="Unknown", # Use a library like 'creditcard' to detect this from the number
expiration_year=exp_year,
expiration_month=exp_month
)