Skip to content

Commit 7c98073

Browse files
updated api.mustache file
1 parent bb0ce2f commit 7c98073

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

generator/cybersource-python-template/api_client.mustache

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,17 @@ class ApiClient(object):
161161
self.host = self.mconfig.request_host
162162

163163
# Calling the authentication header
164-
def call_authentication_header(self, method, header_params, body):
164+
def call_authentication_header(self, method, header_params, body, request_target=None):
165165

166166
time = self.mconfig.get_time()
167167

168-
self.mconfig.request_type_method = method
169-
170-
171-
172-
if method.upper() == GlobalLabelParameters.POST or method.upper() == GlobalLabelParameters.PUT or method.upper() == GlobalLabelParameters.PATCH:
173-
self.mconfig.request_json_path_data = body
174-
175168
header_params['v-c-client-id'] = self.client_id
176169

177170
# if not self.mconfig.solution_id in (None, ''):
178171
# header_params['v-c-solution-id'] = self.mconfig.solution_id
179172

180173
auth = Authorization()
181-
token = auth.get_token(self.mconfig, self.mconfig.get_time())
174+
token = auth.get_token(self.mconfig, time, method, request_target, body)
182175
if self.mconfig.authentication_type.upper() == GlobalLabelParameters.HTTP.upper():
183176
header_params['Accept-Encoding'] = '*'
184177
header_params['v-c-merchant-id'] = self.mconfig.merchant_id
@@ -458,13 +451,10 @@ class ApiClient(object):
458451
post_params = body
459452

460453
query_param_path = self.set_query_params(resource_path, query_params)
461-
if query_param_path:
462-
self.mconfig.request_target = query_param_path
463-
else:
464-
self.mconfig.request_target = resource_path
454+
request_target = query_param_path if query_param_path else resource_pat
465455

466456
if self.mconfig.authentication_type.upper() != GlobalLabelParameters.MUTUAL_AUTH.upper():
467-
self.call_authentication_header(method, header_params, body)
457+
self.call_authentication_header(method, header_params, body, request_target)
468458

469459
"""
470460
Makes the HTTP request (synchronous) and return the deserialized data.

0 commit comments

Comments
 (0)