cleaned up code
This commit is contained in:
@@ -4,21 +4,32 @@ from .. import crud, database, schemas
|
||||
from config import load_config
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
# Load Authorize.net credentials
|
||||
ApplicationConfig = load_config()
|
||||
API_LOGIN_ID = ApplicationConfig.API_LOGIN_ID
|
||||
TRANSACTION_KEY = ApplicationConfig.TRANSACTION_KEY
|
||||
|
||||
|
||||
# Set Authorize.net environment based on configuration
|
||||
from authorizenet.constants import constants
|
||||
|
||||
|
||||
from config import load_config # Assuming you have this
|
||||
|
||||
# Load Authorize.net credentials
|
||||
ApplicationConfig = load_config()
|
||||
|
||||
# Set Authorize.net environment based on configuration
|
||||
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
|
||||
|
||||
def verify_customer_authorize_account(db: Session, customer_id: int) -> dict:
|
||||
"""
|
||||
@@ -173,8 +184,13 @@ def _get_customer_profile(profile_id: str):
|
||||
)
|
||||
|
||||
controller = controllers.getCustomerProfileController(request)
|
||||
controller.setenvironment(constants.PRODUCTION)
|
||||
controller.execute()
|
||||
|
||||
if ApplicationConfig.CURRENT_SETTINGS == 'PRODUCTION':
|
||||
controller.setenvironment(constants.PRODUCTION)
|
||||
controller.execute()
|
||||
else:
|
||||
controller.execute()
|
||||
|
||||
response = controller.getresponse()
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user