|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + CyberSource Merged Spec |
| 5 | +
|
| 6 | + All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html |
| 7 | +
|
| 8 | + OpenAPI spec version: 0.0.1 |
| 9 | + |
| 10 | + Generated by: https://github.com/swagger-api/swagger-codegen.git |
| 11 | +""" |
| 12 | + |
| 13 | + |
| 14 | +from __future__ import absolute_import |
| 15 | + |
| 16 | +import sys |
| 17 | +import os |
| 18 | +import re |
| 19 | + |
| 20 | +# python 2 and python 3 compatibility library |
| 21 | +from six import iteritems |
| 22 | + |
| 23 | +from ..configuration import Configuration |
| 24 | +from ..api_client import ApiClient |
| 25 | +import CyberSource.logging.log_factory as LogFactory |
| 26 | + |
| 27 | + |
| 28 | +class PushFundsApi(object): |
| 29 | + """ |
| 30 | + NOTE: This class is auto generated by the swagger code generator program. |
| 31 | + Do not edit the class manually. |
| 32 | + Ref: https://github.com/swagger-api/swagger-codegen |
| 33 | + """ |
| 34 | + |
| 35 | + def __init__(self, merchant_config, api_client=None): |
| 36 | + config = Configuration() |
| 37 | + if api_client: |
| 38 | + self.api_client = api_client |
| 39 | + else: |
| 40 | + if not config.api_client: |
| 41 | + config.api_client = ApiClient() |
| 42 | + self.api_client = config.api_client |
| 43 | + self.api_client.set_configuration(merchant_config) |
| 44 | + self.logger = LogFactory.setup_logger(self.__class__.__name__, self.api_client.mconfig.log_config) |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + def create_push_funds_transfer(self, push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, **kwargs): |
| 49 | + """ |
| 50 | + Process a Push Funds Transfer |
| 51 | + Receive funds using an Original Credit Transaction (OCT). |
| 52 | + This method makes a synchronous HTTP request by default. To make an |
| 53 | + asynchronous HTTP request, please define a `callback` function |
| 54 | + to be invoked when receiving the response. |
| 55 | + >>> def callback_function(response): |
| 56 | + >>> pprint(response) |
| 57 | + >>> |
| 58 | + >>> thread = api.create_push_funds_transfer(push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, callback=callback_function) |
| 59 | +
|
| 60 | + :param callback function: The callback function |
| 61 | + for asynchronous request. (optional) |
| 62 | + :param PushFundsRequest push_funds_request: (required) |
| 63 | + :param str content_type: (required) |
| 64 | + :param str x_requestid: (required) |
| 65 | + :param str v_c_merchant_id: (required) |
| 66 | + :param str v_c_permissions: (required) |
| 67 | + :param str v_c_correlation_id: (required) |
| 68 | + :param str v_c_organization_id: (required) |
| 69 | + :return: PushFunds201Response |
| 70 | + If the method is called asynchronously, |
| 71 | + returns the request thread. |
| 72 | + """ |
| 73 | + |
| 74 | + if self.api_client.mconfig.log_config.enable_log: |
| 75 | + self.logger.info("CALL TO METHOD `create_push_funds_transfer` STARTED") |
| 76 | + |
| 77 | + kwargs['_return_http_data_only'] = True |
| 78 | + if kwargs.get('callback'): |
| 79 | + return self.create_push_funds_transfer_with_http_info(push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, **kwargs) |
| 80 | + else: |
| 81 | + (data) = self.create_push_funds_transfer_with_http_info(push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, **kwargs) |
| 82 | + return data |
| 83 | + |
| 84 | + def create_push_funds_transfer_with_http_info(self, push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, **kwargs): |
| 85 | + """ |
| 86 | + Process a Push Funds Transfer |
| 87 | + Receive funds using an Original Credit Transaction (OCT). |
| 88 | + This method makes a synchronous HTTP request by default. To make an |
| 89 | + asynchronous HTTP request, please define a `callback` function |
| 90 | + to be invoked when receiving the response. |
| 91 | + >>> def callback_function(response): |
| 92 | + >>> pprint(response) |
| 93 | + >>> |
| 94 | + >>> thread = api.create_push_funds_transfer_with_http_info(push_funds_request, content_type, x_requestid, v_c_merchant_id, v_c_permissions, v_c_correlation_id, v_c_organization_id, callback=callback_function) |
| 95 | +
|
| 96 | + :param callback function: The callback function |
| 97 | + for asynchronous request. (optional) |
| 98 | + :param PushFundsRequest push_funds_request: (required) |
| 99 | + :param str content_type: (required) |
| 100 | + :param str x_requestid: (required) |
| 101 | + :param str v_c_merchant_id: (required) |
| 102 | + :param str v_c_permissions: (required) |
| 103 | + :param str v_c_correlation_id: (required) |
| 104 | + :param str v_c_organization_id: (required) |
| 105 | + :return: PushFunds201Response |
| 106 | + If the method is called asynchronously, |
| 107 | + returns the request thread. |
| 108 | + """ |
| 109 | + |
| 110 | + all_params = ['push_funds_request', 'content_type', 'x_requestid', 'v_c_merchant_id', 'v_c_permissions', 'v_c_correlation_id', 'v_c_organization_id'] |
| 111 | + all_params.append('callback') |
| 112 | + all_params.append('_return_http_data_only') |
| 113 | + all_params.append('_preload_content') |
| 114 | + all_params.append('_request_timeout') |
| 115 | + |
| 116 | + params = locals() |
| 117 | + for key, val in iteritems(params['kwargs']): |
| 118 | + if key not in all_params: |
| 119 | + raise TypeError( |
| 120 | + "Got an unexpected keyword argument '%s'" |
| 121 | + " to method create_push_funds_transfer" % key |
| 122 | + ) |
| 123 | + params[key] = val |
| 124 | + del params['kwargs'] |
| 125 | + # verify the required parameter 'push_funds_request' is set |
| 126 | + if ('push_funds_request' not in params) or (params['push_funds_request'] is None): |
| 127 | + if self.api_client.mconfig.log_config.enable_log: |
| 128 | + self.logger.error("InvalidArgumentException : Missing the required parameter `push_funds_request` when calling `create_push_funds_transfer`") |
| 129 | + raise ValueError("Missing the required parameter `push_funds_request` when calling `create_push_funds_transfer`") |
| 130 | + # verify the required parameter 'content_type' is set |
| 131 | + if ('content_type' not in params) or (params['content_type'] is None): |
| 132 | + if self.api_client.mconfig.log_config.enable_log: |
| 133 | + self.logger.error("InvalidArgumentException : Missing the required parameter `content_type` when calling `create_push_funds_transfer`") |
| 134 | + raise ValueError("Missing the required parameter `content_type` when calling `create_push_funds_transfer`") |
| 135 | + # verify the required parameter 'x_requestid' is set |
| 136 | + if ('x_requestid' not in params) or (params['x_requestid'] is None): |
| 137 | + if self.api_client.mconfig.log_config.enable_log: |
| 138 | + self.logger.error("InvalidArgumentException : Missing the required parameter `x_requestid` when calling `create_push_funds_transfer`") |
| 139 | + raise ValueError("Missing the required parameter `x_requestid` when calling `create_push_funds_transfer`") |
| 140 | + # verify the required parameter 'v_c_merchant_id' is set |
| 141 | + if ('v_c_merchant_id' not in params) or (params['v_c_merchant_id'] is None): |
| 142 | + if self.api_client.mconfig.log_config.enable_log: |
| 143 | + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_merchant_id` when calling `create_push_funds_transfer`") |
| 144 | + raise ValueError("Missing the required parameter `v_c_merchant_id` when calling `create_push_funds_transfer`") |
| 145 | + # verify the required parameter 'v_c_permissions' is set |
| 146 | + if ('v_c_permissions' not in params) or (params['v_c_permissions'] is None): |
| 147 | + if self.api_client.mconfig.log_config.enable_log: |
| 148 | + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_permissions` when calling `create_push_funds_transfer`") |
| 149 | + raise ValueError("Missing the required parameter `v_c_permissions` when calling `create_push_funds_transfer`") |
| 150 | + # verify the required parameter 'v_c_correlation_id' is set |
| 151 | + if ('v_c_correlation_id' not in params) or (params['v_c_correlation_id'] is None): |
| 152 | + if self.api_client.mconfig.log_config.enable_log: |
| 153 | + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_correlation_id` when calling `create_push_funds_transfer`") |
| 154 | + raise ValueError("Missing the required parameter `v_c_correlation_id` when calling `create_push_funds_transfer`") |
| 155 | + # verify the required parameter 'v_c_organization_id' is set |
| 156 | + if ('v_c_organization_id' not in params) or (params['v_c_organization_id'] is None): |
| 157 | + if self.api_client.mconfig.log_config.enable_log: |
| 158 | + self.logger.error("InvalidArgumentException : Missing the required parameter `v_c_organization_id` when calling `create_push_funds_transfer`") |
| 159 | + raise ValueError("Missing the required parameter `v_c_organization_id` when calling `create_push_funds_transfer`") |
| 160 | + |
| 161 | + |
| 162 | + collection_formats = {} |
| 163 | + |
| 164 | + path_params = {} |
| 165 | + |
| 166 | + query_params = [] |
| 167 | + |
| 168 | + header_params = {} |
| 169 | + if 'content_type' in params: |
| 170 | + header_params['Content-Type'] = params['content_type'] |
| 171 | + if 'x_requestid' in params: |
| 172 | + header_params['x-requestid'] = params['x_requestid'] |
| 173 | + if 'v_c_merchant_id' in params: |
| 174 | + header_params['v-c-merchant-id'] = params['v_c_merchant_id'] |
| 175 | + if 'v_c_permissions' in params: |
| 176 | + header_params['v-c-permissions'] = params['v_c_permissions'] |
| 177 | + if 'v_c_correlation_id' in params: |
| 178 | + header_params['v-c-correlation-id'] = params['v_c_correlation_id'] |
| 179 | + if 'v_c_organization_id' in params: |
| 180 | + header_params['v-c-organization-id'] = params['v_c_organization_id'] |
| 181 | + |
| 182 | + form_params = [] |
| 183 | + local_var_files = {} |
| 184 | + |
| 185 | + body_params = None |
| 186 | + if 'push_funds_request' in params: |
| 187 | + body_params = params['push_funds_request'] |
| 188 | + # HTTP header `Accept` |
| 189 | + header_params['Accept'] = self.api_client.\ |
| 190 | + select_header_accept(['application/hal+json;charset=utf-8']) |
| 191 | + |
| 192 | + # HTTP header `Content-Type` |
| 193 | + header_params['Content-Type'] = self.api_client.\ |
| 194 | + select_header_content_type(['application/json;charset=utf-8']) |
| 195 | + |
| 196 | + # Authentication setting |
| 197 | + auth_settings = [] |
| 198 | + |
| 199 | + return self.api_client.call_api(f'/pts/v1/push-funds-transfer', 'POST', |
| 200 | + path_params, |
| 201 | + query_params, |
| 202 | + header_params, |
| 203 | + body=body_params, |
| 204 | + post_params=form_params, |
| 205 | + files=local_var_files, |
| 206 | + response_type='PushFunds201Response', |
| 207 | + auth_settings=auth_settings, |
| 208 | + callback=params.get('callback'), |
| 209 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 210 | + _preload_content=params.get('_preload_content', True), |
| 211 | + _request_timeout=params.get('_request_timeout'), |
| 212 | + collection_formats=collection_formats) |
0 commit comments