Skip to content

providing set method to user to allow them to point to the environmen… #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
providing set method to user to allow them to point to the environmen…
…t of their choice
  • Loading branch information
krgupta committed Feb 4, 2016
commit 098991d561d95ff52ae1939b2ee17e5961817ae1
50 changes: 24 additions & 26 deletions authorizenet/apicontrollersbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class APIOperationBase(APIOperationBaseInterface):

__initialized = False
__merchantauthentication = "null"
__environment = "null"

@staticmethod
def __classinitialized():
Expand All @@ -80,22 +81,7 @@ def validaterequest(self):

def validate(self):
anetapirequest = self._getrequest()

self.validateandsetmerchantauthentication()
'''
# make sure proper authentication elements are present and no extra elements are present
merchantauthenticationtype = anetapirequest.merchantauthentication()
if (merchantauthenticationtype.sessionToken != "null"):
raise ValueError('sessionToken needs to be null')
if (merchantauthenticationtype.password != "null"):
raise ValueError('Password needs to be null')
if (merchantauthenticationtype.mobileDeviceId != "null"):
raise ValueError('MobileDeviceId needs to be null')

impersonationauthenticationtype = merchantauthenticationtype.impersonationAuthentication
if (impersonationauthenticationtype != "null"):
raise ValueError('ImpersonationAuthenticationType needs to be null')
'''
self.validateandsetmerchantauthentication()
self.validaterequest()

return
Expand All @@ -121,7 +107,9 @@ def getprettyxmlrequest(self):
return requestDom

def execute(self):
self.endpoint = constants.SANDBOX_TESTMODE

self.endpoint = APIOperationBase.__environment

logging.debug('Executing http post to url: %s', self.endpoint)

self.beforeexecute()
Expand Down Expand Up @@ -201,28 +189,38 @@ def validateandsetmerchantauthentication(self):
else:
raise ValueError('Merchant Authentication can not be null')
return

def __init__(self, apiRequest):
self._httpResponse = "null"
self._request = "null"
self._response = "null"
self.__endpoint = "null"

@staticmethod
def getenvironment(self):
return APIOperationBase.__environment

if "null" == apiRequest:

@staticmethod
def setenvironment(userenvironment):
APIOperationBase.__environment = userenvironment
return

def __init__(self, apiRequest):
self._httpResponse = None
self._request = None
self._response = None

if None == apiRequest:
raise ValueError('Input request cannot be null')

self._request = apiRequest
__merchantauthentication = apicontractsv1.merchantAuthenticationType()
APIOperationBase.__environment = constants.SANDBOX_TESTMODE

APIOperationBase.setmerchantauthentication(__merchantauthentication)

if ( False == APIOperationBase.__classinitialized()):
loggingfilename = utility.helper.getproperty(constants.propertiesloggingfilename)
logginglevel = utility.helper.getproperty(constants.propertiesexecutionlogginglevel)

if ("null" == loggingfilename):
if (None == loggingfilename):
loggingfilename = constants.defaultLogFileName
if ("null" == logginglevel):
if (None == logginglevel):
logginglevel = constants.defaultLoggingLevel

logging.basicConfig(filename=loggingfilename, level=logginglevel, format=constants.defaultlogformat)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy