Working site

This commit is contained in:
2026-01-05 08:43:54 -05:00
parent 034beee614
commit be3d93261c
2 changed files with 28 additions and 4 deletions

View File

@@ -135,7 +135,11 @@ def create_customer_profile(customer: schemas.Customer, card_info: schemas.CardC
else:
controller.execute()
response = controller.getresponse()
# Check if response is None (API call failed)
if response is None:
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
try:
if response.messages.resultCode == "Ok":
@@ -389,6 +393,12 @@ def add_payment_profile_to_customer(customer_profile_id: str, customer: schemas.
controller.execute()
response = controller.getresponse()
# Check if response is None (API call failed)
if response is None:
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
if response.messages.resultCode == "Ok":
# Fix: Proper payment profile ID extraction (same bug fix as above)
if hasattr(response, 'customerPaymentProfileId') and response.customerPaymentProfileId:
@@ -440,6 +450,11 @@ def get_customer_payment_profiles(customer_profile_id: str):
response = controller.getresponse()
# Check if response is None (API call failed)
if response is None:
print("ERROR: Authorize.net API call returned None - likely a network/connectivity issue")
raise ValueError("Could not connect to the payment gateway. Please check network connectivity.")
if response.messages.resultCode == "Ok":
payment_profile_ids = []
if response.profile.paymentProfiles is not None: