Skip to content

Commit 7fb4efc

Browse files
committed
Removed references to Configuration from API controllers
Fixed bug for logger when logging is turned off
1 parent e7b9591 commit 7fb4efc

File tree

69 files changed

+500
-1091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+500
-1091
lines changed

CyberSource/api/batches_api.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ class BatchesApi(object):
3636
"""
3737

3838
def __init__(self, merchant_config, api_client=None):
39-
config = Configuration()
4039
if api_client:
4140
self.api_client = api_client
4241
else:
43-
if not config.api_client:
44-
config.api_client = ApiClient()
45-
self.api_client = config.api_client
42+
self.api_client = ApiClient()
4643
self.api_client.set_configuration(merchant_config)
4744
self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config)
4845

@@ -68,8 +65,7 @@ def get_batch_report(self, batch_id, **kwargs):
6865
returns the request thread.
6966
"""
7067

71-
if self.api_client.mconfig.log_config.enable_log:
72-
self.logger.info("CALL TO METHOD `get_batch_report` STARTED")
68+
self.logger.info("CALL TO METHOD `get_batch_report` STARTED")
7369

7470
kwargs['_return_http_data_only'] = True
7571
if kwargs.get('callback'):
@@ -115,8 +111,7 @@ def get_batch_report_with_http_info(self, batch_id, **kwargs):
115111
del params['kwargs']
116112
# verify the required parameter 'batch_id' is set
117113
if ('batch_id' not in params) or (params['batch_id'] is None):
118-
if self.api_client.mconfig.log_config.enable_log:
119-
self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_report`")
114+
self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_report`")
120115
raise ValueError("Missing the required parameter `batch_id` when calling `get_batch_report`")
121116

122117

@@ -191,8 +186,7 @@ def get_batch_status(self, batch_id, **kwargs):
191186
returns the request thread.
192187
"""
193188

194-
if self.api_client.mconfig.log_config.enable_log:
195-
self.logger.info("CALL TO METHOD `get_batch_status` STARTED")
189+
self.logger.info("CALL TO METHOD `get_batch_status` STARTED")
196190

197191
kwargs['_return_http_data_only'] = True
198192
if kwargs.get('callback'):
@@ -238,8 +232,7 @@ def get_batch_status_with_http_info(self, batch_id, **kwargs):
238232
del params['kwargs']
239233
# verify the required parameter 'batch_id' is set
240234
if ('batch_id' not in params) or (params['batch_id'] is None):
241-
if self.api_client.mconfig.log_config.enable_log:
242-
self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_status`")
235+
self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_status`")
243236
raise ValueError("Missing the required parameter `batch_id` when calling `get_batch_status`")
244237

245238

@@ -317,8 +310,7 @@ def get_batches_list(self, **kwargs):
317310
returns the request thread.
318311
"""
319312

320-
if self.api_client.mconfig.log_config.enable_log:
321-
self.logger.info("CALL TO METHOD `get_batches_list` STARTED")
313+
self.logger.info("CALL TO METHOD `get_batches_list` STARTED")
322314

323315
kwargs['_return_http_data_only'] = True
324316
if kwargs.get('callback'):
@@ -443,8 +435,7 @@ def post_batch(self, body, **kwargs):
443435
returns the request thread.
444436
"""
445437

446-
if self.api_client.mconfig.log_config.enable_log:
447-
self.logger.info("CALL TO METHOD `post_batch` STARTED")
438+
self.logger.info("CALL TO METHOD `post_batch` STARTED")
448439

449440
kwargs['_return_http_data_only'] = True
450441
if kwargs.get('callback'):
@@ -490,8 +481,7 @@ def post_batch_with_http_info(self, body, **kwargs):
490481
del params['kwargs']
491482
# verify the required parameter 'body' is set
492483
if ('body' not in params) or (params['body'] is None):
493-
if self.api_client.mconfig.log_config.enable_log:
494-
self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `post_batch`")
484+
self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `post_batch`")
495485
raise ValueError("Missing the required parameter `body` when calling `post_batch`")
496486

497487

CyberSource/api/billing_agreements_api.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ class BillingAgreementsApi(object):
3636
"""
3737

3838
def __init__(self, merchant_config, api_client=None):
39-
config = Configuration()
4039
if api_client:
4140
self.api_client = api_client
4241
else:
43-
if not config.api_client:
44-
config.api_client = ApiClient()
45-
self.api_client = config.api_client
42+
self.api_client = ApiClient()
4643
self.api_client.set_configuration(merchant_config)
4744
self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config)
4845

