Updated config

This commit is contained in:
2025-09-19 19:20:32 -04:00
parent 8a6da448bb
commit 569e76f21e
6 changed files with 43 additions and 19 deletions

View File

@@ -9,12 +9,20 @@ logger = logging.getLogger(__name__)
# Load Authorize.net credentials # Load Authorize.net credentials
ApplicationConfig = load_config() ApplicationConfig = load_config()
API_LOGIN_ID = '9U6w96gZmX' # Sandbox credentials API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = '94s6Qy458mMNJr7G' TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
# Set Authorize.net environment based on configuration
from authorizenet.constants import constants from authorizenet.constants import constants
constants.show_url_on_request = True
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
constants.environment = constants.PRODUCTION
else:
constants.environment = constants.SANDBOX constants.environment = constants.SANDBOX
constants.show_url_on_request = True
def verify_customer_authorize_account(db: Session, customer_id: int) -> dict: def verify_customer_authorize_account(db: Session, customer_id: int) -> dict:
""" """
Verify if customer has a valid Authorize.net account set up for charging. Verify if customer has a valid Authorize.net account set up for charging.

View File

@@ -19,16 +19,17 @@ logger = logging.getLogger(__name__)
# Load Authorize.net credentials # Load Authorize.net credentials
ApplicationConfig = load_config() ApplicationConfig = load_config()
# API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
# TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
# Authorize.net credentials (Sandbox Test Credentials)
API_LOGIN_ID = '9U6w96gZmX' # Set Authorize.net environment based on configuration
TRANSACTION_KEY = '94s6Qy458mMNJr7G' if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
# --- MODIFICATION: Set the environment globally --- constants.environment = constants.PRODUCTION
# Set this to SANDBOX for testing, PRODUCTION for live else:
constants.show_url_on_request = True # Very useful for debugging
constants.environment = constants.SANDBOX constants.environment = constants.SANDBOX
constants.show_url_on_request = True # Very useful for debugging
def _get_authnet_error_message(response): def _get_authnet_error_message(response):

View File

@@ -17,11 +17,17 @@ logger = logging.getLogger(__name__)
# Load Authorize.net credentials # Load Authorize.net credentials
ApplicationConfig = load_config() ApplicationConfig = load_config()
API_LOGIN_ID = '9U6w96gZmX' API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = '94s6Qy458mMNJr7G' TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
constants.show_url_on_request = True
# Set Authorize.net environment based on configuration
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
constants.environment = constants.PRODUCTION
else:
constants.environment = constants.SANDBOX constants.environment = constants.SANDBOX
constants.show_url_on_request = True
def _get_error_message(response): def _get_error_message(response):
""" """

View File

@@ -13,11 +13,17 @@ logger = logging.getLogger(__name__)
# Load Authorize.net credentials # Load Authorize.net credentials
ApplicationConfig = load_config() ApplicationConfig = load_config()
API_LOGIN_ID = '9U6w96gZmX' API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = '94s6Qy458mMNJr7G' TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
constants.show_url_on_request = True
# Set Authorize.net environment based on configuration
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
constants.environment = constants.PRODUCTION
else:
constants.environment = constants.SANDBOX constants.environment = constants.SANDBOX
constants.show_url_on_request = True
def _get_authnet_error_message(response): def _get_authnet_error_message(response):
""" """

View File

@@ -13,6 +13,9 @@ def load_config(mode=os.environ.get('MODE')):
return ApplicationConfig return ApplicationConfig
elif mode == 'DEVELOPMENT': elif mode == 'DEVELOPMENT':
print("poop")
print("poop")
print("poop")
from settings_dev import ApplicationConfig from settings_dev import ApplicationConfig
return ApplicationConfig return ApplicationConfig
else: else:

View File

@@ -4,6 +4,8 @@ class ApplicationConfig:
""" """
Basic Configuration for a generic User Basic Configuration for a generic User
""" """
API_LOGIN_ID = '9U6w96gZmX'
TRANSACTION_KEY = '94s6Qy458mMNJr7G'
CURRENT_SETTINGS = 'DEVELOPMENT' CURRENT_SETTINGS = 'DEVELOPMENT'
# databases info # databases info
POSTGRES_USERNAME = 'postgres' POSTGRES_USERNAME = 'postgres'
@@ -32,5 +34,3 @@ class ApplicationConfig:
# # Authorize.net credentials (Sandbox Test Credentials) # # Authorize.net credentials (Sandbox Test Credentials)
# API_LOGIN_ID = '5KP3u95bQpv' # API_LOGIN_ID = '5KP3u95bQpv'
# TRANSACTION_KEY = '346HZ32z3fP4hTG2' # TRANSACTION_KEY = '346HZ32z3fP4hTG2'
API_LOGIN_ID = '9U6w96gZmX'
TRANSACTION_KEY = '94s6Qy458mMNJr7G'