small fixes working great

This commit is contained in:
2025-10-06 21:14:18 -04:00
parent 23a11a7009
commit f0096add0a
7 changed files with 28 additions and 565 deletions

View File

@@ -25,11 +25,11 @@ if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
else:
constants.environment = constants.SANDBOX
constants.show_url_on_request = True # Very useful for debugging
VALIDATION_MODE = "testMode"
API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
constants.show_url_on_request = True # Very useful for debugging
def _is_e00121_response(response):
"""
@@ -71,7 +71,7 @@ def _get_authnet_error_message(response):
return "No response from payment gateway."
try:
if hasattr(response, 'messages') and response.messages is not None:
if hasattr(response, 'transactionResponse') and response.transactionResponse and hasattr(response.transactionResponse, 'errors') and response.transactionResponse.errors:
if hasattr(response, 'transactionResponse') and response.transactionResponse is not None and hasattr(response.transactionResponse, 'errors') and response.transactionResponse.errors:
error = response.transactionResponse.errors[0]
return f"Error {error.errorCode}: {error.errorText}"
if hasattr(response.messages, 'message'):
@@ -251,11 +251,11 @@ def _perform_authorization(customer_profile_id: str, payment_profile_id: str, tr
response = controller.getresponse()
# Log response details
if response and hasattr(response, 'messages'):
if response is not None and hasattr(response, 'messages'):
result_code = getattr(response.messages, 'resultCode', 'Unknown')
print(f"Authorize response: resultCode='{result_code}'")
print(f"Authorize response: resultCode='{result_code}'")
else:
print("Authorize response: No standard response structure")
print("Authorize response: No standard response structure")
return response