@@ -69,8 +66,7 @@ def billing_agreements_de_registration(self, modify_billing_agreement, id, **kwa
6966
returns the request thread.
7067
"""
7168

72-
if self.api_client.mconfig.log_config.enable_log:
73-
self.logger.info("CALL TO METHOD `billing_agreements_de_registration` STARTED")
69+
self.logger.info("CALL TO METHOD `billing_agreements_de_registration` STARTED")
7470

7571
kwargs['_return_http_data_only'] = True
7672
if kwargs.get('callback'):
@@ -117,13 +113,11 @@ def billing_agreements_de_registration_with_http_info(self, modify_billing_agree
117113
del params['kwargs']
118114
# verify the required parameter 'modify_billing_agreement' is set
119115
if ('modify_billing_agreement' not in params) or (params['modify_billing_agreement'] is None):
120-
if self.api_client.mconfig.log_config.enable_log:
121-
self.logger.error("InvalidArgumentException : Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`")
116+
self.logger.error("InvalidArgumentException : Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`")
122117
raise ValueError("Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`")
123118
# verify the required parameter 'id' is set
124119
if ('id' not in params) or (params['id'] is None):
125-
if self.api_client.mconfig.log_config.enable_log:
126-
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_de_registration`")
120+
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_de_registration`")
127121
raise ValueError("Missing the required parameter `id` when calling `billing_agreements_de_registration`")
128122

129123

@@ -198,8 +192,7 @@ def billing_agreements_intimation(self, intimate_billing_agreement, id, **kwargs
198192
returns the request thread.
199193
"""
200194

201-
if self.api_client.mconfig.log_config.enable_log:
202-
self.logger.info("CALL TO METHOD `billing_agreements_intimation` STARTED")
195+
self.logger.info("CALL TO METHOD `billing_agreements_intimation` STARTED")
203196

204197
kwargs['_return_http_data_only'] = True
205198
if kwargs.get('callback'):
@@ -246,13 +239,11 @@ def billing_agreements_intimation_with_http_info(self, intimate_billing_agreemen
246239
del params['kwargs']
247240
# verify the required parameter 'intimate_billing_agreement' is set
248241
if ('intimate_billing_agreement' not in params) or (params['intimate_billing_agreement'] is None):
249-
if self.api_client.mconfig.log_config.enable_log:
250-
self.logger.error("InvalidArgumentException : Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`")
242+
self.logger.error("InvalidArgumentException : Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`")
251243
raise ValueError("Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`")
252244
# verify the required parameter 'id' is set
253245
if ('id' not in params) or (params['id'] is None):
254-
if self.api_client.mconfig.log_config.enable_log:
255-
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_intimation`")
246+
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_intimation`")
256247
raise ValueError("Missing the required parameter `id` when calling `billing_agreements_intimation`")
257248

258249

@@ -326,8 +317,7 @@ def billing_agreements_registration(self, create_billing_agreement, **kwargs):
326317
returns the request thread.
327318
"""
328319

329-
if self.api_client.mconfig.log_config.enable_log:
330-
self.logger.info("CALL TO METHOD `billing_agreements_registration` STARTED")
320+
self.logger.info("CALL TO METHOD `billing_agreements_registration` STARTED")
331321

332322
kwargs['_return_http_data_only'] = True
333323
if kwargs.get('callback'):
@@ -373,8 +363,7 @@ def billing_agreements_registration_with_http_info(self, create_billing_agreemen
373363
del params['kwargs']
374364
# verify the required parameter 'create_billing_agreement' is set
375365
if ('create_billing_agreement' not in params) or (params['create_billing_agreement'] is None):
376-
if self.api_client.mconfig.log_config.enable_log:
377-
self.logger.error("InvalidArgumentException : Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`")
366+
self.logger.error("InvalidArgumentException : Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`")
378367
raise ValueError("Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`")
379368

380369

CyberSource/api/bin_lookup_api.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ class BinLookupApi(object):
3636
"""
3737

3838
def __init__(self, merchant_config, api_client=None):
39-
config = Configuration()
4039
if api_client:
4140
self.api_client = api_client
4241
else:
43-
if not config.api_client:
44-
config.api_client = ApiClient()
45-
self.api_client = config.api_client
42+
self.api_client = ApiClient()
4643
self.api_client.set_configuration(merchant_config)
4744
self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config)
4845

@@ -71,8 +68,7 @@ def get_account_info(self, create_bin_lookup_request, **kwargs):
7168
Cybersource may allow Customer to access, use, and/or test a Cybersource product or service that may still be in development or has not been market-tested ("Beta Product") solely for the purpose of evaluating the functionality or marketability of the Beta Product (a "Beta Evaluation"). Notwithstanding any language to the contrary, the following terms shall apply with respect to Customer's participation in any Beta Evaluation (and the Beta Product(s)) accessed thereunder): The Parties will enter into a separate form agreement detailing the scope of the Beta Evaluation, requirements, pricing, the length of the beta evaluation period ("Beta Product Form"). Beta Products are not, and may not become, Transaction Services and have not yet been publicly released and are offered for the sole purpose of internal testing and non-commercial evaluation. Customer's use of the Beta Product shall be solely for the purpose of conducting the Beta Evaluation. Customer accepts all risks arising out of the access and use of the Beta Products. Cybersource may, in its sole discretion, at any time, terminate or discontinue the Beta Evaluation. Customer acknowledges and agrees that any Beta Product may still be in development and that Beta Product is provided "AS IS" and may not perform at the level of a commercially available service, may not operate as expected and may be modified prior to release. CYBERSOURCE SHALL NOT BE RESPONSIBLE OR LIABLE UNDER ANY CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE RELATING TO A BETA PRODUCT OR THE BETA EVALUATION (A) FOR LOSS OR INACCURACY OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY, (B) ANY CLAIM, LOSSES, DAMAGES, OR CAUSE OF ACTION ARISING IN CONNECTION WITH THE BETA PRODUCT; OR (C) FOR ANY INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOSS OF REVENUES AND LOSS OF PROFITS.
7269
"""
7370

74-
if self.api_client.mconfig.log_config.enable_log:
75-
self.logger.info("CALL TO METHOD `get_account_info` STARTED")
71+
self.logger.info("CALL TO METHOD `get_account_info` STARTED")
7672

7773
kwargs['_return_http_data_only'] = True
7874
if kwargs.get('callback'):
@@ -118,8 +114,7 @@ def get_account_info_with_http_info(self, create_bin_lookup_request, **kwargs):
118114
del params['kwargs']
119115
# verify the required parameter 'create_bin_lookup_request' is set
120116
if ('create_bin_lookup_request' not in params) or (params['create_bin_lookup_request'] is None):
121-
if self.api_client.mconfig.log_config.enable_log:
122-
self.logger.error("InvalidArgumentException : Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`")
117+
self.logger.error("InvalidArgumentException : Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`")
123118
raise ValueError("Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`")
124119

125120

CyberSource/api/capture_api.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ class CaptureApi(object):
3636
"""
3737

3838
def __init__(self, merchant_config, api_client=None):
39-
config = Configuration()
4039
if api_client:
4140
self.api_client = api_client
4241
else:
43-
if not config.api_client:
44-
config.api_client = ApiClient()
45-
self.api_client = config.api_client
42+
self.api_client = ApiClient()
4643
self.api_client.set_configuration(merchant_config)
4744
self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config)
4845

