@@ -69,6 +69,7 @@ class APIOperationBase(APIOperationBaseInterface):
69
69
70
70
__initialized = False
71
71
__merchantauthentication = "null"
72
+ __environment = "null"
72
73
73
74
@staticmethod
74
75
def __classinitialized ():
@@ -80,22 +81,7 @@ def validaterequest(self):
80
81
81
82
def validate (self ):
82
83
anetapirequest = self ._getrequest ()
83
-
84
- self .validateandsetmerchantauthentication ()
85
- '''
86
- # make sure proper authentication elements are present and no extra elements are present
87
- merchantauthenticationtype = anetapirequest.merchantauthentication()
88
- if (merchantauthenticationtype.sessionToken != "null"):
89
- raise ValueError('sessionToken needs to be null')
90
- if (merchantauthenticationtype.password != "null"):
91
- raise ValueError('Password needs to be null')
92
- if (merchantauthenticationtype.mobileDeviceId != "null"):
93
- raise ValueError('MobileDeviceId needs to be null')
94
-
95
- impersonationauthenticationtype = merchantauthenticationtype.impersonationAuthentication
96
- if (impersonationauthenticationtype != "null"):
97
- raise ValueError('ImpersonationAuthenticationType needs to be null')
98
- '''
84
+ self .validateandsetmerchantauthentication ()
99
85
self .validaterequest ()
100
86
101
87
return
@@ -121,7 +107,9 @@ def getprettyxmlrequest(self):
121
107
return requestDom
122
108
123
109
def execute (self ):
124
- self .endpoint = constants .SANDBOX_TESTMODE
110
+
111
+ self .endpoint = APIOperationBase .__environment
112
+
125
113
logging .debug ('Executing http post to url: %s' , self .endpoint )
126
114
127
115
self .beforeexecute ()
@@ -201,28 +189,38 @@ def validateandsetmerchantauthentication(self):
201
189
else :
202
190
raise ValueError ('Merchant Authentication can not be null' )
203
191
return
204
-
205
- def __init__ (self , apiRequest ):
206
- self ._httpResponse = "null"
207
- self ._request = "null"
208
- self ._response = "null"
209
- self .__endpoint = "null"
192
+
193
+ @staticmethod
194
+ def getenvironment (self ):
195
+ return APIOperationBase .__environment
210
196
211
- if "null" == apiRequest :
197
+
198
+ @staticmethod
199
+ def setenvironment (userenvironment ):
200
+ APIOperationBase .__environment = userenvironment
201
+ return
202
+
203
+ def __init__ (self , apiRequest ):
204
+ self ._httpResponse = None
205
+ self ._request = None
206
+ self ._response = None
207
+
208
+ if None == apiRequest :
212
209
raise ValueError ('Input request cannot be null' )
213
210
214
211
self ._request = apiRequest
215
212
__merchantauthentication = apicontractsv1 .merchantAuthenticationType ()
213
+ APIOperationBase .__environment = constants .SANDBOX_TESTMODE
216
214
217
215
APIOperationBase .setmerchantauthentication (__merchantauthentication )
218
216
219
217
if ( False == APIOperationBase .__classinitialized ()):
220
218
loggingfilename = utility .helper .getproperty (constants .propertiesloggingfilename )
221
219
logginglevel = utility .helper .getproperty (constants .propertiesexecutionlogginglevel )
222
220
223
- if ("null" == loggingfilename ):
221
+ if (None == loggingfilename ):
224
222
loggingfilename = constants .defaultLogFileName
225
- if ("null" == logginglevel ):
223
+ if (None == logginglevel ):
226
224
logginglevel = constants .defaultLoggingLevel
227
225
228
226
logging .basicConfig (filename = loggingfilename , level = logginglevel , format = constants .defaultlogformat )
0 commit comments