added config for authorize

This commit is contained in:
2025-10-06 21:13:47 -04:00
parent a10bf5c8af
commit b9f3b4a3c0
2 changed files with 40 additions and 9 deletions

View File

@@ -22,6 +22,10 @@ from authorizenet.apicontrollers import (
createCustomerPaymentProfileController
)
from config import load_config # Assuming you have this
# Load Authorize.net credentials
ApplicationConfig = load_config()
# --- ROUTER DEFINITION ---
router = APIRouter(
@@ -30,11 +34,20 @@ router = APIRouter(
responses={404: {"description": "Not found"}},
)
API_LOGIN_ID = '9U6w96gZmX'
TRANSACTION_KEY = '94s6Qy458mMNJr7G'
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
constants.environment = constants.PRODUCTION
VALIDATION_MODE = "liveMode"
API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
else:
constants.environment = constants.SANDBOX
constants.show_url_on_request = True
VALIDATION_MODE = "testMode"
API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
constants.show_url_on_request = True
constants.environment = constants.SANDBOX
state_abbrevs = ['MA', 'RI', 'NH', 'ME', 'VT', 'CT', 'NY']
@router.post("/maintenance/migrate-cards-now")
@@ -176,8 +189,12 @@ def run_card_migration_synchronously():
validationMode="testMode"
)
controller = createCustomerPaymentProfileController(request)
controller.setenvironment(constants.PRODUCTION)
controller.execute()
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
controller.setenvironment(constants.PRODUCTION)
controller.execute()
else:
controller.execute()
response = controller.getresponse()
if response.messages.resultCode == "Ok":
return str(response.customerPaymentProfileId)

View File

@@ -4,7 +4,9 @@ class ApplicationConfig:
"""
Basic Configuration for a generic User
"""
CURRENT_SETTINGS = 'LOCAL'
print("USING TESTING APPLICATIONCONFIG!!!!!")
CURRENT_SETTINGS = 'DEVELOPMENT'
# databases info
POSTGRES_USERNAME = 'postgres'
POSTGRES_PW = 'password'
@@ -16,5 +18,17 @@ class ApplicationConfig:
POSTGRES_SERVER,
POSTGRES_DBNAME00
)
SQLALCHEMY_BINDS = {'eamco': SQLALCHEMY_DATABASE_URI}
SQLALCHEMY_BINDS = {'eamco': SQLALCHEMY_DATABASE_URI}
origins = [
"http://localhost:9000",
"https://localhost:9513",
"http://localhost:9514",
"http://localhost:9512",
"http://localhost:9511",
"http://localhost:5173", # Frontend port
"http://localhost:9516", # Authorize service port
]
API_LOGIN_ID = '9U6w96gZmX'
TRANSACTION_KEY = '94s6Qy458mMNJr7G'