@@ -69,8 +66,7 @@ def capture_payment(self, capture_payment_request, id, **kwargs):
6966
returns the request thread.
7067
"""
7168

72-
if self.api_client.mconfig.log_config.enable_log:
73-
self.logger.info("CALL TO METHOD `capture_payment` STARTED")
69+
self.logger.info("CALL TO METHOD `capture_payment` STARTED")
7470

7571
kwargs['_return_http_data_only'] = True
7672
if kwargs.get('callback'):
@@ -117,13 +113,11 @@ def capture_payment_with_http_info(self, capture_payment_request, id, **kwargs):
117113
del params['kwargs']
118114
# verify the required parameter 'capture_payment_request' is set
119115
if ('capture_payment_request' not in params) or (params['capture_payment_request'] is None):
120-
if self.api_client.mconfig.log_config.enable_log:
121-
self.logger.error("InvalidArgumentException : Missing the required parameter `capture_payment_request` when calling `capture_payment`")
116+
self.logger.error("InvalidArgumentException : Missing the required parameter `capture_payment_request` when calling `capture_payment`")
122117
raise ValueError("Missing the required parameter `capture_payment_request` when calling `capture_payment`")
123118
# verify the required parameter 'id' is set
124119
if ('id' not in params) or (params['id'] is None):
125-
if self.api_client.mconfig.log_config.enable_log:
126-
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `capture_payment`")
120+
self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `capture_payment`")
127121
raise ValueError("Missing the required parameter `id` when calling `capture_payment`")
128122

129123

CyberSource/api/chargeback_details_api.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,10 @@ class ChargebackDetailsApi(object):
3636
"""
3737

3838
def __init__(self, merchant_config, api_client=None):
39-
config = Configuration()
4039
if api_client:
4140
self.api_client = api_client
4241
else:
43-
if not config.api_client:
44-
config.api_client = ApiClient()
45-
self.api_client = config.api_client
42+
self.api_client = ApiClient()
4643
self.api_client.set_configuration(merchant_config)
4744
self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config)
4845

@@ -70,8 +67,7 @@ def get_chargeback_details(self, start_time, end_time, **kwargs):
7067
returns the request thread.
7168
"""
7269

73-
if self.api_client.mconfig.log_config.enable_log:
74-
self.logger.info("CALL TO METHOD `get_chargeback_details` STARTED")
70+
self.logger.info("CALL TO METHOD `get_chargeback_details` STARTED")
7571

7672
kwargs['_return_http_data_only'] = True
7773
if kwargs.get('callback'):
@@ -119,13 +115,11 @@ def get_chargeback_details_with_http_info(self, start_time, end_time, **kwargs):
119115
del params['kwargs']
120116
# verify the required parameter 'start_time' is set
121117
if ('start_time' not in params) or (params['start_time'] is None):
122-
if self.api_client.mconfig.log_config.enable_log:
123-
self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_details`")
118+
self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_details`")
124119
raise ValueError("Missing the required parameter `start_time` when calling `get_chargeback_details`")
125120
# verify the required parameter 'end_time' is set
126121
if ('end_time' not in params) or (params['end_time'] is None):
127-
if self.api_client.mconfig.log_config.enable_log:
128-
self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_details`")
122+
self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_details`")
129123
raise ValueError("Missing the required parameter `end_time` when calling `get_chargeback_details`")
130124

131125

0 commit comments

Comments
 (0)