diff --git a/CyberSource/api/batches_api.py b/CyberSource/api/batches_api.py index 3b5f2fd0..f1d5597f 100644 --- a/CyberSource/api/batches_api.py +++ b/CyberSource/api/batches_api.py @@ -36,13 +36,10 @@ class BatchesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_batch_report(self, batch_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_batch_report` STARTED") + self.logger.info("CALL TO METHOD `get_batch_report` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_batch_report_with_http_info(self, batch_id, **kwargs): del params['kwargs'] # verify the required parameter 'batch_id' is set if ('batch_id' not in params) or (params['batch_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_report`") raise ValueError("Missing the required parameter `batch_id` when calling `get_batch_report`") @@ -191,8 +186,7 @@ def get_batch_status(self, batch_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_batch_status` STARTED") + self.logger.info("CALL TO METHOD `get_batch_status` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,8 +232,7 @@ def get_batch_status_with_http_info(self, batch_id, **kwargs): del params['kwargs'] # verify the required parameter 'batch_id' is set if ('batch_id' not in params) or (params['batch_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_status`") + self.logger.error("InvalidArgumentException : Missing the required parameter `batch_id` when calling `get_batch_status`") raise ValueError("Missing the required parameter `batch_id` when calling `get_batch_status`") @@ -317,8 +310,7 @@ def get_batches_list(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_batches_list` STARTED") + self.logger.info("CALL TO METHOD `get_batches_list` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -443,8 +435,7 @@ def post_batch(self, body, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_batch` STARTED") + self.logger.info("CALL TO METHOD `post_batch` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -490,8 +481,7 @@ def post_batch_with_http_info(self, body, **kwargs): del params['kwargs'] # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `post_batch`") + self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `post_batch`") raise ValueError("Missing the required parameter `body` when calling `post_batch`") diff --git a/CyberSource/api/billing_agreements_api.py b/CyberSource/api/billing_agreements_api.py index a96f8052..45b080c0 100644 --- a/CyberSource/api/billing_agreements_api.py +++ b/CyberSource/api/billing_agreements_api.py @@ -36,13 +36,10 @@ class BillingAgreementsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def billing_agreements_de_registration(self, modify_billing_agreement, id, **kwa returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `billing_agreements_de_registration` STARTED") + self.logger.info("CALL TO METHOD `billing_agreements_de_registration` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def billing_agreements_de_registration_with_http_info(self, modify_billing_agree del params['kwargs'] # verify the required parameter 'modify_billing_agreement' is set if ('modify_billing_agreement' not in params) or (params['modify_billing_agreement'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`") + self.logger.error("InvalidArgumentException : Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`") raise ValueError("Missing the required parameter `modify_billing_agreement` when calling `billing_agreements_de_registration`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_de_registration`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_de_registration`") raise ValueError("Missing the required parameter `id` when calling `billing_agreements_de_registration`") @@ -198,8 +192,7 @@ def billing_agreements_intimation(self, intimate_billing_agreement, id, **kwargs returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `billing_agreements_intimation` STARTED") + self.logger.info("CALL TO METHOD `billing_agreements_intimation` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,13 +239,11 @@ def billing_agreements_intimation_with_http_info(self, intimate_billing_agreemen del params['kwargs'] # verify the required parameter 'intimate_billing_agreement' is set if ('intimate_billing_agreement' not in params) or (params['intimate_billing_agreement'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`") + self.logger.error("InvalidArgumentException : Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`") raise ValueError("Missing the required parameter `intimate_billing_agreement` when calling `billing_agreements_intimation`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_intimation`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `billing_agreements_intimation`") raise ValueError("Missing the required parameter `id` when calling `billing_agreements_intimation`") @@ -326,8 +317,7 @@ def billing_agreements_registration(self, create_billing_agreement, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `billing_agreements_registration` STARTED") + self.logger.info("CALL TO METHOD `billing_agreements_registration` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -373,8 +363,7 @@ def billing_agreements_registration_with_http_info(self, create_billing_agreemen del params['kwargs'] # verify the required parameter 'create_billing_agreement' is set if ('create_billing_agreement' not in params) or (params['create_billing_agreement'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`") raise ValueError("Missing the required parameter `create_billing_agreement` when calling `billing_agreements_registration`") diff --git a/CyberSource/api/bin_lookup_api.py b/CyberSource/api/bin_lookup_api.py index 34bfbfef..315f3879 100644 --- a/CyberSource/api/bin_lookup_api.py +++ b/CyberSource/api/bin_lookup_api.py @@ -36,13 +36,10 @@ class BinLookupApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -71,8 +68,7 @@ def get_account_info(self, create_bin_lookup_request, **kwargs): 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. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_account_info` STARTED") + self.logger.info("CALL TO METHOD `get_account_info` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -118,8 +114,7 @@ def get_account_info_with_http_info(self, create_bin_lookup_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_bin_lookup_request' is set if ('create_bin_lookup_request' not in params) or (params['create_bin_lookup_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`") raise ValueError("Missing the required parameter `create_bin_lookup_request` when calling `get_account_info`") diff --git a/CyberSource/api/capture_api.py b/CyberSource/api/capture_api.py index 760c963f..673e5664 100644 --- a/CyberSource/api/capture_api.py +++ b/CyberSource/api/capture_api.py @@ -36,13 +36,10 @@ class CaptureApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def capture_payment(self, capture_payment_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `capture_payment` STARTED") + self.logger.info("CALL TO METHOD `capture_payment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def capture_payment_with_http_info(self, capture_payment_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'capture_payment_request' is set if ('capture_payment_request' not in params) or (params['capture_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `capture_payment_request` when calling `capture_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `capture_payment_request` when calling `capture_payment`") raise ValueError("Missing the required parameter `capture_payment_request` when calling `capture_payment`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `capture_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `capture_payment`") raise ValueError("Missing the required parameter `id` when calling `capture_payment`") diff --git a/CyberSource/api/chargeback_details_api.py b/CyberSource/api/chargeback_details_api.py index 24a50c3d..1705af00 100644 --- a/CyberSource/api/chargeback_details_api.py +++ b/CyberSource/api/chargeback_details_api.py @@ -36,13 +36,10 @@ class ChargebackDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_chargeback_details(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_chargeback_details` STARTED") + self.logger.info("CALL TO METHOD `get_chargeback_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_chargeback_details_with_http_info(self, start_time, end_time, **kwargs): del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_details`") raise ValueError("Missing the required parameter `start_time` when calling `get_chargeback_details`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_details`") raise ValueError("Missing the required parameter `end_time` when calling `get_chargeback_details`") diff --git a/CyberSource/api/chargeback_summaries_api.py b/CyberSource/api/chargeback_summaries_api.py index 6c309804..d61849c6 100644 --- a/CyberSource/api/chargeback_summaries_api.py +++ b/CyberSource/api/chargeback_summaries_api.py @@ -36,13 +36,10 @@ class ChargebackSummariesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_chargeback_summaries(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_chargeback_summaries` STARTED") + self.logger.info("CALL TO METHOD `get_chargeback_summaries` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_chargeback_summaries_with_http_info(self, start_time, end_time, **kwargs del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_summaries`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_chargeback_summaries`") raise ValueError("Missing the required parameter `start_time` when calling `get_chargeback_summaries`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_summaries`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_chargeback_summaries`") raise ValueError("Missing the required parameter `end_time` when calling `get_chargeback_summaries`") diff --git a/CyberSource/api/conversion_details_api.py b/CyberSource/api/conversion_details_api.py index 61332df4..32e52f09 100644 --- a/CyberSource/api/conversion_details_api.py +++ b/CyberSource/api/conversion_details_api.py @@ -36,13 +36,10 @@ class ConversionDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_conversion_detail(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_conversion_detail` STARTED") + self.logger.info("CALL TO METHOD `get_conversion_detail` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_conversion_detail_with_http_info(self, start_time, end_time, **kwargs): del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_conversion_detail`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_conversion_detail`") raise ValueError("Missing the required parameter `start_time` when calling `get_conversion_detail`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_conversion_detail`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_conversion_detail`") raise ValueError("Missing the required parameter `end_time` when calling `get_conversion_detail`") diff --git a/CyberSource/api/create_new_webhooks_api.py b/CyberSource/api/create_new_webhooks_api.py index 9ceedce6..15797111 100644 --- a/CyberSource/api/create_new_webhooks_api.py +++ b/CyberSource/api/create_new_webhooks_api.py @@ -36,13 +36,10 @@ class CreateNewWebhooksApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def find_products_to_subscribe(self, organization_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `find_products_to_subscribe` STARTED") + self.logger.info("CALL TO METHOD `find_products_to_subscribe` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def find_products_to_subscribe_with_http_info(self, organization_id, **kwargs): del params['kwargs'] # verify the required parameter 'organization_id' is set if ('organization_id' not in params) or (params['organization_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `organization_id` when calling `find_products_to_subscribe`") + self.logger.error("InvalidArgumentException : Missing the required parameter `organization_id` when calling `find_products_to_subscribe`") raise ValueError("Missing the required parameter `organization_id` when calling `find_products_to_subscribe`") @@ -191,8 +186,7 @@ def notification_subscriptions_v2_webhooks_post(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_post` STARTED") + self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_post` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -308,8 +302,7 @@ def save_sym_egress_key(self, v_c_sender_organization_id, v_c_permissions, **kwa returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `save_sym_egress_key` STARTED") + self.logger.info("CALL TO METHOD `save_sym_egress_key` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -358,13 +351,11 @@ def save_sym_egress_key_with_http_info(self, v_c_sender_organization_id, v_c_per del params['kwargs'] # verify the required parameter 'v_c_sender_organization_id' is set if ('v_c_sender_organization_id' not in params) or (params['v_c_sender_organization_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_sender_organization_id` when calling `save_sym_egress_key`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_sender_organization_id` when calling `save_sym_egress_key`") raise ValueError("Missing the required parameter `v_c_sender_organization_id` when calling `save_sym_egress_key`") # verify the required parameter 'v_c_permissions' is set if ('v_c_permissions' not in params) or (params['v_c_permissions'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `save_sym_egress_key`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `save_sym_egress_key`") raise ValueError("Missing the required parameter `v_c_permissions` when calling `save_sym_egress_key`") diff --git a/CyberSource/api/credit_api.py b/CyberSource/api/credit_api.py index 4a0f74ce..ca63f316 100644 --- a/CyberSource/api/credit_api.py +++ b/CyberSource/api/credit_api.py @@ -36,13 +36,10 @@ class CreditApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def create_credit(self, create_credit_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_credit` STARTED") + self.logger.info("CALL TO METHOD `create_credit` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def create_credit_with_http_info(self, create_credit_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_credit_request' is set if ('create_credit_request' not in params) or (params['create_credit_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_credit_request` when calling `create_credit`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_credit_request` when calling `create_credit`") raise ValueError("Missing the required parameter `create_credit_request` when calling `create_credit`") diff --git a/CyberSource/api/customer_api.py b/CyberSource/api/customer_api.py index 9d4791d2..25682ad0 100644 --- a/CyberSource/api/customer_api.py +++ b/CyberSource/api/customer_api.py @@ -36,13 +36,10 @@ class CustomerApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def delete_customer(self, customer_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_customer` STARTED") + self.logger.info("CALL TO METHOD `delete_customer` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def delete_customer_with_http_info(self, customer_id, **kwargs): del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer`") raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer`") @@ -196,8 +191,7 @@ def get_customer(self, customer_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_customer` STARTED") + self.logger.info("CALL TO METHOD `get_customer` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -244,8 +238,7 @@ def get_customer_with_http_info(self, customer_id, **kwargs): del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer`") raise ValueError("Missing the required parameter `customer_id` when calling `get_customer`") @@ -325,8 +318,7 @@ def patch_customer(self, customer_id, patch_customer_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `patch_customer` STARTED") + self.logger.info("CALL TO METHOD `patch_customer` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -375,13 +367,11 @@ def patch_customer_with_http_info(self, customer_id, patch_customer_request, **k del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customer`") raise ValueError("Missing the required parameter `customer_id` when calling `patch_customer`") # verify the required parameter 'patch_customer_request' is set if ('patch_customer_request' not in params) or (params['patch_customer_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_request` when calling `patch_customer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_request` when calling `patch_customer`") raise ValueError("Missing the required parameter `patch_customer_request` when calling `patch_customer`") @@ -460,8 +450,7 @@ def post_customer(self, post_customer_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_customer` STARTED") + self.logger.info("CALL TO METHOD `post_customer` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -508,8 +497,7 @@ def post_customer_with_http_info(self, post_customer_request, **kwargs): del params['kwargs'] # verify the required parameter 'post_customer_request' is set if ('post_customer_request' not in params) or (params['post_customer_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_request` when calling `post_customer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_request` when calling `post_customer`") raise ValueError("Missing the required parameter `post_customer_request` when calling `post_customer`") diff --git a/CyberSource/api/customer_payment_instrument_api.py b/CyberSource/api/customer_payment_instrument_api.py index e871d5bd..abc4fe85 100644 --- a/CyberSource/api/customer_payment_instrument_api.py +++ b/CyberSource/api/customer_payment_instrument_api.py @@ -36,13 +36,10 @@ class CustomerPaymentInstrumentApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def delete_customer_payment_instrument(self, customer_id, payment_instrument_id, returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_customer_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `delete_customer_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def delete_customer_payment_instrument_with_http_info(self, customer_id, payment del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer_payment_instrument`") raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_payment_instrument`") # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `delete_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `delete_customer_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `delete_customer_payment_instrument`") @@ -207,8 +201,7 @@ def get_customer_payment_instrument(self, customer_id, payment_instrument_id, ** returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_customer_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `get_customer_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -256,13 +249,11 @@ def get_customer_payment_instrument_with_http_info(self, customer_id, payment_in del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_payment_instrument`") raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_payment_instrument`") # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `get_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `get_customer_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `get_customer_payment_instrument`") @@ -345,8 +336,7 @@ def get_customer_payment_instruments_list(self, customer_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_customer_payment_instruments_list` STARTED") + self.logger.info("CALL TO METHOD `get_customer_payment_instruments_list` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -395,8 +385,7 @@ def get_customer_payment_instruments_list_with_http_info(self, customer_id, **kw del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_payment_instruments_list`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_payment_instruments_list`") raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_payment_instruments_list`") @@ -481,8 +470,7 @@ def patch_customers_payment_instrument(self, customer_id, payment_instrument_id, returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `patch_customers_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `patch_customers_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -532,18 +520,15 @@ def patch_customers_payment_instrument_with_http_info(self, customer_id, payment del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customers_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customers_payment_instrument`") raise ValueError("Missing the required parameter `customer_id` when calling `patch_customers_payment_instrument`") # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `patch_customers_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `patch_customers_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `patch_customers_payment_instrument`") # verify the required parameter 'patch_customer_payment_instrument_request' is set if ('patch_customer_payment_instrument_request' not in params) or (params['patch_customer_payment_instrument_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_payment_instrument_request` when calling `patch_customers_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_payment_instrument_request` when calling `patch_customers_payment_instrument`") raise ValueError("Missing the required parameter `patch_customer_payment_instrument_request` when calling `patch_customers_payment_instrument`") @@ -626,8 +611,7 @@ def post_customer_payment_instrument(self, customer_id, post_customer_payment_in returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_customer_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `post_customer_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -675,13 +659,11 @@ def post_customer_payment_instrument_with_http_info(self, customer_id, post_cust del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `post_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `post_customer_payment_instrument`") raise ValueError("Missing the required parameter `customer_id` when calling `post_customer_payment_instrument`") # verify the required parameter 'post_customer_payment_instrument_request' is set if ('post_customer_payment_instrument_request' not in params) or (params['post_customer_payment_instrument_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_payment_instrument_request` when calling `post_customer_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_payment_instrument_request` when calling `post_customer_payment_instrument`") raise ValueError("Missing the required parameter `post_customer_payment_instrument_request` when calling `post_customer_payment_instrument`") diff --git a/CyberSource/api/customer_shipping_address_api.py b/CyberSource/api/customer_shipping_address_api.py index cce46b26..af3c9b1d 100644 --- a/CyberSource/api/customer_shipping_address_api.py +++ b/CyberSource/api/customer_shipping_address_api.py @@ -36,13 +36,10 @@ class CustomerShippingAddressApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def delete_customer_shipping_address(self, customer_id, shipping_address_id, **k returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_customer_shipping_address` STARTED") + self.logger.info("CALL TO METHOD `delete_customer_shipping_address` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def delete_customer_shipping_address_with_http_info(self, customer_id, shipping_ del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `delete_customer_shipping_address`") raise ValueError("Missing the required parameter `customer_id` when calling `delete_customer_shipping_address`") # verify the required parameter 'shipping_address_id' is set if ('shipping_address_id' not in params) or (params['shipping_address_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `delete_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `delete_customer_shipping_address`") raise ValueError("Missing the required parameter `shipping_address_id` when calling `delete_customer_shipping_address`") @@ -207,8 +201,7 @@ def get_customer_shipping_address(self, customer_id, shipping_address_id, **kwar returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_customer_shipping_address` STARTED") + self.logger.info("CALL TO METHOD `get_customer_shipping_address` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -256,13 +249,11 @@ def get_customer_shipping_address_with_http_info(self, customer_id, shipping_add del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_shipping_address`") raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_shipping_address`") # verify the required parameter 'shipping_address_id' is set if ('shipping_address_id' not in params) or (params['shipping_address_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `get_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `get_customer_shipping_address`") raise ValueError("Missing the required parameter `shipping_address_id` when calling `get_customer_shipping_address`") @@ -345,8 +336,7 @@ def get_customer_shipping_addresses_list(self, customer_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_customer_shipping_addresses_list` STARTED") + self.logger.info("CALL TO METHOD `get_customer_shipping_addresses_list` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -395,8 +385,7 @@ def get_customer_shipping_addresses_list_with_http_info(self, customer_id, **kwa del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_shipping_addresses_list`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `get_customer_shipping_addresses_list`") raise ValueError("Missing the required parameter `customer_id` when calling `get_customer_shipping_addresses_list`") @@ -481,8 +470,7 @@ def patch_customers_shipping_address(self, customer_id, shipping_address_id, pat returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `patch_customers_shipping_address` STARTED") + self.logger.info("CALL TO METHOD `patch_customers_shipping_address` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -532,18 +520,15 @@ def patch_customers_shipping_address_with_http_info(self, customer_id, shipping_ del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customers_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `patch_customers_shipping_address`") raise ValueError("Missing the required parameter `customer_id` when calling `patch_customers_shipping_address`") # verify the required parameter 'shipping_address_id' is set if ('shipping_address_id' not in params) or (params['shipping_address_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `patch_customers_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `shipping_address_id` when calling `patch_customers_shipping_address`") raise ValueError("Missing the required parameter `shipping_address_id` when calling `patch_customers_shipping_address`") # verify the required parameter 'patch_customer_shipping_address_request' is set if ('patch_customer_shipping_address_request' not in params) or (params['patch_customer_shipping_address_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_shipping_address_request` when calling `patch_customers_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `patch_customer_shipping_address_request` when calling `patch_customers_shipping_address`") raise ValueError("Missing the required parameter `patch_customer_shipping_address_request` when calling `patch_customers_shipping_address`") @@ -626,8 +611,7 @@ def post_customer_shipping_address(self, customer_id, post_customer_shipping_add returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_customer_shipping_address` STARTED") + self.logger.info("CALL TO METHOD `post_customer_shipping_address` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -675,13 +659,11 @@ def post_customer_shipping_address_with_http_info(self, customer_id, post_custom del params['kwargs'] # verify the required parameter 'customer_id' is set if ('customer_id' not in params) or (params['customer_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `post_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `customer_id` when calling `post_customer_shipping_address`") raise ValueError("Missing the required parameter `customer_id` when calling `post_customer_shipping_address`") # verify the required parameter 'post_customer_shipping_address_request' is set if ('post_customer_shipping_address_request' not in params) or (params['post_customer_shipping_address_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_shipping_address_request` when calling `post_customer_shipping_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_customer_shipping_address_request` when calling `post_customer_shipping_address`") raise ValueError("Missing the required parameter `post_customer_shipping_address_request` when calling `post_customer_shipping_address`") diff --git a/CyberSource/api/decision_manager_api.py b/CyberSource/api/decision_manager_api.py index 96d2cfbe..a57b4f6a 100644 --- a/CyberSource/api/decision_manager_api.py +++ b/CyberSource/api/decision_manager_api.py @@ -36,13 +36,10 @@ class DecisionManagerApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def action_decision_manager_case(self, id, case_management_actions_request, **kw returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `action_decision_manager_case` STARTED") + self.logger.info("CALL TO METHOD `action_decision_manager_case` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def action_decision_manager_case_with_http_info(self, id, case_management_action del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `action_decision_manager_case`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `action_decision_manager_case`") raise ValueError("Missing the required parameter `id` when calling `action_decision_manager_case`") # verify the required parameter 'case_management_actions_request' is set if ('case_management_actions_request' not in params) or (params['case_management_actions_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `case_management_actions_request` when calling `action_decision_manager_case`") + self.logger.error("InvalidArgumentException : Missing the required parameter `case_management_actions_request` when calling `action_decision_manager_case`") raise ValueError("Missing the required parameter `case_management_actions_request` when calling `action_decision_manager_case`") @@ -198,8 +192,7 @@ def add_negative(self, type, add_negative_list_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `add_negative` STARTED") + self.logger.info("CALL TO METHOD `add_negative` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,13 +239,11 @@ def add_negative_with_http_info(self, type, add_negative_list_request, **kwargs) del params['kwargs'] # verify the required parameter 'type' is set if ('type' not in params) or (params['type'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `type` when calling `add_negative`") + self.logger.error("InvalidArgumentException : Missing the required parameter `type` when calling `add_negative`") raise ValueError("Missing the required parameter `type` when calling `add_negative`") # verify the required parameter 'add_negative_list_request' is set if ('add_negative_list_request' not in params) or (params['add_negative_list_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `add_negative_list_request` when calling `add_negative`") + self.logger.error("InvalidArgumentException : Missing the required parameter `add_negative_list_request` when calling `add_negative`") raise ValueError("Missing the required parameter `add_negative_list_request` when calling `add_negative`") @@ -327,8 +318,7 @@ def comment_decision_manager_case(self, id, case_management_comments_request, ** returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `comment_decision_manager_case` STARTED") + self.logger.info("CALL TO METHOD `comment_decision_manager_case` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -375,13 +365,11 @@ def comment_decision_manager_case_with_http_info(self, id, case_management_comme del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `comment_decision_manager_case`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `comment_decision_manager_case`") raise ValueError("Missing the required parameter `id` when calling `comment_decision_manager_case`") # verify the required parameter 'case_management_comments_request' is set if ('case_management_comments_request' not in params) or (params['case_management_comments_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `case_management_comments_request` when calling `comment_decision_manager_case`") + self.logger.error("InvalidArgumentException : Missing the required parameter `case_management_comments_request` when calling `comment_decision_manager_case`") raise ValueError("Missing the required parameter `case_management_comments_request` when calling `comment_decision_manager_case`") @@ -455,8 +443,7 @@ def create_bundled_decision_manager_case(self, create_bundled_decision_manager_c returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_bundled_decision_manager_case` STARTED") + self.logger.info("CALL TO METHOD `create_bundled_decision_manager_case` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -502,8 +489,7 @@ def create_bundled_decision_manager_case_with_http_info(self, create_bundled_dec del params['kwargs'] # verify the required parameter 'create_bundled_decision_manager_case_request' is set if ('create_bundled_decision_manager_case_request' not in params) or (params['create_bundled_decision_manager_case_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_bundled_decision_manager_case_request` when calling `create_bundled_decision_manager_case`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_bundled_decision_manager_case_request` when calling `create_bundled_decision_manager_case`") raise ValueError("Missing the required parameter `create_bundled_decision_manager_case_request` when calling `create_bundled_decision_manager_case`") @@ -575,8 +561,7 @@ def fraud_update(self, id, fraud_marking_action_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `fraud_update` STARTED") + self.logger.info("CALL TO METHOD `fraud_update` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -623,13 +608,11 @@ def fraud_update_with_http_info(self, id, fraud_marking_action_request, **kwargs del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `fraud_update`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `fraud_update`") raise ValueError("Missing the required parameter `id` when calling `fraud_update`") # verify the required parameter 'fraud_marking_action_request' is set if ('fraud_marking_action_request' not in params) or (params['fraud_marking_action_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `fraud_marking_action_request` when calling `fraud_update`") + self.logger.error("InvalidArgumentException : Missing the required parameter `fraud_marking_action_request` when calling `fraud_update`") raise ValueError("Missing the required parameter `fraud_marking_action_request` when calling `fraud_update`") diff --git a/CyberSource/api/device_de_association_api.py b/CyberSource/api/device_de_association_api.py index e7d0fbb1..673cd942 100644 --- a/CyberSource/api/device_de_association_api.py +++ b/CyberSource/api/device_de_association_api.py @@ -36,13 +36,10 @@ class DeviceDeAssociationApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def delete_terminal_association(self, de_association_request_body, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_terminal_association` STARTED") + self.logger.info("CALL TO METHOD `delete_terminal_association` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def delete_terminal_association_with_http_info(self, de_association_request_body del params['kwargs'] # verify the required parameter 'de_association_request_body' is set if ('de_association_request_body' not in params) or (params['de_association_request_body'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `de_association_request_body` when calling `delete_terminal_association`") + self.logger.error("InvalidArgumentException : Missing the required parameter `de_association_request_body` when calling `delete_terminal_association`") raise ValueError("Missing the required parameter `de_association_request_body` when calling `delete_terminal_association`") @@ -187,8 +182,7 @@ def post_de_associate_v3_terminal(self, device_de_associate_v3_request, **kwargs returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_de_associate_v3_terminal` STARTED") + self.logger.info("CALL TO METHOD `post_de_associate_v3_terminal` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -234,8 +228,7 @@ def post_de_associate_v3_terminal_with_http_info(self, device_de_associate_v3_re del params['kwargs'] # verify the required parameter 'device_de_associate_v3_request' is set if ('device_de_associate_v3_request' not in params) or (params['device_de_associate_v3_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `device_de_associate_v3_request` when calling `post_de_associate_v3_terminal`") + self.logger.error("InvalidArgumentException : Missing the required parameter `device_de_associate_v3_request` when calling `post_de_associate_v3_terminal`") raise ValueError("Missing the required parameter `device_de_associate_v3_request` when calling `post_de_associate_v3_terminal`") diff --git a/CyberSource/api/device_search_api.py b/CyberSource/api/device_search_api.py index 5ade53d7..b14e1b86 100644 --- a/CyberSource/api/device_search_api.py +++ b/CyberSource/api/device_search_api.py @@ -36,13 +36,10 @@ class DeviceSearchApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def post_search_query(self, post_device_search_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_search_query` STARTED") + self.logger.info("CALL TO METHOD `post_search_query` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def post_search_query_with_http_info(self, post_device_search_request, **kwargs) del params['kwargs'] # verify the required parameter 'post_device_search_request' is set if ('post_device_search_request' not in params) or (params['post_device_search_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_device_search_request` when calling `post_search_query`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_device_search_request` when calling `post_search_query`") raise ValueError("Missing the required parameter `post_device_search_request` when calling `post_search_query`") @@ -187,8 +182,7 @@ def post_search_query_v3(self, post_device_search_request_v3, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_search_query_v3` STARTED") + self.logger.info("CALL TO METHOD `post_search_query_v3` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -234,8 +228,7 @@ def post_search_query_v3_with_http_info(self, post_device_search_request_v3, **k del params['kwargs'] # verify the required parameter 'post_device_search_request_v3' is set if ('post_device_search_request_v3' not in params) or (params['post_device_search_request_v3'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_device_search_request_v3` when calling `post_search_query_v3`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_device_search_request_v3` when calling `post_search_query_v3`") raise ValueError("Missing the required parameter `post_device_search_request_v3` when calling `post_search_query_v3`") diff --git a/CyberSource/api/download_dtd_api.py b/CyberSource/api/download_dtd_api.py index 03af1078..0f49c7f7 100644 --- a/CyberSource/api/download_dtd_api.py +++ b/CyberSource/api/download_dtd_api.py @@ -36,13 +36,10 @@ class DownloadDTDApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_dtdv2(self, report_definition_name_version, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_dtdv2` STARTED") + self.logger.info("CALL TO METHOD `get_dtdv2` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_dtdv2_with_http_info(self, report_definition_name_version, **kwargs): del params['kwargs'] # verify the required parameter 'report_definition_name_version' is set if ('report_definition_name_version' not in params) or (params['report_definition_name_version'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name_version` when calling `get_dtdv2`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name_version` when calling `get_dtdv2`") raise ValueError("Missing the required parameter `report_definition_name_version` when calling `get_dtdv2`") diff --git a/CyberSource/api/download_xsd_api.py b/CyberSource/api/download_xsd_api.py index 6f573d32..ebac9507 100644 --- a/CyberSource/api/download_xsd_api.py +++ b/CyberSource/api/download_xsd_api.py @@ -36,13 +36,10 @@ class DownloadXSDApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_xsdv2(self, report_definition_name_version, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_xsdv2` STARTED") + self.logger.info("CALL TO METHOD `get_xsdv2` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_xsdv2_with_http_info(self, report_definition_name_version, **kwargs): del params['kwargs'] # verify the required parameter 'report_definition_name_version' is set if ('report_definition_name_version' not in params) or (params['report_definition_name_version'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name_version` when calling `get_xsdv2`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name_version` when calling `get_xsdv2`") raise ValueError("Missing the required parameter `report_definition_name_version` when calling `get_xsdv2`") diff --git a/CyberSource/api/emv_tag_details_api.py b/CyberSource/api/emv_tag_details_api.py index 382124b1..ae6a4816 100644 --- a/CyberSource/api/emv_tag_details_api.py +++ b/CyberSource/api/emv_tag_details_api.py @@ -36,13 +36,10 @@ class EMVTagDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -67,8 +64,7 @@ def get_emv_tags(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_emv_tags` STARTED") + self.logger.info("CALL TO METHOD `get_emv_tags` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -180,8 +176,7 @@ def parse_emv_tags(self, body, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `parse_emv_tags` STARTED") + self.logger.info("CALL TO METHOD `parse_emv_tags` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -227,8 +222,7 @@ def parse_emv_tags_with_http_info(self, body, **kwargs): del params['kwargs'] # verify the required parameter 'body' is set if ('body' not in params) or (params['body'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `parse_emv_tags`") + self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `parse_emv_tags`") raise ValueError("Missing the required parameter `body` when calling `parse_emv_tags`") diff --git a/CyberSource/api/flex_api_api.py b/CyberSource/api/flex_api_api.py index a5e74408..3efd8f88 100644 --- a/CyberSource/api/flex_api_api.py +++ b/CyberSource/api/flex_api_api.py @@ -36,13 +36,10 @@ class FlexAPIApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def generate_flex_api_capture_context(self, generate_flex_api_capture_context_re returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `generate_flex_api_capture_context` STARTED") + self.logger.info("CALL TO METHOD `generate_flex_api_capture_context` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def generate_flex_api_capture_context_with_http_info(self, generate_flex_api_cap del params['kwargs'] # verify the required parameter 'generate_flex_api_capture_context_request' is set if ('generate_flex_api_capture_context_request' not in params) or (params['generate_flex_api_capture_context_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `generate_flex_api_capture_context_request` when calling `generate_flex_api_capture_context`") + self.logger.error("InvalidArgumentException : Missing the required parameter `generate_flex_api_capture_context_request` when calling `generate_flex_api_capture_context`") raise ValueError("Missing the required parameter `generate_flex_api_capture_context_request` when calling `generate_flex_api_capture_context`") diff --git a/CyberSource/api/instrument_identifier_api.py b/CyberSource/api/instrument_identifier_api.py index 9bae3f9b..6edcf064 100644 --- a/CyberSource/api/instrument_identifier_api.py +++ b/CyberSource/api/instrument_identifier_api.py @@ -36,13 +36,10 @@ class InstrumentIdentifierApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def delete_instrument_identifier(self, instrument_identifier_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_instrument_identifier` STARTED") + self.logger.info("CALL TO METHOD `delete_instrument_identifier` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def delete_instrument_identifier_with_http_info(self, instrument_identifier_id, del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `delete_instrument_identifier`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `delete_instrument_identifier`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `delete_instrument_identifier`") @@ -197,8 +192,7 @@ def get_instrument_identifier(self, instrument_identifier_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_instrument_identifier` STARTED") + self.logger.info("CALL TO METHOD `get_instrument_identifier` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,8 +240,7 @@ def get_instrument_identifier_with_http_info(self, instrument_identifier_id, **k del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier`") @@ -330,8 +323,7 @@ def get_instrument_identifier_payment_instruments_list(self, instrument_identifi returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_instrument_identifier_payment_instruments_list` STARTED") + self.logger.info("CALL TO METHOD `get_instrument_identifier_payment_instruments_list` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -381,8 +373,7 @@ def get_instrument_identifier_payment_instruments_list_with_http_info(self, inst del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier_payment_instruments_list`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier_payment_instruments_list`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `get_instrument_identifier_payment_instruments_list`") @@ -469,8 +460,7 @@ def patch_instrument_identifier(self, instrument_identifier_id, patch_instrument returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `patch_instrument_identifier` STARTED") + self.logger.info("CALL TO METHOD `patch_instrument_identifier` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -520,13 +510,11 @@ def patch_instrument_identifier_with_http_info(self, instrument_identifier_id, p del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `patch_instrument_identifier`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `patch_instrument_identifier`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `patch_instrument_identifier`") # verify the required parameter 'patch_instrument_identifier_request' is set if ('patch_instrument_identifier_request' not in params) or (params['patch_instrument_identifier_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `patch_instrument_identifier_request` when calling `patch_instrument_identifier`") + self.logger.error("InvalidArgumentException : Missing the required parameter `patch_instrument_identifier_request` when calling `patch_instrument_identifier`") raise ValueError("Missing the required parameter `patch_instrument_identifier_request` when calling `patch_instrument_identifier`") @@ -608,8 +596,7 @@ def post_instrument_identifier(self, post_instrument_identifier_request, **kwarg returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_instrument_identifier` STARTED") + self.logger.info("CALL TO METHOD `post_instrument_identifier` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -657,8 +644,7 @@ def post_instrument_identifier_with_http_info(self, post_instrument_identifier_r del params['kwargs'] # verify the required parameter 'post_instrument_identifier_request' is set if ('post_instrument_identifier_request' not in params) or (params['post_instrument_identifier_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_instrument_identifier_request` when calling `post_instrument_identifier`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_instrument_identifier_request` when calling `post_instrument_identifier`") raise ValueError("Missing the required parameter `post_instrument_identifier_request` when calling `post_instrument_identifier`") @@ -735,8 +721,7 @@ def post_instrument_identifier_enrollment(self, instrument_identifier_id, post_i returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_instrument_identifier_enrollment` STARTED") + self.logger.info("CALL TO METHOD `post_instrument_identifier_enrollment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -784,13 +769,11 @@ def post_instrument_identifier_enrollment_with_http_info(self, instrument_identi del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `post_instrument_identifier_enrollment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `post_instrument_identifier_enrollment`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `post_instrument_identifier_enrollment`") # verify the required parameter 'post_instrument_identifier_enrollment_request' is set if ('post_instrument_identifier_enrollment_request' not in params) or (params['post_instrument_identifier_enrollment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_instrument_identifier_enrollment_request` when calling `post_instrument_identifier_enrollment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_instrument_identifier_enrollment_request` when calling `post_instrument_identifier_enrollment`") raise ValueError("Missing the required parameter `post_instrument_identifier_enrollment_request` when calling `post_instrument_identifier_enrollment`") diff --git a/CyberSource/api/interchange_clearing_level_details_api.py b/CyberSource/api/interchange_clearing_level_details_api.py index e7423619..43161058 100644 --- a/CyberSource/api/interchange_clearing_level_details_api.py +++ b/CyberSource/api/interchange_clearing_level_details_api.py @@ -36,13 +36,10 @@ class InterchangeClearingLevelDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_interchange_clearing_level_details(self, start_time, end_time, **kwargs) returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_interchange_clearing_level_details` STARTED") + self.logger.info("CALL TO METHOD `get_interchange_clearing_level_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_interchange_clearing_level_details_with_http_info(self, start_time, end_ del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_interchange_clearing_level_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_interchange_clearing_level_details`") raise ValueError("Missing the required parameter `start_time` when calling `get_interchange_clearing_level_details`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_interchange_clearing_level_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_interchange_clearing_level_details`") raise ValueError("Missing the required parameter `end_time` when calling `get_interchange_clearing_level_details`") diff --git a/CyberSource/api/invoice_settings_api.py b/CyberSource/api/invoice_settings_api.py index 54bb5ad9..36c6c83c 100644 --- a/CyberSource/api/invoice_settings_api.py +++ b/CyberSource/api/invoice_settings_api.py @@ -36,13 +36,10 @@ class InvoiceSettingsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -67,8 +64,7 @@ def get_invoice_settings(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_invoice_settings` STARTED") + self.logger.info("CALL TO METHOD `get_invoice_settings` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -180,8 +176,7 @@ def update_invoice_settings(self, invoice_settings_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_invoice_settings` STARTED") + self.logger.info("CALL TO METHOD `update_invoice_settings` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -227,8 +222,7 @@ def update_invoice_settings_with_http_info(self, invoice_settings_request, **kwa del params['kwargs'] # verify the required parameter 'invoice_settings_request' is set if ('invoice_settings_request' not in params) or (params['invoice_settings_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `invoice_settings_request` when calling `update_invoice_settings`") + self.logger.error("InvalidArgumentException : Missing the required parameter `invoice_settings_request` when calling `update_invoice_settings`") raise ValueError("Missing the required parameter `invoice_settings_request` when calling `update_invoice_settings`") diff --git a/CyberSource/api/invoices_api.py b/CyberSource/api/invoices_api.py index af384f48..8be60ca4 100644 --- a/CyberSource/api/invoices_api.py +++ b/CyberSource/api/invoices_api.py @@ -36,13 +36,10 @@ class InvoicesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def create_invoice(self, create_invoice_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_invoice` STARTED") + self.logger.info("CALL TO METHOD `create_invoice` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def create_invoice_with_http_info(self, create_invoice_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_invoice_request' is set if ('create_invoice_request' not in params) or (params['create_invoice_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_invoice_request` when calling `create_invoice`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_invoice_request` when calling `create_invoice`") raise ValueError("Missing the required parameter `create_invoice_request` when calling `create_invoice`") @@ -189,8 +184,7 @@ def get_all_invoices(self, offset, limit, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_all_invoices` STARTED") + self.logger.info("CALL TO METHOD `get_all_invoices` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,13 +232,11 @@ def get_all_invoices_with_http_info(self, offset, limit, **kwargs): del params['kwargs'] # verify the required parameter 'offset' is set if ('offset' not in params) or (params['offset'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `offset` when calling `get_all_invoices`") + self.logger.error("InvalidArgumentException : Missing the required parameter `offset` when calling `get_all_invoices`") raise ValueError("Missing the required parameter `offset` when calling `get_all_invoices`") # verify the required parameter 'limit' is set if ('limit' not in params) or (params['limit'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `limit` when calling `get_all_invoices`") + self.logger.error("InvalidArgumentException : Missing the required parameter `limit` when calling `get_all_invoices`") raise ValueError("Missing the required parameter `limit` when calling `get_all_invoices`") @@ -322,8 +314,7 @@ def get_invoice(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_invoice` STARTED") + self.logger.info("CALL TO METHOD `get_invoice` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -369,8 +360,7 @@ def get_invoice_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_invoice`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_invoice`") raise ValueError("Missing the required parameter `id` when calling `get_invoice`") @@ -445,8 +435,7 @@ def perform_cancel_action(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `perform_cancel_action` STARTED") + self.logger.info("CALL TO METHOD `perform_cancel_action` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -492,8 +481,7 @@ def perform_cancel_action_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_cancel_action`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_cancel_action`") raise ValueError("Missing the required parameter `id` when calling `perform_cancel_action`") @@ -568,8 +556,7 @@ def perform_publish_action(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `perform_publish_action` STARTED") + self.logger.info("CALL TO METHOD `perform_publish_action` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -615,8 +602,7 @@ def perform_publish_action_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_publish_action`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_publish_action`") raise ValueError("Missing the required parameter `id` when calling `perform_publish_action`") @@ -691,8 +677,7 @@ def perform_send_action(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `perform_send_action` STARTED") + self.logger.info("CALL TO METHOD `perform_send_action` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -738,8 +723,7 @@ def perform_send_action_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_send_action`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `perform_send_action`") raise ValueError("Missing the required parameter `id` when calling `perform_send_action`") @@ -815,8 +799,7 @@ def update_invoice(self, id, update_invoice_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_invoice` STARTED") + self.logger.info("CALL TO METHOD `update_invoice` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -863,13 +846,11 @@ def update_invoice_with_http_info(self, id, update_invoice_request, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_invoice`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_invoice`") raise ValueError("Missing the required parameter `id` when calling `update_invoice`") # verify the required parameter 'update_invoice_request' is set if ('update_invoice_request' not in params) or (params['update_invoice_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `update_invoice_request` when calling `update_invoice`") + self.logger.error("InvalidArgumentException : Missing the required parameter `update_invoice_request` when calling `update_invoice`") raise ValueError("Missing the required parameter `update_invoice_request` when calling `update_invoice`") diff --git a/CyberSource/api/manage_webhooks_api.py b/CyberSource/api/manage_webhooks_api.py index a5eecb33..061c7b26 100644 --- a/CyberSource/api/manage_webhooks_api.py +++ b/CyberSource/api/manage_webhooks_api.py @@ -36,13 +36,10 @@ class ManageWebhooksApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def delete_webhook_subscription(self, webhook_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_webhook_subscription` STARTED") + self.logger.info("CALL TO METHOD `delete_webhook_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def delete_webhook_subscription_with_http_info(self, webhook_id, **kwargs): del params['kwargs'] # verify the required parameter 'webhook_id' is set if ('webhook_id' not in params) or (params['webhook_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `delete_webhook_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `delete_webhook_subscription`") raise ValueError("Missing the required parameter `webhook_id` when calling `delete_webhook_subscription`") @@ -191,8 +186,7 @@ def get_webhook_subscription_by_id(self, webhook_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_webhook_subscription_by_id` STARTED") + self.logger.info("CALL TO METHOD `get_webhook_subscription_by_id` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,8 +232,7 @@ def get_webhook_subscription_by_id_with_http_info(self, webhook_id, **kwargs): del params['kwargs'] # verify the required parameter 'webhook_id' is set if ('webhook_id' not in params) or (params['webhook_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `get_webhook_subscription_by_id`") + self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `get_webhook_subscription_by_id`") raise ValueError("Missing the required parameter `webhook_id` when calling `get_webhook_subscription_by_id`") @@ -316,8 +309,7 @@ def get_webhook_subscriptions_by_org(self, organization_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_webhook_subscriptions_by_org` STARTED") + self.logger.info("CALL TO METHOD `get_webhook_subscriptions_by_org` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -365,8 +357,7 @@ def get_webhook_subscriptions_by_org_with_http_info(self, organization_id, **kwa del params['kwargs'] # verify the required parameter 'organization_id' is set if ('organization_id' not in params) or (params['organization_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `organization_id` when calling `get_webhook_subscriptions_by_org`") + self.logger.error("InvalidArgumentException : Missing the required parameter `organization_id` when calling `get_webhook_subscriptions_by_org`") raise ValueError("Missing the required parameter `organization_id` when calling `get_webhook_subscriptions_by_org`") @@ -444,8 +435,7 @@ def notification_subscriptions_v1_webhooks_webhook_id_post(self, webhook_id, **k returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `notification_subscriptions_v1_webhooks_webhook_id_post` STARTED") + self.logger.info("CALL TO METHOD `notification_subscriptions_v1_webhooks_webhook_id_post` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -491,8 +481,7 @@ def notification_subscriptions_v1_webhooks_webhook_id_post_with_http_info(self, del params['kwargs'] # verify the required parameter 'webhook_id' is set if ('webhook_id' not in params) or (params['webhook_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v1_webhooks_webhook_id_post`") + self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v1_webhooks_webhook_id_post`") raise ValueError("Missing the required parameter `webhook_id` when calling `notification_subscriptions_v1_webhooks_webhook_id_post`") @@ -568,8 +557,7 @@ def notification_subscriptions_v2_webhooks_webhook_id_patch(self, webhook_id, ** returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_webhook_id_patch` STARTED") + self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_webhook_id_patch` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -616,8 +604,7 @@ def notification_subscriptions_v2_webhooks_webhook_id_patch_with_http_info(self, del params['kwargs'] # verify the required parameter 'webhook_id' is set if ('webhook_id' not in params) or (params['webhook_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_patch`") + self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_patch`") raise ValueError("Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_patch`") @@ -692,8 +679,7 @@ def notification_subscriptions_v2_webhooks_webhook_id_status_put(self, webhook_i returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_webhook_id_status_put` STARTED") + self.logger.info("CALL TO METHOD `notification_subscriptions_v2_webhooks_webhook_id_status_put` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -740,8 +726,7 @@ def notification_subscriptions_v2_webhooks_webhook_id_status_put_with_http_info( del params['kwargs'] # verify the required parameter 'webhook_id' is set if ('webhook_id' not in params) or (params['webhook_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_status_put`") + self.logger.error("InvalidArgumentException : Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_status_put`") raise ValueError("Missing the required parameter `webhook_id` when calling `notification_subscriptions_v2_webhooks_webhook_id_status_put`") @@ -818,8 +803,7 @@ def save_asym_egress_key(self, v_c_sender_organization_id, v_c_permissions, save returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `save_asym_egress_key` STARTED") + self.logger.info("CALL TO METHOD `save_asym_egress_key` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -868,18 +852,15 @@ def save_asym_egress_key_with_http_info(self, v_c_sender_organization_id, v_c_pe del params['kwargs'] # verify the required parameter 'v_c_sender_organization_id' is set if ('v_c_sender_organization_id' not in params) or (params['v_c_sender_organization_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_sender_organization_id` when calling `save_asym_egress_key`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_sender_organization_id` when calling `save_asym_egress_key`") raise ValueError("Missing the required parameter `v_c_sender_organization_id` when calling `save_asym_egress_key`") # verify the required parameter 'v_c_permissions' is set if ('v_c_permissions' not in params) or (params['v_c_permissions'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `save_asym_egress_key`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `save_asym_egress_key`") raise ValueError("Missing the required parameter `v_c_permissions` when calling `save_asym_egress_key`") # verify the required parameter 'save_asym_egress_key' is set if ('save_asym_egress_key' not in params) or (params['save_asym_egress_key'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `save_asym_egress_key` when calling `save_asym_egress_key`") + self.logger.error("InvalidArgumentException : Missing the required parameter `save_asym_egress_key` when calling `save_asym_egress_key`") raise ValueError("Missing the required parameter `save_asym_egress_key` when calling `save_asym_egress_key`") diff --git a/CyberSource/api/merchant_boarding_api.py b/CyberSource/api/merchant_boarding_api.py index 84c51df7..e24c0ced 100644 --- a/CyberSource/api/merchant_boarding_api.py +++ b/CyberSource/api/merchant_boarding_api.py @@ -36,13 +36,10 @@ class MerchantBoardingApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_registration(self, registration_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_registration` STARTED") + self.logger.info("CALL TO METHOD `get_registration` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_registration_with_http_info(self, registration_id, **kwargs): del params['kwargs'] # verify the required parameter 'registration_id' is set if ('registration_id' not in params) or (params['registration_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `registration_id` when calling `get_registration`") + self.logger.error("InvalidArgumentException : Missing the required parameter `registration_id` when calling `get_registration`") raise ValueError("Missing the required parameter `registration_id` when calling `get_registration`") @@ -192,8 +187,7 @@ def post_registration(self, post_registration_body, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_registration` STARTED") + self.logger.info("CALL TO METHOD `post_registration` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -240,8 +234,7 @@ def post_registration_with_http_info(self, post_registration_body, **kwargs): del params['kwargs'] # verify the required parameter 'post_registration_body' is set if ('post_registration_body' not in params) or (params['post_registration_body'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_registration_body` when calling `post_registration`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_registration_body` when calling `post_registration`") raise ValueError("Missing the required parameter `post_registration_body` when calling `post_registration`") diff --git a/CyberSource/api/microform_integration_api.py b/CyberSource/api/microform_integration_api.py index 5b9fc775..1f9b4b12 100644 --- a/CyberSource/api/microform_integration_api.py +++ b/CyberSource/api/microform_integration_api.py @@ -36,13 +36,10 @@ class MicroformIntegrationApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def generate_capture_context(self, generate_capture_context_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `generate_capture_context` STARTED") + self.logger.info("CALL TO METHOD `generate_capture_context` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def generate_capture_context_with_http_info(self, generate_capture_context_reque del params['kwargs'] # verify the required parameter 'generate_capture_context_request' is set if ('generate_capture_context_request' not in params) or (params['generate_capture_context_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `generate_capture_context_request` when calling `generate_capture_context`") + self.logger.error("InvalidArgumentException : Missing the required parameter `generate_capture_context_request` when calling `generate_capture_context`") raise ValueError("Missing the required parameter `generate_capture_context_request` when calling `generate_capture_context`") diff --git a/CyberSource/api/net_fundings_api.py b/CyberSource/api/net_fundings_api.py index 110b32ee..e1c26466 100644 --- a/CyberSource/api/net_fundings_api.py +++ b/CyberSource/api/net_fundings_api.py @@ -36,13 +36,10 @@ class NetFundingsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -71,8 +68,7 @@ def get_net_funding_details(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_net_funding_details` STARTED") + self.logger.info("CALL TO METHOD `get_net_funding_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -121,13 +117,11 @@ def get_net_funding_details_with_http_info(self, start_time, end_time, **kwargs) del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_net_funding_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_net_funding_details`") raise ValueError("Missing the required parameter `start_time` when calling `get_net_funding_details`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_net_funding_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_net_funding_details`") raise ValueError("Missing the required parameter `end_time` when calling `get_net_funding_details`") diff --git a/CyberSource/api/notification_of_changes_api.py b/CyberSource/api/notification_of_changes_api.py index 206fd2d8..8ad16001 100644 --- a/CyberSource/api/notification_of_changes_api.py +++ b/CyberSource/api/notification_of_changes_api.py @@ -36,13 +36,10 @@ class NotificationOfChangesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def get_notification_of_change_report(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_notification_of_change_report` STARTED") + self.logger.info("CALL TO METHOD `get_notification_of_change_report` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def get_notification_of_change_report_with_http_info(self, start_time, end_time, del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_notification_of_change_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_notification_of_change_report`") raise ValueError("Missing the required parameter `start_time` when calling `get_notification_of_change_report`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_notification_of_change_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_notification_of_change_report`") raise ValueError("Missing the required parameter `end_time` when calling `get_notification_of_change_report`") diff --git a/CyberSource/api/orders_api.py b/CyberSource/api/orders_api.py index 59758ea1..b9a4d914 100644 --- a/CyberSource/api/orders_api.py +++ b/CyberSource/api/orders_api.py @@ -36,13 +36,10 @@ class OrdersApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def create_order(self, create_order_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_order` STARTED") + self.logger.info("CALL TO METHOD `create_order` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def create_order_with_http_info(self, create_order_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_order_request' is set if ('create_order_request' not in params) or (params['create_order_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_order_request` when calling `create_order`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_order_request` when calling `create_order`") raise ValueError("Missing the required parameter `create_order_request` when calling `create_order`") @@ -188,8 +183,7 @@ def update_order(self, id, update_order_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_order` STARTED") + self.logger.info("CALL TO METHOD `update_order` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -236,13 +230,11 @@ def update_order_with_http_info(self, id, update_order_request, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_order`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_order`") raise ValueError("Missing the required parameter `id` when calling `update_order`") # verify the required parameter 'update_order_request' is set if ('update_order_request' not in params) or (params['update_order_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `update_order_request` when calling `update_order`") + self.logger.error("InvalidArgumentException : Missing the required parameter `update_order_request` when calling `update_order`") raise ValueError("Missing the required parameter `update_order_request` when calling `update_order`") diff --git a/CyberSource/api/payer_authentication_api.py b/CyberSource/api/payer_authentication_api.py index ca530907..efcb9673 100644 --- a/CyberSource/api/payer_authentication_api.py +++ b/CyberSource/api/payer_authentication_api.py @@ -36,13 +36,10 @@ class PayerAuthenticationApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def check_payer_auth_enrollment(self, check_payer_auth_enrollment_request, **kwa returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `check_payer_auth_enrollment` STARTED") + self.logger.info("CALL TO METHOD `check_payer_auth_enrollment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def check_payer_auth_enrollment_with_http_info(self, check_payer_auth_enrollment del params['kwargs'] # verify the required parameter 'check_payer_auth_enrollment_request' is set if ('check_payer_auth_enrollment_request' not in params) or (params['check_payer_auth_enrollment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `check_payer_auth_enrollment_request` when calling `check_payer_auth_enrollment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `check_payer_auth_enrollment_request` when calling `check_payer_auth_enrollment`") raise ValueError("Missing the required parameter `check_payer_auth_enrollment_request` when calling `check_payer_auth_enrollment`") @@ -187,8 +182,7 @@ def payer_auth_setup(self, payer_auth_setup_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `payer_auth_setup` STARTED") + self.logger.info("CALL TO METHOD `payer_auth_setup` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -234,8 +228,7 @@ def payer_auth_setup_with_http_info(self, payer_auth_setup_request, **kwargs): del params['kwargs'] # verify the required parameter 'payer_auth_setup_request' is set if ('payer_auth_setup_request' not in params) or (params['payer_auth_setup_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payer_auth_setup_request` when calling `payer_auth_setup`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payer_auth_setup_request` when calling `payer_auth_setup`") raise ValueError("Missing the required parameter `payer_auth_setup_request` when calling `payer_auth_setup`") @@ -306,8 +299,7 @@ def validate_authentication_results(self, validate_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `validate_authentication_results` STARTED") + self.logger.info("CALL TO METHOD `validate_authentication_results` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -353,8 +345,7 @@ def validate_authentication_results_with_http_info(self, validate_request, **kwa del params['kwargs'] # verify the required parameter 'validate_request' is set if ('validate_request' not in params) or (params['validate_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `validate_request` when calling `validate_authentication_results`") + self.logger.error("InvalidArgumentException : Missing the required parameter `validate_request` when calling `validate_authentication_results`") raise ValueError("Missing the required parameter `validate_request` when calling `validate_authentication_results`") diff --git a/CyberSource/api/payment_batch_summaries_api.py b/CyberSource/api/payment_batch_summaries_api.py index 595e85d1..6db347b2 100644 --- a/CyberSource/api/payment_batch_summaries_api.py +++ b/CyberSource/api/payment_batch_summaries_api.py @@ -36,13 +36,10 @@ class PaymentBatchSummariesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -73,8 +70,7 @@ def get_payment_batch_summary(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_payment_batch_summary` STARTED") + self.logger.info("CALL TO METHOD `get_payment_batch_summary` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -125,13 +121,11 @@ def get_payment_batch_summary_with_http_info(self, start_time, end_time, **kwarg del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_payment_batch_summary`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_payment_batch_summary`") raise ValueError("Missing the required parameter `start_time` when calling `get_payment_batch_summary`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_payment_batch_summary`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_payment_batch_summary`") raise ValueError("Missing the required parameter `end_time` when calling `get_payment_batch_summary`") diff --git a/CyberSource/api/payment_instrument_api.py b/CyberSource/api/payment_instrument_api.py index 07542064..26356d9e 100644 --- a/CyberSource/api/payment_instrument_api.py +++ b/CyberSource/api/payment_instrument_api.py @@ -36,13 +36,10 @@ class PaymentInstrumentApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def delete_payment_instrument(self, payment_instrument_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `delete_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def delete_payment_instrument_with_http_info(self, payment_instrument_id, **kwar del params['kwargs'] # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `delete_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `delete_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `delete_payment_instrument`") @@ -197,8 +192,7 @@ def get_payment_instrument(self, payment_instrument_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `get_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,8 +240,7 @@ def get_payment_instrument_with_http_info(self, payment_instrument_id, **kwargs) del params['kwargs'] # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `get_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `get_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `get_payment_instrument`") @@ -330,8 +323,7 @@ def patch_payment_instrument(self, payment_instrument_id, patch_payment_instrume returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `patch_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `patch_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -381,13 +373,11 @@ def patch_payment_instrument_with_http_info(self, payment_instrument_id, patch_p del params['kwargs'] # verify the required parameter 'payment_instrument_id' is set if ('payment_instrument_id' not in params) or (params['payment_instrument_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `patch_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_instrument_id` when calling `patch_payment_instrument`") raise ValueError("Missing the required parameter `payment_instrument_id` when calling `patch_payment_instrument`") # verify the required parameter 'patch_payment_instrument_request' is set if ('patch_payment_instrument_request' not in params) or (params['patch_payment_instrument_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `patch_payment_instrument_request` when calling `patch_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `patch_payment_instrument_request` when calling `patch_payment_instrument`") raise ValueError("Missing the required parameter `patch_payment_instrument_request` when calling `patch_payment_instrument`") @@ -469,8 +459,7 @@ def post_payment_instrument(self, post_payment_instrument_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_payment_instrument` STARTED") + self.logger.info("CALL TO METHOD `post_payment_instrument` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -518,8 +507,7 @@ def post_payment_instrument_with_http_info(self, post_payment_instrument_request del params['kwargs'] # verify the required parameter 'post_payment_instrument_request' is set if ('post_payment_instrument_request' not in params) or (params['post_payment_instrument_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_payment_instrument_request` when calling `post_payment_instrument`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_payment_instrument_request` when calling `post_payment_instrument`") raise ValueError("Missing the required parameter `post_payment_instrument_request` when calling `post_payment_instrument`") diff --git a/CyberSource/api/payment_links_api.py b/CyberSource/api/payment_links_api.py index 6b6a3a80..f74430bd 100644 --- a/CyberSource/api/payment_links_api.py +++ b/CyberSource/api/payment_links_api.py @@ -36,13 +36,10 @@ class PaymentLinksApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def create_payment_link(self, create_payment_link_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_payment_link` STARTED") + self.logger.info("CALL TO METHOD `create_payment_link` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def create_payment_link_with_http_info(self, create_payment_link_request, **kwar del params['kwargs'] # verify the required parameter 'create_payment_link_request' is set if ('create_payment_link_request' not in params) or (params['create_payment_link_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_payment_link_request` when calling `create_payment_link`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_payment_link_request` when calling `create_payment_link`") raise ValueError("Missing the required parameter `create_payment_link_request` when calling `create_payment_link`") @@ -189,8 +184,7 @@ def get_all_payment_links(self, offset, limit, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_all_payment_links` STARTED") + self.logger.info("CALL TO METHOD `get_all_payment_links` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,13 +232,11 @@ def get_all_payment_links_with_http_info(self, offset, limit, **kwargs): del params['kwargs'] # verify the required parameter 'offset' is set if ('offset' not in params) or (params['offset'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `offset` when calling `get_all_payment_links`") + self.logger.error("InvalidArgumentException : Missing the required parameter `offset` when calling `get_all_payment_links`") raise ValueError("Missing the required parameter `offset` when calling `get_all_payment_links`") # verify the required parameter 'limit' is set if ('limit' not in params) or (params['limit'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `limit` when calling `get_all_payment_links`") + self.logger.error("InvalidArgumentException : Missing the required parameter `limit` when calling `get_all_payment_links`") raise ValueError("Missing the required parameter `limit` when calling `get_all_payment_links`") @@ -322,8 +314,7 @@ def get_payment_link(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_payment_link` STARTED") + self.logger.info("CALL TO METHOD `get_payment_link` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -369,8 +360,7 @@ def get_payment_link_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_payment_link`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_payment_link`") raise ValueError("Missing the required parameter `id` when calling `get_payment_link`") @@ -446,8 +436,7 @@ def update_payment_link(self, id, update_payment_link_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_payment_link` STARTED") + self.logger.info("CALL TO METHOD `update_payment_link` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -494,13 +483,11 @@ def update_payment_link_with_http_info(self, id, update_payment_link_request, ** del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_payment_link`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_payment_link`") raise ValueError("Missing the required parameter `id` when calling `update_payment_link`") # verify the required parameter 'update_payment_link_request' is set if ('update_payment_link_request' not in params) or (params['update_payment_link_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `update_payment_link_request` when calling `update_payment_link`") + self.logger.error("InvalidArgumentException : Missing the required parameter `update_payment_link_request` when calling `update_payment_link`") raise ValueError("Missing the required parameter `update_payment_link_request` when calling `update_payment_link`") diff --git a/CyberSource/api/payment_tokens_api.py b/CyberSource/api/payment_tokens_api.py index 461b8ac2..2563212b 100644 --- a/CyberSource/api/payment_tokens_api.py +++ b/CyberSource/api/payment_tokens_api.py @@ -36,13 +36,10 @@ class PaymentTokensApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def retrieve_or_delete_payment_token(self, request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `retrieve_or_delete_payment_token` STARTED") + self.logger.info("CALL TO METHOD `retrieve_or_delete_payment_token` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def retrieve_or_delete_payment_token_with_http_info(self, request, **kwargs): del params['kwargs'] # verify the required parameter 'request' is set if ('request' not in params) or (params['request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `request` when calling `retrieve_or_delete_payment_token`") + self.logger.error("InvalidArgumentException : Missing the required parameter `request` when calling `retrieve_or_delete_payment_token`") raise ValueError("Missing the required parameter `request` when calling `retrieve_or_delete_payment_token`") diff --git a/CyberSource/api/payments_api.py b/CyberSource/api/payments_api.py index 40cd5fc7..c6b1224d 100644 --- a/CyberSource/api/payments_api.py +++ b/CyberSource/api/payments_api.py @@ -36,13 +36,10 @@ class PaymentsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def create_order_request(self, order_payment_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_order_request` STARTED") + self.logger.info("CALL TO METHOD `create_order_request` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def create_order_request_with_http_info(self, order_payment_request, id, **kwarg del params['kwargs'] # verify the required parameter 'order_payment_request' is set if ('order_payment_request' not in params) or (params['order_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `order_payment_request` when calling `create_order_request`") + self.logger.error("InvalidArgumentException : Missing the required parameter `order_payment_request` when calling `create_order_request`") raise ValueError("Missing the required parameter `order_payment_request` when calling `create_order_request`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `create_order_request`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `create_order_request`") raise ValueError("Missing the required parameter `id` when calling `create_order_request`") @@ -197,8 +191,7 @@ def create_payment(self, create_payment_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_payment` STARTED") + self.logger.info("CALL TO METHOD `create_payment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -244,8 +237,7 @@ def create_payment_with_http_info(self, create_payment_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_payment_request' is set if ('create_payment_request' not in params) or (params['create_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_payment_request` when calling `create_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_payment_request` when calling `create_payment`") raise ValueError("Missing the required parameter `create_payment_request` when calling `create_payment`") @@ -316,8 +308,7 @@ def create_session_request(self, create_session_req, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_session_request` STARTED") + self.logger.info("CALL TO METHOD `create_session_request` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -363,8 +354,7 @@ def create_session_request_with_http_info(self, create_session_req, **kwargs): del params['kwargs'] # verify the required parameter 'create_session_req' is set if ('create_session_req' not in params) or (params['create_session_req'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_session_req` when calling `create_session_request`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_session_req` when calling `create_session_request`") raise ValueError("Missing the required parameter `create_session_req` when calling `create_session_request`") @@ -436,8 +426,7 @@ def increment_auth(self, id, increment_auth_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `increment_auth` STARTED") + self.logger.info("CALL TO METHOD `increment_auth` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -484,13 +473,11 @@ def increment_auth_with_http_info(self, id, increment_auth_request, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `increment_auth`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `increment_auth`") raise ValueError("Missing the required parameter `id` when calling `increment_auth`") # verify the required parameter 'increment_auth_request' is set if ('increment_auth_request' not in params) or (params['increment_auth_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `increment_auth_request` when calling `increment_auth`") + self.logger.error("InvalidArgumentException : Missing the required parameter `increment_auth_request` when calling `increment_auth`") raise ValueError("Missing the required parameter `increment_auth_request` when calling `increment_auth`") @@ -565,8 +552,7 @@ def refresh_payment_status(self, id, refresh_payment_status_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `refresh_payment_status` STARTED") + self.logger.info("CALL TO METHOD `refresh_payment_status` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -613,13 +599,11 @@ def refresh_payment_status_with_http_info(self, id, refresh_payment_status_reque del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refresh_payment_status`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refresh_payment_status`") raise ValueError("Missing the required parameter `id` when calling `refresh_payment_status`") # verify the required parameter 'refresh_payment_status_request' is set if ('refresh_payment_status_request' not in params) or (params['refresh_payment_status_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `refresh_payment_status_request` when calling `refresh_payment_status`") + self.logger.error("InvalidArgumentException : Missing the required parameter `refresh_payment_status_request` when calling `refresh_payment_status`") raise ValueError("Missing the required parameter `refresh_payment_status_request` when calling `refresh_payment_status`") @@ -694,8 +678,7 @@ def update_session_req(self, create_session_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_session_req` STARTED") + self.logger.info("CALL TO METHOD `update_session_req` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -742,13 +725,11 @@ def update_session_req_with_http_info(self, create_session_request, id, **kwargs del params['kwargs'] # verify the required parameter 'create_session_request' is set if ('create_session_request' not in params) or (params['create_session_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_session_request` when calling `update_session_req`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_session_request` when calling `update_session_req`") raise ValueError("Missing the required parameter `create_session_request` when calling `update_session_req`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_session_req`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_session_req`") raise ValueError("Missing the required parameter `id` when calling `update_session_req`") diff --git a/CyberSource/api/payouts_api.py b/CyberSource/api/payouts_api.py index e8ac22b4..4506f717 100644 --- a/CyberSource/api/payouts_api.py +++ b/CyberSource/api/payouts_api.py @@ -36,13 +36,10 @@ class PayoutsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def oct_create_payment(self, oct_create_payment_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `oct_create_payment` STARTED") + self.logger.info("CALL TO METHOD `oct_create_payment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def oct_create_payment_with_http_info(self, oct_create_payment_request, **kwargs del params['kwargs'] # verify the required parameter 'oct_create_payment_request' is set if ('oct_create_payment_request' not in params) or (params['oct_create_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `oct_create_payment_request` when calling `oct_create_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `oct_create_payment_request` when calling `oct_create_payment`") raise ValueError("Missing the required parameter `oct_create_payment_request` when calling `oct_create_payment`") diff --git a/CyberSource/api/plans_api.py b/CyberSource/api/plans_api.py index 1aa0dadf..d7a7377b 100644 --- a/CyberSource/api/plans_api.py +++ b/CyberSource/api/plans_api.py @@ -36,13 +36,10 @@ class PlansApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def activate_plan(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `activate_plan` STARTED") + self.logger.info("CALL TO METHOD `activate_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def activate_plan_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `activate_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `activate_plan`") raise ValueError("Missing the required parameter `id` when calling `activate_plan`") @@ -191,8 +186,7 @@ def create_plan(self, create_plan_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_plan` STARTED") + self.logger.info("CALL TO METHOD `create_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,8 +232,7 @@ def create_plan_with_http_info(self, create_plan_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_plan_request' is set if ('create_plan_request' not in params) or (params['create_plan_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_plan_request` when calling `create_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_plan_request` when calling `create_plan`") raise ValueError("Missing the required parameter `create_plan_request` when calling `create_plan`") @@ -310,8 +303,7 @@ def deactivate_plan(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `deactivate_plan` STARTED") + self.logger.info("CALL TO METHOD `deactivate_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -357,8 +349,7 @@ def deactivate_plan_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `deactivate_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `deactivate_plan`") raise ValueError("Missing the required parameter `id` when calling `deactivate_plan`") @@ -433,8 +424,7 @@ def delete_plan(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_plan` STARTED") + self.logger.info("CALL TO METHOD `delete_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -480,8 +470,7 @@ def delete_plan_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `delete_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `delete_plan`") raise ValueError("Missing the required parameter `id` when calling `delete_plan`") @@ -556,8 +545,7 @@ def get_plan(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_plan` STARTED") + self.logger.info("CALL TO METHOD `get_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -603,8 +591,7 @@ def get_plan_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_plan`") raise ValueError("Missing the required parameter `id` when calling `get_plan`") @@ -678,8 +665,7 @@ def get_plan_code(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_plan_code` STARTED") + self.logger.info("CALL TO METHOD `get_plan_code` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -795,8 +781,7 @@ def get_plans(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_plans` STARTED") + self.logger.info("CALL TO METHOD `get_plans` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -925,8 +910,7 @@ def update_plan(self, id, update_plan_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_plan` STARTED") + self.logger.info("CALL TO METHOD `update_plan` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -973,13 +957,11 @@ def update_plan_with_http_info(self, id, update_plan_request, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_plan`") raise ValueError("Missing the required parameter `id` when calling `update_plan`") # verify the required parameter 'update_plan_request' is set if ('update_plan_request' not in params) or (params['update_plan_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `update_plan_request` when calling `update_plan`") + self.logger.error("InvalidArgumentException : Missing the required parameter `update_plan_request` when calling `update_plan`") raise ValueError("Missing the required parameter `update_plan_request` when calling `update_plan`") diff --git a/CyberSource/api/purchase_and_refund_details_api.py b/CyberSource/api/purchase_and_refund_details_api.py index e1f7615a..0667af0a 100644 --- a/CyberSource/api/purchase_and_refund_details_api.py +++ b/CyberSource/api/purchase_and_refund_details_api.py @@ -36,13 +36,10 @@ class PurchaseAndRefundDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -75,8 +72,7 @@ def get_purchase_and_refund_details(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_purchase_and_refund_details` STARTED") + self.logger.info("CALL TO METHOD `get_purchase_and_refund_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -129,13 +125,11 @@ def get_purchase_and_refund_details_with_http_info(self, start_time, end_time, * del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_purchase_and_refund_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_purchase_and_refund_details`") raise ValueError("Missing the required parameter `start_time` when calling `get_purchase_and_refund_details`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_purchase_and_refund_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_purchase_and_refund_details`") raise ValueError("Missing the required parameter `end_time` when calling `get_purchase_and_refund_details`") diff --git a/CyberSource/api/push_funds_api.py b/CyberSource/api/push_funds_api.py index 745945a1..be1db777 100644 --- a/CyberSource/api/push_funds_api.py +++ b/CyberSource/api/push_funds_api.py @@ -36,13 +36,10 @@ class PushFundsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -74,8 +71,7 @@ def create_push_funds_transfer(self, push_funds_request, content_type, x_request returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_push_funds_transfer` STARTED") + self.logger.info("CALL TO METHOD `create_push_funds_transfer` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -127,38 +123,31 @@ def create_push_funds_transfer_with_http_info(self, push_funds_request, content_ del params['kwargs'] # verify the required parameter 'push_funds_request' is set if ('push_funds_request' not in params) or (params['push_funds_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `push_funds_request` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `push_funds_request` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `push_funds_request` when calling `create_push_funds_transfer`") # verify the required parameter 'content_type' is set if ('content_type' not in params) or (params['content_type'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `content_type` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `content_type` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `content_type` when calling `create_push_funds_transfer`") # verify the required parameter 'x_requestid' is set if ('x_requestid' not in params) or (params['x_requestid'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `x_requestid` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `x_requestid` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `x_requestid` when calling `create_push_funds_transfer`") # verify the required parameter 'v_c_merchant_id' is set if ('v_c_merchant_id' not in params) or (params['v_c_merchant_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_merchant_id` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_merchant_id` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `v_c_merchant_id` when calling `create_push_funds_transfer`") # verify the required parameter 'v_c_permissions' is set if ('v_c_permissions' not in params) or (params['v_c_permissions'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `v_c_permissions` when calling `create_push_funds_transfer`") # verify the required parameter 'v_c_correlation_id' is set if ('v_c_correlation_id' not in params) or (params['v_c_correlation_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_correlation_id` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_correlation_id` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `v_c_correlation_id` when calling `create_push_funds_transfer`") # verify the required parameter 'v_c_organization_id' is set if ('v_c_organization_id' not in params) or (params['v_c_organization_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_organization_id` when calling `create_push_funds_transfer`") + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_organization_id` when calling `create_push_funds_transfer`") raise ValueError("Missing the required parameter `v_c_organization_id` when calling `create_push_funds_transfer`") diff --git a/CyberSource/api/refund_api.py b/CyberSource/api/refund_api.py index b1c14f9d..361197f6 100644 --- a/CyberSource/api/refund_api.py +++ b/CyberSource/api/refund_api.py @@ -36,13 +36,10 @@ class RefundApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def refund_capture(self, refund_capture_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `refund_capture` STARTED") + self.logger.info("CALL TO METHOD `refund_capture` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def refund_capture_with_http_info(self, refund_capture_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'refund_capture_request' is set if ('refund_capture_request' not in params) or (params['refund_capture_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `refund_capture_request` when calling `refund_capture`") + self.logger.error("InvalidArgumentException : Missing the required parameter `refund_capture_request` when calling `refund_capture`") raise ValueError("Missing the required parameter `refund_capture_request` when calling `refund_capture`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refund_capture`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refund_capture`") raise ValueError("Missing the required parameter `id` when calling `refund_capture`") @@ -198,8 +192,7 @@ def refund_payment(self, refund_payment_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `refund_payment` STARTED") + self.logger.info("CALL TO METHOD `refund_payment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,13 +239,11 @@ def refund_payment_with_http_info(self, refund_payment_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'refund_payment_request' is set if ('refund_payment_request' not in params) or (params['refund_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `refund_payment_request` when calling `refund_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `refund_payment_request` when calling `refund_payment`") raise ValueError("Missing the required parameter `refund_payment_request` when calling `refund_payment`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refund_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `refund_payment`") raise ValueError("Missing the required parameter `id` when calling `refund_payment`") diff --git a/CyberSource/api/report_definitions_api.py b/CyberSource/api/report_definitions_api.py index bc28bf5c..a189604c 100644 --- a/CyberSource/api/report_definitions_api.py +++ b/CyberSource/api/report_definitions_api.py @@ -36,13 +36,10 @@ class ReportDefinitionsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -71,8 +68,7 @@ def get_resource_info_by_report_definition(self, report_definition_name, **kwarg returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_resource_info_by_report_definition` STARTED") + self.logger.info("CALL TO METHOD `get_resource_info_by_report_definition` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -121,8 +117,7 @@ def get_resource_info_by_report_definition_with_http_info(self, report_definitio del params['kwargs'] # verify the required parameter 'report_definition_name' is set if ('report_definition_name' not in params) or (params['report_definition_name'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name` when calling `get_resource_info_by_report_definition`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_definition_name` when calling `get_resource_info_by_report_definition`") raise ValueError("Missing the required parameter `report_definition_name` when calling `get_resource_info_by_report_definition`") @@ -204,8 +199,7 @@ def get_resource_v2_info(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_resource_v2_info` STARTED") + self.logger.info("CALL TO METHOD `get_resource_v2_info` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): diff --git a/CyberSource/api/report_downloads_api.py b/CyberSource/api/report_downloads_api.py index da3e216d..f4b9fb75 100644 --- a/CyberSource/api/report_downloads_api.py +++ b/CyberSource/api/report_downloads_api.py @@ -36,13 +36,10 @@ class ReportDownloadsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def download_report(self, report_date, report_name, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `download_report` STARTED") + self.logger.info("CALL TO METHOD `download_report` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def download_report_with_http_info(self, report_date, report_name, **kwargs): del params['kwargs'] # verify the required parameter 'report_date' is set if ('report_date' not in params) or (params['report_date'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_date` when calling `download_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_date` when calling `download_report`") raise ValueError("Missing the required parameter `report_date` when calling `download_report`") # verify the required parameter 'report_name' is set if ('report_name' not in params) or (params['report_name'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `download_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `download_report`") raise ValueError("Missing the required parameter `report_name` when calling `download_report`") diff --git a/CyberSource/api/report_subscriptions_api.py b/CyberSource/api/report_subscriptions_api.py index 9ab27e48..202f096d 100644 --- a/CyberSource/api/report_subscriptions_api.py +++ b/CyberSource/api/report_subscriptions_api.py @@ -36,13 +36,10 @@ class ReportSubscriptionsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def create_standard_or_classic_subscription(self, predefined_subscription_reques returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_standard_or_classic_subscription` STARTED") + self.logger.info("CALL TO METHOD `create_standard_or_classic_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def create_standard_or_classic_subscription_with_http_info(self, predefined_subs del params['kwargs'] # verify the required parameter 'predefined_subscription_request_bean' is set if ('predefined_subscription_request_bean' not in params) or (params['predefined_subscription_request_bean'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `predefined_subscription_request_bean` when calling `create_standard_or_classic_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `predefined_subscription_request_bean` when calling `create_standard_or_classic_subscription`") raise ValueError("Missing the required parameter `predefined_subscription_request_bean` when calling `create_standard_or_classic_subscription`") @@ -192,8 +187,7 @@ def create_subscription(self, create_report_subscription_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_subscription` STARTED") + self.logger.info("CALL TO METHOD `create_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -240,8 +234,7 @@ def create_subscription_with_http_info(self, create_report_subscription_request, del params['kwargs'] # verify the required parameter 'create_report_subscription_request' is set if ('create_report_subscription_request' not in params) or (params['create_report_subscription_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_report_subscription_request` when calling `create_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_report_subscription_request` when calling `create_subscription`") raise ValueError("Missing the required parameter `create_report_subscription_request` when calling `create_subscription`") @@ -315,8 +308,7 @@ def delete_subscription(self, report_name, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_subscription` STARTED") + self.logger.info("CALL TO METHOD `delete_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -363,8 +355,7 @@ def delete_subscription_with_http_info(self, report_name, **kwargs): del params['kwargs'] # verify the required parameter 'report_name' is set if ('report_name' not in params) or (params['report_name'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `delete_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `delete_subscription`") raise ValueError("Missing the required parameter `report_name` when calling `delete_subscription`") @@ -441,8 +432,7 @@ def get_all_subscriptions(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_all_subscriptions` STARTED") + self.logger.info("CALL TO METHOD `get_all_subscriptions` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -559,8 +549,7 @@ def get_subscription(self, report_name, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_subscription` STARTED") + self.logger.info("CALL TO METHOD `get_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -607,8 +596,7 @@ def get_subscription_with_http_info(self, report_name, **kwargs): del params['kwargs'] # verify the required parameter 'report_name' is set if ('report_name' not in params) or (params['report_name'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `get_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_name` when calling `get_subscription`") raise ValueError("Missing the required parameter `report_name` when calling `get_subscription`") diff --git a/CyberSource/api/reports_api.py b/CyberSource/api/reports_api.py index 5b3de1ef..c2a41c40 100644 --- a/CyberSource/api/reports_api.py +++ b/CyberSource/api/reports_api.py @@ -36,13 +36,10 @@ class ReportsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def create_report(self, create_adhoc_report_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_report` STARTED") + self.logger.info("CALL TO METHOD `create_report` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def create_report_with_http_info(self, create_adhoc_report_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_adhoc_report_request' is set if ('create_adhoc_report_request' not in params) or (params['create_adhoc_report_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_adhoc_report_request` when calling `create_report`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_adhoc_report_request` when calling `create_report`") raise ValueError("Missing the required parameter `create_adhoc_report_request` when calling `create_report`") @@ -192,8 +187,7 @@ def get_report_by_report_id(self, report_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_report_by_report_id` STARTED") + self.logger.info("CALL TO METHOD `get_report_by_report_id` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -240,8 +234,7 @@ def get_report_by_report_id_with_http_info(self, report_id, **kwargs): del params['kwargs'] # verify the required parameter 'report_id' is set if ('report_id' not in params) or (params['report_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `report_id` when calling `get_report_by_report_id`") + self.logger.error("InvalidArgumentException : Missing the required parameter `report_id` when calling `get_report_by_report_id`") raise ValueError("Missing the required parameter `report_id` when calling `get_report_by_report_id`") @@ -326,8 +319,7 @@ def search_reports(self, start_time, end_time, time_query_type, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `search_reports` STARTED") + self.logger.info("CALL TO METHOD `search_reports` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -381,18 +373,15 @@ def search_reports_with_http_info(self, start_time, end_time, time_query_type, * del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `search_reports`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `search_reports`") raise ValueError("Missing the required parameter `start_time` when calling `search_reports`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `search_reports`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `search_reports`") raise ValueError("Missing the required parameter `end_time` when calling `search_reports`") # verify the required parameter 'time_query_type' is set if ('time_query_type' not in params) or (params['time_query_type'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `time_query_type` when calling `search_reports`") + self.logger.error("InvalidArgumentException : Missing the required parameter `time_query_type` when calling `search_reports`") raise ValueError("Missing the required parameter `time_query_type` when calling `search_reports`") diff --git a/CyberSource/api/retrieval_details_api.py b/CyberSource/api/retrieval_details_api.py index 45a88a3b..8bb68fd2 100644 --- a/CyberSource/api/retrieval_details_api.py +++ b/CyberSource/api/retrieval_details_api.py @@ -36,13 +36,10 @@ class RetrievalDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_retrieval_details(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_retrieval_details` STARTED") + self.logger.info("CALL TO METHOD `get_retrieval_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_retrieval_details_with_http_info(self, start_time, end_time, **kwargs): del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_retrieval_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_retrieval_details`") raise ValueError("Missing the required parameter `start_time` when calling `get_retrieval_details`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_retrieval_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_retrieval_details`") raise ValueError("Missing the required parameter `end_time` when calling `get_retrieval_details`") diff --git a/CyberSource/api/retrieval_summaries_api.py b/CyberSource/api/retrieval_summaries_api.py index d74c864f..2110e74d 100644 --- a/CyberSource/api/retrieval_summaries_api.py +++ b/CyberSource/api/retrieval_summaries_api.py @@ -36,13 +36,10 @@ class RetrievalSummariesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_retrieval_summary(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_retrieval_summary` STARTED") + self.logger.info("CALL TO METHOD `get_retrieval_summary` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,13 +115,11 @@ def get_retrieval_summary_with_http_info(self, start_time, end_time, **kwargs): del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_retrieval_summary`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_retrieval_summary`") raise ValueError("Missing the required parameter `start_time` when calling `get_retrieval_summary`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_retrieval_summary`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_retrieval_summary`") raise ValueError("Missing the required parameter `end_time` when calling `get_retrieval_summary`") diff --git a/CyberSource/api/reversal_api.py b/CyberSource/api/reversal_api.py index 33340bba..b7f18547 100644 --- a/CyberSource/api/reversal_api.py +++ b/CyberSource/api/reversal_api.py @@ -36,13 +36,10 @@ class ReversalApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def auth_reversal(self, id, auth_reversal_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `auth_reversal` STARTED") + self.logger.info("CALL TO METHOD `auth_reversal` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def auth_reversal_with_http_info(self, id, auth_reversal_request, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `auth_reversal`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `auth_reversal`") raise ValueError("Missing the required parameter `id` when calling `auth_reversal`") # verify the required parameter 'auth_reversal_request' is set if ('auth_reversal_request' not in params) or (params['auth_reversal_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `auth_reversal_request` when calling `auth_reversal`") + self.logger.error("InvalidArgumentException : Missing the required parameter `auth_reversal_request` when calling `auth_reversal`") raise ValueError("Missing the required parameter `auth_reversal_request` when calling `auth_reversal`") @@ -197,8 +191,7 @@ def mit_reversal(self, mit_reversal_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `mit_reversal` STARTED") + self.logger.info("CALL TO METHOD `mit_reversal` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -244,8 +237,7 @@ def mit_reversal_with_http_info(self, mit_reversal_request, **kwargs): del params['kwargs'] # verify the required parameter 'mit_reversal_request' is set if ('mit_reversal_request' not in params) or (params['mit_reversal_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `mit_reversal_request` when calling `mit_reversal`") + self.logger.error("InvalidArgumentException : Missing the required parameter `mit_reversal_request` when calling `mit_reversal`") raise ValueError("Missing the required parameter `mit_reversal_request` when calling `mit_reversal`") diff --git a/CyberSource/api/search_transactions_api.py b/CyberSource/api/search_transactions_api.py index 86245ea6..edf83354 100644 --- a/CyberSource/api/search_transactions_api.py +++ b/CyberSource/api/search_transactions_api.py @@ -36,13 +36,10 @@ class SearchTransactionsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def create_search(self, create_search_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_search` STARTED") + self.logger.info("CALL TO METHOD `create_search` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def create_search_with_http_info(self, create_search_request, **kwargs): del params['kwargs'] # verify the required parameter 'create_search_request' is set if ('create_search_request' not in params) or (params['create_search_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_search_request` when calling `create_search`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_search_request` when calling `create_search`") raise ValueError("Missing the required parameter `create_search_request` when calling `create_search`") @@ -187,8 +182,7 @@ def get_search(self, search_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_search` STARTED") + self.logger.info("CALL TO METHOD `get_search` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -234,8 +228,7 @@ def get_search_with_http_info(self, search_id, **kwargs): del params['kwargs'] # verify the required parameter 'search_id' is set if ('search_id' not in params) or (params['search_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `search_id` when calling `get_search`") + self.logger.error("InvalidArgumentException : Missing the required parameter `search_id` when calling `get_search`") raise ValueError("Missing the required parameter `search_id` when calling `get_search`") diff --git a/CyberSource/api/secure_file_share_api.py b/CyberSource/api/secure_file_share_api.py index b52f319d..cba763cb 100644 --- a/CyberSource/api/secure_file_share_api.py +++ b/CyberSource/api/secure_file_share_api.py @@ -36,13 +36,10 @@ class SecureFileShareApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def get_file(self, file_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_file` STARTED") + self.logger.info("CALL TO METHOD `get_file` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def get_file_with_http_info(self, file_id, **kwargs): del params['kwargs'] # verify the required parameter 'file_id' is set if ('file_id' not in params) or (params['file_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `file_id` when calling `get_file`") + self.logger.error("InvalidArgumentException : Missing the required parameter `file_id` when calling `get_file`") raise ValueError("Missing the required parameter `file_id` when calling `get_file`") @@ -198,8 +193,7 @@ def get_file_detail(self, start_date, end_date, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_file_detail` STARTED") + self.logger.info("CALL TO METHOD `get_file_detail` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -248,13 +242,11 @@ def get_file_detail_with_http_info(self, start_date, end_date, **kwargs): del params['kwargs'] # verify the required parameter 'start_date' is set if ('start_date' not in params) or (params['start_date'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_date` when calling `get_file_detail`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_date` when calling `get_file_detail`") raise ValueError("Missing the required parameter `start_date` when calling `get_file_detail`") # verify the required parameter 'end_date' is set if ('end_date' not in params) or (params['end_date'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_date` when calling `get_file_detail`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_date` when calling `get_file_detail`") raise ValueError("Missing the required parameter `end_date` when calling `get_file_detail`") diff --git a/CyberSource/api/subscriptions_api.py b/CyberSource/api/subscriptions_api.py index 3968915e..9e386347 100644 --- a/CyberSource/api/subscriptions_api.py +++ b/CyberSource/api/subscriptions_api.py @@ -36,13 +36,10 @@ class SubscriptionsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def activate_subscription(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `activate_subscription` STARTED") + self.logger.info("CALL TO METHOD `activate_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def activate_subscription_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `activate_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `activate_subscription`") raise ValueError("Missing the required parameter `id` when calling `activate_subscription`") @@ -195,8 +190,7 @@ def cancel_subscription(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `cancel_subscription` STARTED") + self.logger.info("CALL TO METHOD `cancel_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -242,8 +236,7 @@ def cancel_subscription_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `cancel_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `cancel_subscription`") raise ValueError("Missing the required parameter `id` when calling `cancel_subscription`") @@ -318,8 +311,7 @@ def create_subscription(self, create_subscription_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_subscription` STARTED") + self.logger.info("CALL TO METHOD `create_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -365,8 +357,7 @@ def create_subscription_with_http_info(self, create_subscription_request, **kwar del params['kwargs'] # verify the required parameter 'create_subscription_request' is set if ('create_subscription_request' not in params) or (params['create_subscription_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_subscription_request` when calling `create_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_subscription_request` when calling `create_subscription`") raise ValueError("Missing the required parameter `create_subscription_request` when calling `create_subscription`") @@ -440,8 +431,7 @@ def get_all_subscriptions(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_all_subscriptions` STARTED") + self.logger.info("CALL TO METHOD `get_all_subscriptions` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -566,8 +556,7 @@ def get_subscription(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_subscription` STARTED") + self.logger.info("CALL TO METHOD `get_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -613,8 +602,7 @@ def get_subscription_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_subscription`") raise ValueError("Missing the required parameter `id` when calling `get_subscription`") @@ -688,8 +676,7 @@ def get_subscription_code(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_subscription_code` STARTED") + self.logger.info("CALL TO METHOD `get_subscription_code` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -801,8 +788,7 @@ def suspend_subscription(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `suspend_subscription` STARTED") + self.logger.info("CALL TO METHOD `suspend_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -848,8 +834,7 @@ def suspend_subscription_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `suspend_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `suspend_subscription`") raise ValueError("Missing the required parameter `id` when calling `suspend_subscription`") @@ -925,8 +910,7 @@ def update_subscription(self, id, update_subscription, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `update_subscription` STARTED") + self.logger.info("CALL TO METHOD `update_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -973,13 +957,11 @@ def update_subscription_with_http_info(self, id, update_subscription, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `update_subscription`") raise ValueError("Missing the required parameter `id` when calling `update_subscription`") # verify the required parameter 'update_subscription' is set if ('update_subscription' not in params) or (params['update_subscription'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `update_subscription` when calling `update_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `update_subscription` when calling `update_subscription`") raise ValueError("Missing the required parameter `update_subscription` when calling `update_subscription`") diff --git a/CyberSource/api/subscriptions_follow_ons_api.py b/CyberSource/api/subscriptions_follow_ons_api.py index 0a44ec24..93db0da5 100644 --- a/CyberSource/api/subscriptions_follow_ons_api.py +++ b/CyberSource/api/subscriptions_follow_ons_api.py @@ -36,13 +36,10 @@ class SubscriptionsFollowOnsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def create_follow_on_subscription(self, request_id, create_subscription_request, returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `create_follow_on_subscription` STARTED") + self.logger.info("CALL TO METHOD `create_follow_on_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,13 +113,11 @@ def create_follow_on_subscription_with_http_info(self, request_id, create_subscr del params['kwargs'] # verify the required parameter 'request_id' is set if ('request_id' not in params) or (params['request_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `request_id` when calling `create_follow_on_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `request_id` when calling `create_follow_on_subscription`") raise ValueError("Missing the required parameter `request_id` when calling `create_follow_on_subscription`") # verify the required parameter 'create_subscription_request' is set if ('create_subscription_request' not in params) or (params['create_subscription_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `create_subscription_request` when calling `create_follow_on_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `create_subscription_request` when calling `create_follow_on_subscription`") raise ValueError("Missing the required parameter `create_subscription_request` when calling `create_follow_on_subscription`") @@ -197,8 +191,7 @@ def get_follow_on_subscription(self, request_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_follow_on_subscription` STARTED") + self.logger.info("CALL TO METHOD `get_follow_on_subscription` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -244,8 +237,7 @@ def get_follow_on_subscription_with_http_info(self, request_id, **kwargs): del params['kwargs'] # verify the required parameter 'request_id' is set if ('request_id' not in params) or (params['request_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `request_id` when calling `get_follow_on_subscription`") + self.logger.error("InvalidArgumentException : Missing the required parameter `request_id` when calling `get_follow_on_subscription`") raise ValueError("Missing the required parameter `request_id` when calling `get_follow_on_subscription`") diff --git a/CyberSource/api/taxes_api.py b/CyberSource/api/taxes_api.py index 439e649f..4a568072 100644 --- a/CyberSource/api/taxes_api.py +++ b/CyberSource/api/taxes_api.py @@ -36,13 +36,10 @@ class TaxesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def calculate_tax(self, tax_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `calculate_tax` STARTED") + self.logger.info("CALL TO METHOD `calculate_tax` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def calculate_tax_with_http_info(self, tax_request, **kwargs): del params['kwargs'] # verify the required parameter 'tax_request' is set if ('tax_request' not in params) or (params['tax_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `tax_request` when calling `calculate_tax`") + self.logger.error("InvalidArgumentException : Missing the required parameter `tax_request` when calling `calculate_tax`") raise ValueError("Missing the required parameter `tax_request` when calling `calculate_tax`") @@ -188,8 +183,7 @@ def void_tax(self, void_tax_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `void_tax` STARTED") + self.logger.info("CALL TO METHOD `void_tax` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -236,13 +230,11 @@ def void_tax_with_http_info(self, void_tax_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'void_tax_request' is set if ('void_tax_request' not in params) or (params['void_tax_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `void_tax_request` when calling `void_tax`") + self.logger.error("InvalidArgumentException : Missing the required parameter `void_tax_request` when calling `void_tax`") raise ValueError("Missing the required parameter `void_tax_request` when calling `void_tax`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_tax`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_tax`") raise ValueError("Missing the required parameter `id` when calling `void_tax`") diff --git a/CyberSource/api/token_api.py b/CyberSource/api/token_api.py index 6c488afb..5b61a9b0 100644 --- a/CyberSource/api/token_api.py +++ b/CyberSource/api/token_api.py @@ -36,13 +36,10 @@ class TokenApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_card_art_asset(self, instrument_identifier_id, token_provider, asset_typ returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_card_art_asset` STARTED") + self.logger.info("CALL TO METHOD `get_card_art_asset` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,18 +115,15 @@ def get_card_art_asset_with_http_info(self, instrument_identifier_id, token_prov del params['kwargs'] # verify the required parameter 'instrument_identifier_id' is set if ('instrument_identifier_id' not in params) or (params['instrument_identifier_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_card_art_asset`") + self.logger.error("InvalidArgumentException : Missing the required parameter `instrument_identifier_id` when calling `get_card_art_asset`") raise ValueError("Missing the required parameter `instrument_identifier_id` when calling `get_card_art_asset`") # verify the required parameter 'token_provider' is set if ('token_provider' not in params) or (params['token_provider'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `token_provider` when calling `get_card_art_asset`") + self.logger.error("InvalidArgumentException : Missing the required parameter `token_provider` when calling `get_card_art_asset`") raise ValueError("Missing the required parameter `token_provider` when calling `get_card_art_asset`") # verify the required parameter 'asset_type' is set if ('asset_type' not in params) or (params['asset_type'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `asset_type` when calling `get_card_art_asset`") + self.logger.error("InvalidArgumentException : Missing the required parameter `asset_type` when calling `get_card_art_asset`") raise ValueError("Missing the required parameter `asset_type` when calling `get_card_art_asset`") @@ -213,8 +206,7 @@ def post_token_payment_credentials(self, token_id, post_payment_credentials_requ returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_token_payment_credentials` STARTED") + self.logger.info("CALL TO METHOD `post_token_payment_credentials` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -262,13 +254,11 @@ def post_token_payment_credentials_with_http_info(self, token_id, post_payment_c del params['kwargs'] # verify the required parameter 'token_id' is set if ('token_id' not in params) or (params['token_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `token_id` when calling `post_token_payment_credentials`") + self.logger.error("InvalidArgumentException : Missing the required parameter `token_id` when calling `post_token_payment_credentials`") raise ValueError("Missing the required parameter `token_id` when calling `post_token_payment_credentials`") # verify the required parameter 'post_payment_credentials_request' is set if ('post_payment_credentials_request' not in params) or (params['post_payment_credentials_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `post_payment_credentials_request` when calling `post_token_payment_credentials`") + self.logger.error("InvalidArgumentException : Missing the required parameter `post_payment_credentials_request` when calling `post_token_payment_credentials`") raise ValueError("Missing the required parameter `post_payment_credentials_request` when calling `post_token_payment_credentials`") diff --git a/CyberSource/api/tokenized_card_api.py b/CyberSource/api/tokenized_card_api.py index c6c0ffa1..73cb25bf 100644 --- a/CyberSource/api/tokenized_card_api.py +++ b/CyberSource/api/tokenized_card_api.py @@ -36,13 +36,10 @@ class TokenizedCardApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -69,8 +66,7 @@ def delete_tokenized_card(self, tokenized_card_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `delete_tokenized_card` STARTED") + self.logger.info("CALL TO METHOD `delete_tokenized_card` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -117,8 +113,7 @@ def delete_tokenized_card_with_http_info(self, tokenized_card_id, **kwargs): del params['kwargs'] # verify the required parameter 'tokenized_card_id' is set if ('tokenized_card_id' not in params) or (params['tokenized_card_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `tokenized_card_id` when calling `delete_tokenized_card`") + self.logger.error("InvalidArgumentException : Missing the required parameter `tokenized_card_id` when calling `delete_tokenized_card`") raise ValueError("Missing the required parameter `tokenized_card_id` when calling `delete_tokenized_card`") @@ -196,8 +191,7 @@ def get_tokenized_card(self, tokenized_card_id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_tokenized_card` STARTED") + self.logger.info("CALL TO METHOD `get_tokenized_card` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -244,8 +238,7 @@ def get_tokenized_card_with_http_info(self, tokenized_card_id, **kwargs): del params['kwargs'] # verify the required parameter 'tokenized_card_id' is set if ('tokenized_card_id' not in params) or (params['tokenized_card_id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `tokenized_card_id` when calling `get_tokenized_card`") + self.logger.error("InvalidArgumentException : Missing the required parameter `tokenized_card_id` when calling `get_tokenized_card`") raise ValueError("Missing the required parameter `tokenized_card_id` when calling `get_tokenized_card`") @@ -323,8 +316,7 @@ def post_tokenized_card(self, tokenizedcard_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `post_tokenized_card` STARTED") + self.logger.info("CALL TO METHOD `post_tokenized_card` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -371,8 +363,7 @@ def post_tokenized_card_with_http_info(self, tokenizedcard_request, **kwargs): del params['kwargs'] # verify the required parameter 'tokenizedcard_request' is set if ('tokenizedcard_request' not in params) or (params['tokenizedcard_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `tokenizedcard_request` when calling `post_tokenized_card`") + self.logger.error("InvalidArgumentException : Missing the required parameter `tokenizedcard_request` when calling `post_tokenized_card`") raise ValueError("Missing the required parameter `tokenizedcard_request` when calling `post_tokenized_card`") diff --git a/CyberSource/api/transaction_batches_api.py b/CyberSource/api/transaction_batches_api.py index 90939d2e..a76a350e 100644 --- a/CyberSource/api/transaction_batches_api.py +++ b/CyberSource/api/transaction_batches_api.py @@ -36,13 +36,10 @@ class TransactionBatchesApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -70,8 +67,7 @@ def get_transaction_batch_details(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_transaction_batch_details` STARTED") + self.logger.info("CALL TO METHOD `get_transaction_batch_details` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -119,8 +115,7 @@ def get_transaction_batch_details_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction_batch_details`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction_batch_details`") raise ValueError("Missing the required parameter `id` when calling `get_transaction_batch_details`") @@ -199,8 +194,7 @@ def get_transaction_batch_id(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_transaction_batch_id` STARTED") + self.logger.info("CALL TO METHOD `get_transaction_batch_id` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -246,8 +240,7 @@ def get_transaction_batch_id_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction_batch_id`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction_batch_id`") raise ValueError("Missing the required parameter `id` when calling `get_transaction_batch_id`") @@ -323,8 +316,7 @@ def get_transaction_batches(self, start_time, end_time, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_transaction_batches` STARTED") + self.logger.info("CALL TO METHOD `get_transaction_batches` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -371,13 +363,11 @@ def get_transaction_batches_with_http_info(self, start_time, end_time, **kwargs) del params['kwargs'] # verify the required parameter 'start_time' is set if ('start_time' not in params) or (params['start_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_transaction_batches`") + self.logger.error("InvalidArgumentException : Missing the required parameter `start_time` when calling `get_transaction_batches`") raise ValueError("Missing the required parameter `start_time` when calling `get_transaction_batches`") # verify the required parameter 'end_time' is set if ('end_time' not in params) or (params['end_time'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_transaction_batches`") + self.logger.error("InvalidArgumentException : Missing the required parameter `end_time` when calling `get_transaction_batches`") raise ValueError("Missing the required parameter `end_time` when calling `get_transaction_batches`") @@ -453,8 +443,7 @@ def upload_transaction_batch(self, file, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `upload_transaction_batch` STARTED") + self.logger.info("CALL TO METHOD `upload_transaction_batch` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -500,8 +489,7 @@ def upload_transaction_batch_with_http_info(self, file, **kwargs): del params['kwargs'] # verify the required parameter 'file' is set if ('file' not in params) or (params['file'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `file` when calling `upload_transaction_batch`") + self.logger.error("InvalidArgumentException : Missing the required parameter `file` when calling `upload_transaction_batch`") raise ValueError("Missing the required parameter `file` when calling `upload_transaction_batch`") diff --git a/CyberSource/api/transaction_details_api.py b/CyberSource/api/transaction_details_api.py index 0d23742b..e7ba8ecb 100644 --- a/CyberSource/api/transaction_details_api.py +++ b/CyberSource/api/transaction_details_api.py @@ -36,13 +36,10 @@ class TransactionDetailsApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_transaction(self, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_transaction` STARTED") + self.logger.info("CALL TO METHOD `get_transaction` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_transaction_with_http_info(self, id, **kwargs): del params['kwargs'] # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `get_transaction`") raise ValueError("Missing the required parameter `id` when calling `get_transaction`") diff --git a/CyberSource/api/transient_token_data_api.py b/CyberSource/api/transient_token_data_api.py index a612defa..58127dfe 100644 --- a/CyberSource/api/transient_token_data_api.py +++ b/CyberSource/api/transient_token_data_api.py @@ -36,13 +36,10 @@ class TransientTokenDataApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def get_payment_credentials_for_transient_token(self, payment_credentials_refere returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_payment_credentials_for_transient_token` STARTED") + self.logger.info("CALL TO METHOD `get_payment_credentials_for_transient_token` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def get_payment_credentials_for_transient_token_with_http_info(self, payment_cre del params['kwargs'] # verify the required parameter 'payment_credentials_reference' is set if ('payment_credentials_reference' not in params) or (params['payment_credentials_reference'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `payment_credentials_reference` when calling `get_payment_credentials_for_transient_token`") + self.logger.error("InvalidArgumentException : Missing the required parameter `payment_credentials_reference` when calling `get_payment_credentials_for_transient_token`") raise ValueError("Missing the required parameter `payment_credentials_reference` when calling `get_payment_credentials_for_transient_token`") @@ -191,8 +186,7 @@ def get_transaction_for_transient_token(self, transient_token, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_transaction_for_transient_token` STARTED") + self.logger.info("CALL TO METHOD `get_transaction_for_transient_token` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -238,8 +232,7 @@ def get_transaction_for_transient_token_with_http_info(self, transient_token, ** del params['kwargs'] # verify the required parameter 'transient_token' is set if ('transient_token' not in params) or (params['transient_token'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `transient_token` when calling `get_transaction_for_transient_token`") + self.logger.error("InvalidArgumentException : Missing the required parameter `transient_token` when calling `get_transaction_for_transient_token`") raise ValueError("Missing the required parameter `transient_token` when calling `get_transaction_for_transient_token`") diff --git a/CyberSource/api/unified_checkout_capture_context_api.py b/CyberSource/api/unified_checkout_capture_context_api.py index 6d9c733c..1f779769 100644 --- a/CyberSource/api/unified_checkout_capture_context_api.py +++ b/CyberSource/api/unified_checkout_capture_context_api.py @@ -36,13 +36,10 @@ class UnifiedCheckoutCaptureContextApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def generate_unified_checkout_capture_context(self, generate_unified_checkout_ca returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `generate_unified_checkout_capture_context` STARTED") + self.logger.info("CALL TO METHOD `generate_unified_checkout_capture_context` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def generate_unified_checkout_capture_context_with_http_info(self, generate_unif del params['kwargs'] # verify the required parameter 'generate_unified_checkout_capture_context_request' is set if ('generate_unified_checkout_capture_context_request' not in params) or (params['generate_unified_checkout_capture_context_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `generate_unified_checkout_capture_context_request` when calling `generate_unified_checkout_capture_context`") + self.logger.error("InvalidArgumentException : Missing the required parameter `generate_unified_checkout_capture_context_request` when calling `generate_unified_checkout_capture_context`") raise ValueError("Missing the required parameter `generate_unified_checkout_capture_context_request` when calling `generate_unified_checkout_capture_context`") diff --git a/CyberSource/api/user_management_api.py b/CyberSource/api/user_management_api.py index 481b4d82..4440f453 100644 --- a/CyberSource/api/user_management_api.py +++ b/CyberSource/api/user_management_api.py @@ -36,13 +36,10 @@ class UserManagementApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -71,8 +68,7 @@ def get_users(self, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `get_users` STARTED") + self.logger.info("CALL TO METHOD `get_users` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): diff --git a/CyberSource/api/user_management_search_api.py b/CyberSource/api/user_management_search_api.py index 1f5ca7f2..d42f89e4 100644 --- a/CyberSource/api/user_management_search_api.py +++ b/CyberSource/api/user_management_search_api.py @@ -36,13 +36,10 @@ class UserManagementSearchApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def search_users(self, search_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `search_users` STARTED") + self.logger.info("CALL TO METHOD `search_users` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def search_users_with_http_info(self, search_request, **kwargs): del params['kwargs'] # verify the required parameter 'search_request' is set if ('search_request' not in params) or (params['search_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `search_request` when calling `search_users`") + self.logger.error("InvalidArgumentException : Missing the required parameter `search_request` when calling `search_users`") raise ValueError("Missing the required parameter `search_request` when calling `search_users`") diff --git a/CyberSource/api/verification_api.py b/CyberSource/api/verification_api.py index 78dbf70c..bc77dd84 100644 --- a/CyberSource/api/verification_api.py +++ b/CyberSource/api/verification_api.py @@ -36,13 +36,10 @@ class VerificationApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def validate_export_compliance(self, validate_export_compliance_request, **kwarg returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `validate_export_compliance` STARTED") + self.logger.info("CALL TO METHOD `validate_export_compliance` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def validate_export_compliance_with_http_info(self, validate_export_compliance_r del params['kwargs'] # verify the required parameter 'validate_export_compliance_request' is set if ('validate_export_compliance_request' not in params) or (params['validate_export_compliance_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `validate_export_compliance_request` when calling `validate_export_compliance`") + self.logger.error("InvalidArgumentException : Missing the required parameter `validate_export_compliance_request` when calling `validate_export_compliance`") raise ValueError("Missing the required parameter `validate_export_compliance_request` when calling `validate_export_compliance`") @@ -187,8 +182,7 @@ def verify_customer_address(self, verify_customer_address_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `verify_customer_address` STARTED") + self.logger.info("CALL TO METHOD `verify_customer_address` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -234,8 +228,7 @@ def verify_customer_address_with_http_info(self, verify_customer_address_request del params['kwargs'] # verify the required parameter 'verify_customer_address_request' is set if ('verify_customer_address_request' not in params) or (params['verify_customer_address_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `verify_customer_address_request` when calling `verify_customer_address`") + self.logger.error("InvalidArgumentException : Missing the required parameter `verify_customer_address_request` when calling `verify_customer_address`") raise ValueError("Missing the required parameter `verify_customer_address_request` when calling `verify_customer_address`") diff --git a/CyberSource/api/void_api.py b/CyberSource/api/void_api.py index 10b16bd3..bd33c78b 100644 --- a/CyberSource/api/void_api.py +++ b/CyberSource/api/void_api.py @@ -36,13 +36,10 @@ class VoidApi(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -68,8 +65,7 @@ def mit_void(self, mit_void_request, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `mit_void` STARTED") + self.logger.info("CALL TO METHOD `mit_void` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -115,8 +111,7 @@ def mit_void_with_http_info(self, mit_void_request, **kwargs): del params['kwargs'] # verify the required parameter 'mit_void_request' is set if ('mit_void_request' not in params) or (params['mit_void_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `mit_void_request` when calling `mit_void`") + self.logger.error("InvalidArgumentException : Missing the required parameter `mit_void_request` when calling `mit_void`") raise ValueError("Missing the required parameter `mit_void_request` when calling `mit_void`") @@ -188,8 +183,7 @@ def void_capture(self, void_capture_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `void_capture` STARTED") + self.logger.info("CALL TO METHOD `void_capture` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -236,13 +230,11 @@ def void_capture_with_http_info(self, void_capture_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'void_capture_request' is set if ('void_capture_request' not in params) or (params['void_capture_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `void_capture_request` when calling `void_capture`") + self.logger.error("InvalidArgumentException : Missing the required parameter `void_capture_request` when calling `void_capture`") raise ValueError("Missing the required parameter `void_capture_request` when calling `void_capture`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_capture`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_capture`") raise ValueError("Missing the required parameter `id` when calling `void_capture`") @@ -317,8 +309,7 @@ def void_credit(self, void_credit_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `void_credit` STARTED") + self.logger.info("CALL TO METHOD `void_credit` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -365,13 +356,11 @@ def void_credit_with_http_info(self, void_credit_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'void_credit_request' is set if ('void_credit_request' not in params) or (params['void_credit_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `void_credit_request` when calling `void_credit`") + self.logger.error("InvalidArgumentException : Missing the required parameter `void_credit_request` when calling `void_credit`") raise ValueError("Missing the required parameter `void_credit_request` when calling `void_credit`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_credit`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_credit`") raise ValueError("Missing the required parameter `id` when calling `void_credit`") @@ -446,8 +435,7 @@ def void_payment(self, void_payment_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `void_payment` STARTED") + self.logger.info("CALL TO METHOD `void_payment` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -494,13 +482,11 @@ def void_payment_with_http_info(self, void_payment_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'void_payment_request' is set if ('void_payment_request' not in params) or (params['void_payment_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `void_payment_request` when calling `void_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `void_payment_request` when calling `void_payment`") raise ValueError("Missing the required parameter `void_payment_request` when calling `void_payment`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_payment`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_payment`") raise ValueError("Missing the required parameter `id` when calling `void_payment`") @@ -575,8 +561,7 @@ def void_refund(self, void_refund_request, id, **kwargs): returns the request thread. """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `void_refund` STARTED") + self.logger.info("CALL TO METHOD `void_refund` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -623,13 +608,11 @@ def void_refund_with_http_info(self, void_refund_request, id, **kwargs): del params['kwargs'] # verify the required parameter 'void_refund_request' is set if ('void_refund_request' not in params) or (params['void_refund_request'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `void_refund_request` when calling `void_refund`") + self.logger.error("InvalidArgumentException : Missing the required parameter `void_refund_request` when calling `void_refund`") raise ValueError("Missing the required parameter `void_refund_request` when calling `void_refund`") # verify the required parameter 'id' is set if ('id' not in params) or (params['id'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_refund`") + self.logger.error("InvalidArgumentException : Missing the required parameter `id` when calling `void_refund`") raise ValueError("Missing the required parameter `id` when calling `void_refund`") diff --git a/CyberSource/api_client.py b/CyberSource/api_client.py index c6ffa3d6..ae9369a2 100644 --- a/CyberSource/api_client.py +++ b/CyberSource/api_client.py @@ -71,7 +71,6 @@ def __init__(self, host=None, header_name=None, header_value=None, cookie=None): """ Constructor of the class. """ - self.rest_client = RESTClientObject() self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value @@ -148,17 +147,8 @@ def to_camel_case(self, snake_str): def set_configuration(self,config): self.mconfig = MerchantConfiguration() self.mconfig.set_merchantconfig(config) - rconfig = Configuration() - # To reinitialize with logging config - self.rest_client = RESTClientObject(log_config=self.mconfig.log_config) - - set_client_cert = rconfig.set_merchantclientcert(config) - set_proxy = rconfig.set_merchantproxyconfig(config) - - # The below two lines are to set proxy details, client cert details and if present reinitialize the REST object as a proxy manager - if set_client_cert or set_proxy: - self.rest_client = RESTClientObject(rconfig, log_config=self.mconfig.log_config) # Reinitialising REST object as a proxy manager instead of pool manager + self.rest_client = RESTClientObject(mconfig=self.mconfig) # This implements the fall back logic for JWT parameters key alias,key password,json file path self.mconfig.validate_merchant_details(config) diff --git a/CyberSource/logging/log_factory.py b/CyberSource/logging/log_factory.py index 4e2917e6..fa801bc6 100644 --- a/CyberSource/logging/log_factory.py +++ b/CyberSource/logging/log_factory.py @@ -5,16 +5,19 @@ from .log_configuration import LogConfiguration from .sensitive_formatter import SensitiveFormatter - def setup_logger(className, log_config = None): if log_config is None: log_config = LogConfiguration() - if log_config.enable_log is True: - # create logger - logger = logging.getLogger(className) - log_level = log_config.log_level.upper() - logger.setLevel(log_level) + # create logger + logger = logging.getLogger(className) + log_level = log_config.log_level.upper() + logger.setLevel(log_level) + + if logger.hasHandlers(): + logger.handlers.clear() + + if log_config.enable_log is True: log_folder = log_config.log_directory log_file_name = log_config.log_file_name @@ -38,4 +41,4 @@ def setup_logger(className, log_config = None): # add ch to logger logger.addHandler(handler) - return logger \ No newline at end of file + return logger \ No newline at end of file diff --git a/CyberSource/rest.py b/CyberSource/rest.py index 8f6c43f6..d768bd1f 100644 --- a/CyberSource/rest.py +++ b/CyberSource/rest.py @@ -18,6 +18,7 @@ import certifi import CyberSource.logging.log_factory as LogFactory import re +import hashlib # python 2 and python 3 compatibility library from six import PY3 @@ -34,7 +35,6 @@ class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -55,8 +55,50 @@ def getheader(self, name, default=None): class RESTClientObject(object): - - def __init__(self, rconfig = None, pools_size=4, maxsize=4, log_config = None): + _urllib3_poolmanagers = {} + + @classmethod + def get_pool_manager(cls, hash_candidates_dict): + sorted_items = sorted(hash_candidates_dict.items()) + json_string = json.dumps(sorted_items, separators=(',', ':')).encode('utf-8') + hash_object = hashlib.sha256() + hash_object.update(json_string) + hashed_key = hash_object.hexdigest() + + if hashed_key not in cls._urllib3_poolmanagers: + my_pool_manager = None + if 'proxy' in hash_candidates_dict: + my_pool_manager = urllib3.ProxyManager( + num_pools=hash_candidates_dict['pools_size'], + maxsize=hash_candidates_dict['maxsize'], + cert_reqs=hash_candidates_dict['cert_reqs'], + ca_certs=hash_candidates_dict['ca_certs'], + cert_file=hash_candidates_dict['cert_file'], + key_file=hash_candidates_dict['key_file'], + key_password=hash_candidates_dict['key_password'], + proxy_url=hash_candidates_dict['proxy'], + proxy_headers=hash_candidates_dict['proxy_auth_headers'], + keepalive_delay=hash_candidates_dict['keepalive_delay'], + keepalive_idle_window=hash_candidates_dict['keepalive_idle_window'] + ) + else: + my_pool_manager = urllib3.PoolManager( + num_pools=hash_candidates_dict['pools_size'], + maxsize=hash_candidates_dict['maxsize'], + cert_reqs=hash_candidates_dict['cert_reqs'], + ca_certs=hash_candidates_dict['ca_certs'], + cert_file=hash_candidates_dict['cert_file'], + key_file=hash_candidates_dict['key_file'], + key_password=hash_candidates_dict['key_password'], + keepalive_delay=hash_candidates_dict['keepalive_delay'], + keepalive_idle_window=hash_candidates_dict['keepalive_idle_window'] + ) + + cls._urllib3_poolmanagers[hashed_key] = my_pool_manager + + return cls._urllib3_poolmanagers[hashed_key] + + def __init__(self, mconfig = None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 @@ -64,73 +106,78 @@ def __init__(self, rconfig = None, pools_size=4, maxsize=4, log_config = None): # ca_certs vs cert_file vs key_file # http://stackoverflow.com/a/23957365/2985775 + if mconfig is None: + raise ValueError("Merchant Configuration cannot be None") + + log_config = mconfig.log_config + self.logger = LogFactory.setup_logger(self.__class__.__name__, log_config) if log_config is not None: self.enable_log = log_config.enable_log else: self.enable_log = False - if rconfig is None: - rconfig = Configuration() - # cert_reqs - if rconfig.verify_ssl: + if mconfig.ssl_verify: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE # ca_certs - if rconfig.ssl_ca_cert: - ca_certs = rconfig.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - # cert_file - cert_file = rconfig.cert_file - - # key file - key_file = rconfig.key_file - - # key pass - key_password = rconfig.key_password + ca_certs = certifi.where() + + cert_file = None + key_file = None + key_password = None + + if mconfig.enable_client_cert: + import os + # cert_file + cert_file = os.path.join(mconfig.client_cert_dir, mconfig.ssl_client_cert) + + # key file + key_file = os.path.join(mconfig.client_cert_dir, mconfig.private_key) + + # key pass + key_password = mconfig.ssl_key_password + + pools_size = mconfig.get_MaxPoolSize() + maxsize = mconfig.get_MaxNumIdleConnections() + keepalive_delay = mconfig.get_MaxKeepAliveDelay() + keepalive_idle_window = mconfig.get_MaxKeepAliveIdleWindow() + + hash_candidates = {} + hash_candidates['cert_reqs'] = cert_reqs + hash_candidates['ca_certs'] = ca_certs + hash_candidates['cert_file'] = cert_file + hash_candidates['key_file'] = key_file + hash_candidates['key_password'] = key_password + hash_candidates['pools_size'] = pools_size + hash_candidates['maxsize'] = maxsize + hash_candidates['keepalive_delay'] = keepalive_delay + hash_candidates['keepalive_idle_window'] = keepalive_idle_window # proxy - proxy = rconfig.proxy + proxy_host = mconfig.proxy_address # https pool manager - if proxy: + if mconfig.use_proxy and not (proxy_host is None or proxy_host == ''): # proxy auth headers - proxy_username = rconfig.proxy_username - proxy_password = rconfig.proxy_password + proxy_host = proxy_host.replace("https://", "").replace("http://", "") + proxy_port = mconfig.proxy_port + proxy_username = mconfig.proxy_username + proxy_password = mconfig.proxy_password proxy_auth_headers = None - + proxy = 'http://' + proxy_host + ':' + proxy_port + + hash_candidates['proxy'] = proxy + if (proxy_username and proxy_password): proxy_auth_headers = make_headers(proxy_basic_auth=proxy_username + ':' + proxy_password) + hash_candidates['proxy_auth_headers'] = proxy_auth_headers - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=cert_file, - key_file=key_file, - key_password=key_password, - proxy_url=proxy, - proxy_headers=proxy_auth_headers - ) - else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=cert_file, - key_file=key_file, - key_password=key_password - ) - + self.pool_manager = self.__class__.get_pool_manager(hash_candidates) def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None): diff --git a/authenticationsdk/core/Authorization.py b/authenticationsdk/core/Authorization.py index 937d293e..abbf6be9 100644 --- a/authenticationsdk/core/Authorization.py +++ b/authenticationsdk/core/Authorization.py @@ -27,20 +27,19 @@ def get_token(self, mconfig, date_time, request_type_method, request_target=None http_sig_token.http_signature_token(mconfig, date_time, request_type_method, request_target, request_json_path_data) sig_token = http_sig_token.get_token() # Logging the parameters Content-Type,Merchant id,Date ,Host to the log file - if mconfig.log_config.enable_log is True: - self.logger.info("Using Request Target: " + request_target) - self.logger.info("Authentication Type: " + mconfig.authentication_type) - self.logger.info("Request-Type: " + request_type_method) - self.logger.info(GlobalLabelParameters.CONTENT_TYPE + ": " + GlobalLabelParameters.APPLICATION_JSON) - self.logger.info(GlobalLabelParameters.MERCHANT_ID + ": " + str(mconfig.merchant_id)) - self.logger.info(GlobalLabelParameters.DATE + ": " + date_time) - self.logger.info(GlobalLabelParameters.HOST + ": " + mconfig.request_host) - # Logging the Digest when Request_type_method is Post - if request_type_method.upper() == GlobalLabelParameters.POST or request_type_method.upper() == GlobalLabelParameters.PUT: - digest_obj = DigestAndPayload() - encoded_digest = digest_obj.string_digest_generation(request_json_path_data) - # self.logger.info(GlobalLabelParameters.DIGEST + ":" + GlobalLabelParameters.DIGEST_PREFIX + (encoded_digest).decode("utf-8")) - # self.logger.info("Signature: " + sig_token) + self.logger.info("Using Request Target: " + request_target) + self.logger.info("Authentication Type: " + mconfig.authentication_type) + self.logger.info("Request-Type: " + request_type_method) + self.logger.info(GlobalLabelParameters.CONTENT_TYPE + ": " + GlobalLabelParameters.APPLICATION_JSON) + self.logger.info(GlobalLabelParameters.MERCHANT_ID + ": " + str(mconfig.merchant_id)) + self.logger.info(GlobalLabelParameters.DATE + ": " + date_time) + self.logger.info(GlobalLabelParameters.HOST + ": " + mconfig.request_host) + # Logging the Digest when Request_type_method is Post + if request_type_method.upper() == GlobalLabelParameters.POST or request_type_method.upper() == GlobalLabelParameters.PUT: + digest_obj = DigestAndPayload() + encoded_digest = digest_obj.string_digest_generation(request_json_path_data) + # self.logger.info(GlobalLabelParameters.DIGEST + ":" + GlobalLabelParameters.DIGEST_PREFIX + (encoded_digest).decode("utf-8")) + # self.logger.info("Signature: " + sig_token) return sig_token # JWT-Call @@ -50,16 +49,15 @@ def get_token(self, mconfig, date_time, request_type_method, request_target=None sig_token_jwt = jwt_sig_token.get_token() # Logging the parameters Content-Type,Merchant id,Date ,Host to the log file - if mconfig.log_config.enable_log is True: - self.logger.info("Using Request Target: " + request_target) - self.logger.info("Authentication Type: " + mconfig.authentication_type) - self.logger.info("Request-Type: " + request_type_method) - self.logger.info(GlobalLabelParameters.CONTENT_TYPE + ": " + GlobalLabelParameters.APPLICATION_JSON) - self.logger.info(GlobalLabelParameters.MERCHANT_ID + ": " + str(mconfig.merchant_id)) - self.logger.info(GlobalLabelParameters.DATE + ": " + date_time) - self.logger.info(GlobalLabelParameters.HOST + ": " + mconfig.request_host) - # Logging the Digest when Request_type_method is Post - # self.logger.info("Authorization Bearer: " + sig_token_jwt.encode("utf-8").decode("utf-8")) + self.logger.info("Using Request Target: " + request_target) + self.logger.info("Authentication Type: " + mconfig.authentication_type) + self.logger.info("Request-Type: " + request_type_method) + self.logger.info(GlobalLabelParameters.CONTENT_TYPE + ": " + GlobalLabelParameters.APPLICATION_JSON) + self.logger.info(GlobalLabelParameters.MERCHANT_ID + ": " + str(mconfig.merchant_id)) + self.logger.info(GlobalLabelParameters.DATE + ": " + date_time) + self.logger.info(GlobalLabelParameters.HOST + ": " + mconfig.request_host) + # Logging the Digest when Request_type_method is Post + # self.logger.info("Authorization Bearer: " + sig_token_jwt.encode("utf-8").decode("utf-8")) return sig_token_jwt elif authentication_type.upper() == GlobalLabelParameters.OAUTH.upper(): token = OAuthToken() diff --git a/authenticationsdk/core/MerchantConfiguration.py b/authenticationsdk/core/MerchantConfiguration.py index 3f7a540e..b3ba3a43 100644 --- a/authenticationsdk/core/MerchantConfiguration.py +++ b/authenticationsdk/core/MerchantConfiguration.py @@ -13,7 +13,6 @@ class MerchantConfiguration: - def __init__(self): self.merchant_keyid = None self.merchant_secretkey = None @@ -43,8 +42,11 @@ def __init__(self): self.response_code = None self.response_message = None self.v_c_correlation_id = None + self.use_proxy = None self.proxy_address = None self.proxy_port = None + self.proxy_username = None + self.proxy_password = None self.key_file_name = None self.solution_id = None self.log_config = None @@ -57,6 +59,11 @@ def __init__(self): self.mleForRequestPublicCertPath = None self.p12KeyFilePath = None self.logger = LogFactory.setup_logger(self.__class__.__name__) + self.max_num_idle_connections = GlobalLabelParameters.DEFAULT_MAX_IDLE_CONNECTIONS + self.max_pool_size = GlobalLabelParameters.DEFAULT_MAX_POOL_SIZE + self.max_keep_alive_delay = GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_DELAY + self.max_keep_alive_idle_window = GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_IDLE_WINDOW + self.ssl_verify = None #region Getters and Setters def set_merchant_keyid(self, value): @@ -121,6 +128,12 @@ def set_request_host(self, value): else: self.request_host = self.run_environment + def set_use_proxy(self, value): + if not (value.get('use_proxy') is None): + self.use_proxy = value['use_proxy'] + else: + self.use_proxy = False + def set_proxy_address(self, value): if not (value.get('proxy_address') is None): self.proxy_address = value['proxy_address'] @@ -129,6 +142,14 @@ def set_proxy_port(self, value): if not (value.get("proxy_port") is None): self.proxy_port = value['proxy_port'] + def set_proxy_username(self, value): + if not (value.get('proxy_username') is None): + self.proxy_username = value['proxy_username'] + + def set_proxy_password(self, value): + if not (value.get("proxy_password") is None): + self.proxy_password = value['proxy_password'] + def set_key_file_name(self, value): if not (value.get('key_file_name') is None): self.key_file_name = value['key_file_name'] @@ -256,12 +277,45 @@ def set_p12KeyFilePath(self, value): def get_p12KeyFilePath(self): return self.p12KeyFilePath + + def get_MaxNumIdleConnections(self): + return self.max_num_idle_connections + + def set_MaxNumIdleConnections(self, value): + if value.get('maxNumIdleConnections') is not None: + self.max_num_idle_connections = value['maxNumIdleConnections'] + + def get_MaxPoolSize(self): + return self.max_pool_size + + def set_MaxPoolSize(self, value): + if value.get('maxPoolSize') is not None: + self.max_pool_size = value['maxPoolSize'] + + def get_MaxKeepAliveDelay(self): + return self.max_keep_alive_delay + + def set_MaxKeepAliveDelay(self, value): + if value.get('maxKeepAliveDelay') is not None: + self.max_keep_alive_delay = value['maxKeepAliveDelay'] + + def get_MaxKeepAliveIdleWindow(self): + return self.max_keep_alive_idle_window + + def set_MaxKeepAliveIdleWindow(self, value): + if value.get('maxKeepAliveIdleWindow') is not None: + self.max_keep_alive_idle_window = value['maxKeepAliveIdleWindow'] + + def set_SSL_verify(self, value): + if not (value.get('ssl_verify') is None): + self.ssl_verify = value['ssl_verify'] + else: + self.ssl_verify = True #endregion # This method sets the Merchant Configuration Variables to its respective values after reading from cybs.properties def set_merchantconfig(self, val): - self.set_key_password(val) self.set_key_alias(val) self.set_key_file_path(val) @@ -277,8 +331,11 @@ def set_merchantconfig(self, val): self.set_merchant_id(val) self.set_authentication_type(val) self.set_request_host(val) + self.set_use_proxy(val) self.set_proxy_address(val) self.set_proxy_port(val) + self.set_proxy_username(val) + self.set_proxy_password(val) self.set_enable_client_cert(val) self.set_client_cert_dir(val) self.set_ssl_client_cert(val) @@ -296,6 +353,11 @@ def set_merchantconfig(self, val): self.set_mapToControlMLEonAPI(val) self.set_mleForRequestPublicCertPath(val) self.set_mleKeyAlias(val) + self.set_MaxNumIdleConnections(val) + self.set_MaxPoolSize(val) + self.set_MaxKeepAliveDelay(val) + self.set_MaxKeepAliveIdleWindow(val) + self.set_SSL_verify(val) # Returns the time in format as defined by RFC7231 def get_time(self): @@ -308,9 +370,8 @@ def get_time(self): def validate_merchant_details(self, details, mconfig = None): # verify Mandatory Properties self.logger = LogFactory.setup_logger(self.__class__.__name__, self.log_config) - if self.log_config.enable_log is True: - self.logger.info("START> ======================================= ") - + self.logger.info("START> ======================================= ") + if self.authentication_type is None or self.authentication_type == "": authenticationsdk.util.ExceptionAuth.validate_merchant_details_log(self.logger, GlobalLabelParameters.AUTHENTICATION_REQ, @@ -452,15 +513,31 @@ def validate_merchant_details(self, details, mconfig = None): log_items = GlobalLabelParameters.HIDE_MERCHANT_CONFIG_PROPS # This displays the logic for logging all cybs.json values details_copy = copy.deepcopy(details) - if self.log_config.enable_log is True: - for key, value in list(details_copy.items()): - if key in log_items: - del details_copy[key] + for key, value in list(details_copy.items()): + if key in log_items: + del details_copy[key] + + for keys, values in list(details_copy.items()): + details_copy[keys] = str(values) + + self.logger.info("Mconfig > " + str(ast.literal_eval(json.dumps(details_copy)))) + + import numbers + if not isinstance(self.max_num_idle_connections, numbers.Number): + self.max_num_idle_connections = GlobalLabelParameters.DEFAULT_MAX_IDLE_CONNECTIONS + self.logger.error(f"maxNumIdleConnections is not a number. Using Default Value : {GlobalLabelParameters.DEFAULT_MAX_IDLE_CONNECTIONS}") + + if not isinstance(self.max_pool_size, numbers.Number): + self.max_pool_size = GlobalLabelParameters.DEFAULT_MAX_POOL_SIZE + self.logger.error(f"maxPoolSize is not a number. Using Default Value : {GlobalLabelParameters.DEFAULT_MAX_POOL_SIZE}") - for keys, values in list(details_copy.items()): - details_copy[keys] = str(values) + if not isinstance(self.max_keep_alive_delay, numbers.Number): + self.max_keep_alive_delay = GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_DELAY + self.logger.error(f"maxKeepAliveDelay is not a number. Using Default Value : {GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_DELAY}") - self.logger.info("Mconfig > " + str(ast.literal_eval(json.dumps(details_copy)))) + if not isinstance(self.max_keep_alive_idle_window, numbers.Number): + self.max_keep_alive_idle_window = GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_IDLE_WINDOW + self.logger.error(f"maxKeepAliveIdleWindow is not a number. Using Default Value : {GlobalLabelParameters.DEFAULT_MAX_KEEP_ALIVE_IDLE_WINDOW}") def check_key_file(self): if not(self.key_file_name and self.key_file_name.strip()): diff --git a/authenticationsdk/util/ExceptionAuth.py b/authenticationsdk/util/ExceptionAuth.py index 73900db5..bdff5b6d 100644 --- a/authenticationsdk/util/ExceptionAuth.py +++ b/authenticationsdk/util/ExceptionAuth.py @@ -1,28 +1,18 @@ import sys - def log_exception(logger, message, log_config): - if log_config.enable_log is True: - print(message) - print("Error: Check Log file for more details.") - logger.exception(message) + print(message) + print("Error: Check Log file for more details.") + logger.exception(message) raise Exception(message) - - def validate_merchant_details_log(logger, message, log_config): - - if log_config.enable_log is True: - print(message) - print("Error: Check Log file for more details.") - logger.error(message) + print(message) + print("Error: Check Log file for more details.") + logger.error(message) raise Exception(message) - - - def validate_default_values(logger, message, log_config): - if log_config.enable_log is True: - print(message) - logger.warning(message) + print(message) + logger.warning(message) diff --git a/authenticationsdk/util/GlobalLabelParameters.py b/authenticationsdk/util/GlobalLabelParameters.py index fd80faac..df1f311e 100644 --- a/authenticationsdk/util/GlobalLabelParameters.py +++ b/authenticationsdk/util/GlobalLabelParameters.py @@ -99,3 +99,7 @@ class GlobalLabelParameters: MESSAGE_AFTER_MLE_REQUEST = "Request after MLE: " MLE_CACHE_IDENTIFIER_FOR_CONFIG_CERT = "mleCertFromMerchantConfig" MLE_CACHE_IDENTIFIER_FOR_P12_CERT = "mleCertFromP12" + DEFAULT_MAX_IDLE_CONNECTIONS = 100 + DEFAULT_MAX_POOL_SIZE = 10 + DEFAULT_MAX_KEEP_ALIVE_DELAY = 300 # in seconds + DEFAULT_MAX_KEEP_ALIVE_IDLE_WINDOW = 60 # in seconds diff --git a/generator/cybersource-python-template/api.mustache b/generator/cybersource-python-template/api.mustache index 07ca200d..079cc806 100644 --- a/generator/cybersource-python-template/api.mustache +++ b/generator/cybersource-python-template/api.mustache @@ -29,13 +29,10 @@ class {{classname}}(object): """ def __init__(self, merchant_config, api_client=None): - config = Configuration() if api_client: self.api_client = api_client else: - if not config.api_client: - config.api_client = ApiClient() - self.api_client = config.api_client + self.api_client = ApiClient() self.api_client.set_configuration(merchant_config) self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) @@ -78,8 +75,7 @@ class {{classname}}(object): {{/vendorExtensions.x-devcenter-metaData.SDK_ONLY_AddDisclaimer}} """ - if self.api_client.mconfig.log_config.enable_log: - self.logger.info("CALL TO METHOD `{{operationId}}` STARTED") + self.logger.info("CALL TO METHOD `{{operationId}}` STARTED") kwargs['_return_http_data_only'] = True if kwargs.get('callback'): @@ -138,8 +134,7 @@ class {{classname}}(object): {{#required}} # verify the required parameter '{{paramName}}' is set if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None): - if self.api_client.mconfig.log_config.enable_log: - self.logger.error("InvalidArgumentException : Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") + self.logger.error("InvalidArgumentException : Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") {{/required}} {{/allParams}} diff --git a/generator/cybersource-python-template/api_client.mustache b/generator/cybersource-python-template/api_client.mustache index 0dab8c36..315491da 100644 --- a/generator/cybersource-python-template/api_client.mustache +++ b/generator/cybersource-python-template/api_client.mustache @@ -63,7 +63,6 @@ class ApiClient(object): """ Constructor of the class. """ - self.rest_client = RESTClientObject() self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value @@ -140,17 +139,8 @@ class ApiClient(object): def set_configuration(self,config): self.mconfig = MerchantConfiguration() self.mconfig.set_merchantconfig(config) - rconfig = Configuration() - # To reinitialize with logging config - self.rest_client = RESTClientObject(log_config=self.mconfig.log_config) - - set_client_cert = rconfig.set_merchantclientcert(config) - set_proxy = rconfig.set_merchantproxyconfig(config) - - # The below two lines are to set proxy details, client cert details and if present reinitialize the REST object as a proxy manager - if set_client_cert or set_proxy: - self.rest_client = RESTClientObject(rconfig, log_config=self.mconfig.log_config) # Reinitialising REST object as a proxy manager instead of pool manager + self.rest_client = RESTClientObject(mconfig=self.mconfig) # This implements the fall back logic for JWT parameters key alias,key password,json file path self.mconfig.validate_merchant_details(config) @@ -451,7 +441,7 @@ class ApiClient(object): post_params = body query_param_path = self.set_query_params(resource_path, query_params) - request_target = query_param_path if query_param_path else resource_pat + request_target = query_param_path if query_param_path else resource_path if self.mconfig.authentication_type.upper() != GlobalLabelParameters.MUTUAL_AUTH.upper(): self.call_authentication_header(method, header_params, body, request_target) diff --git a/generator/cybersource-python-template/rest.mustache b/generator/cybersource-python-template/rest.mustache index ba5bc882..249d01fa 100644 --- a/generator/cybersource-python-template/rest.mustache +++ b/generator/cybersource-python-template/rest.mustache @@ -10,6 +10,7 @@ import ssl import certifi import CyberSource.logging.log_factory as LogFactory import re +import hashlib # python 2 and python 3 compatibility library from six import PY3 @@ -26,7 +27,6 @@ except ImportError: class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -47,8 +47,50 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): - - def __init__(self, rconfig = None, pools_size=4, maxsize=4, log_config = None): + _urllib3_poolmanagers = {} + + @classmethod + def get_pool_manager(cls, hash_candidates_dict): + sorted_items = sorted(hash_candidates_dict.items()) + json_string = json.dumps(sorted_items, separators=(',', ':')).encode('utf-8') + hash_object = hashlib.sha256() + hash_object.update(json_string) + hashed_key = hash_object.hexdigest() + + if hashed_key not in cls._urllib3_poolmanagers: + my_pool_manager = None + if 'proxy' in hash_candidates_dict: + my_pool_manager = urllib3.ProxyManager( + num_pools=hash_candidates_dict['pools_size'], + maxsize=hash_candidates_dict['maxsize'], + cert_reqs=hash_candidates_dict['cert_reqs'], + ca_certs=hash_candidates_dict['ca_certs'], + cert_file=hash_candidates_dict['cert_file'], + key_file=hash_candidates_dict['key_file'], + key_password=hash_candidates_dict['key_password'], + proxy_url=hash_candidates_dict['proxy'], + proxy_headers=hash_candidates_dict['proxy_auth_headers'], + keepalive_delay=hash_candidates_dict['keepalive_delay'], + keepalive_idle_window=hash_candidates_dict['keepalive_idle_window'] + ) + else: + my_pool_manager = urllib3.PoolManager( + num_pools=hash_candidates_dict['pools_size'], + maxsize=hash_candidates_dict['maxsize'], + cert_reqs=hash_candidates_dict['cert_reqs'], + ca_certs=hash_candidates_dict['ca_certs'], + cert_file=hash_candidates_dict['cert_file'], + key_file=hash_candidates_dict['key_file'], + key_password=hash_candidates_dict['key_password'], + keepalive_delay=hash_candidates_dict['keepalive_delay'], + keepalive_idle_window=hash_candidates_dict['keepalive_idle_window'] + ) + + cls._urllib3_poolmanagers[hashed_key] = my_pool_manager + + return cls._urllib3_poolmanagers[hashed_key] + + def __init__(self, mconfig = None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 @@ -56,73 +98,78 @@ class RESTClientObject(object): # ca_certs vs cert_file vs key_file # http://stackoverflow.com/a/23957365/2985775 + if mconfig is None: + raise ValueError("Merchant Configuration cannot be None") + + log_config = mconfig.log_config + self.logger = LogFactory.setup_logger(self.__class__.__name__, log_config) if log_config is not None: self.enable_log = log_config.enable_log else: self.enable_log = False - if rconfig is None: - rconfig = Configuration() - # cert_reqs - if rconfig.verify_ssl: + if mconfig.ssl_verify: cert_reqs = ssl.CERT_REQUIRED else: cert_reqs = ssl.CERT_NONE # ca_certs - if rconfig.ssl_ca_cert: - ca_certs = rconfig.ssl_ca_cert - else: - # if not set certificate file, use Mozilla's root certificates. - ca_certs = certifi.where() - - # cert_file - cert_file = rconfig.cert_file - - # key file - key_file = rconfig.key_file - - # key pass - key_password = rconfig.key_password + ca_certs = certifi.where() + + cert_file = None + key_file = None + key_password = None + + if mconfig.enable_client_cert: + import os + # cert_file + cert_file = os.path.join(mconfig.client_cert_dir, mconfig.ssl_client_cert) + + # key file + key_file = os.path.join(mconfig.client_cert_dir, mconfig.private_key) + + # key pass + key_password = mconfig.ssl_key_password + + pools_size = mconfig.get_MaxPoolSize() + maxsize = mconfig.get_MaxNumIdleConnections() + keepalive_delay = mconfig.get_MaxKeepAliveDelay() + keepalive_idle_window = mconfig.get_MaxKeepAliveIdleWindow() + + hash_candidates = {} + hash_candidates['cert_reqs'] = cert_reqs + hash_candidates['ca_certs'] = ca_certs + hash_candidates['cert_file'] = cert_file + hash_candidates['key_file'] = key_file + hash_candidates['key_password'] = key_password + hash_candidates['pools_size'] = pools_size + hash_candidates['maxsize'] = maxsize + hash_candidates['keepalive_delay'] = keepalive_delay + hash_candidates['keepalive_idle_window'] = keepalive_idle_window # proxy - proxy = rconfig.proxy + proxy_host = mconfig.proxy_address # https pool manager - if proxy: + if mconfig.use_proxy and not (proxy_host is None or proxy_host == ''): # proxy auth headers - proxy_username = rconfig.proxy_username - proxy_password = rconfig.proxy_password + proxy_host = proxy_host.replace("https://", "").replace("http://", "") + proxy_port = mconfig.proxy_port + proxy_username = mconfig.proxy_username + proxy_password = mconfig.proxy_password proxy_auth_headers = None - + proxy = 'http://' + proxy_host + ':' + proxy_port + + hash_candidates['proxy'] = proxy + if (proxy_username and proxy_password): proxy_auth_headers = make_headers(proxy_basic_auth=proxy_username + ':' + proxy_password) + hash_candidates['proxy_auth_headers'] = proxy_auth_headers - self.pool_manager = urllib3.ProxyManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=cert_file, - key_file=key_file, - key_password=key_password, - proxy_url=proxy, - proxy_headers=proxy_auth_headers - ) - else: - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=cert_file, - key_file=key_file, - key_password=key_password - ) - + self.pool_manager = self.__class__.get_pool_manager(hash_candidates) def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None): diff --git a/setup.py b/setup.py index 14b2bffb..e70e4a26 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ "DateTime", "setuptools", "six", - "urllib3", + "urllib3-future", "jwcrypto", "cryptography", "pgpy"