Adding authnet not tested
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user