|
| 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 EMVTagDetailsApi(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 get_emv_tags(self, **kwargs): |
| 49 | + """ |
| 50 | + Retrieve the EMV Dictionary |
| 51 | + Returns the entire EMV tag dictionary |
| 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.get_emv_tags(callback=callback_function) |
| 59 | +
|
| 60 | + :param callback function: The callback function |
| 61 | + for asynchronous request. (optional) |
| 62 | + :return: TssV2GetEmvTags200Response |
| 63 | + If the method is called asynchronously, |
| 64 | + returns the request thread. |
| 65 | + """ |
| 66 | + |
| 67 | + if self.api_client.mconfig.log_config.enable_log: |
| 68 | + self.logger.info("CALL TO METHOD `get_emv_tags` STARTED") |
| 69 | + |
| 70 | + kwargs['_return_http_data_only'] = True |
| 71 | + if kwargs.get('callback'): |
| 72 | + return self.get_emv_tags_with_http_info(**kwargs) |
| 73 | + else: |
| 74 | + (data) = self.get_emv_tags_with_http_info(**kwargs) |
| 75 | + return data |
| 76 | + |
| 77 | + def get_emv_tags_with_http_info(self, **kwargs): |
| 78 | + """ |
| 79 | + Retrieve the EMV Dictionary |
| 80 | + Returns the entire EMV tag dictionary |
| 81 | + This method makes a synchronous HTTP request by default. To make an |
| 82 | + asynchronous HTTP request, please define a `callback` function |
| 83 | + to be invoked when receiving the response. |
| 84 | + >>> def callback_function(response): |
| 85 | + >>> pprint(response) |
| 86 | + >>> |
| 87 | + >>> thread = api.get_emv_tags_with_http_info(callback=callback_function) |
| 88 | +
|
| 89 | + :param callback function: The callback function |
| 90 | + for asynchronous request. (optional) |
| 91 | + :return: TssV2GetEmvTags200Response |
| 92 | + If the method is called asynchronously, |
| 93 | + returns the request thread. |
| 94 | + """ |
| 95 | + |
| 96 | + all_params = [] |
| 97 | + all_params.append('callback') |
| 98 | + all_params.append('_return_http_data_only') |
| 99 | + all_params.append('_preload_content') |
| 100 | + all_params.append('_request_timeout') |
| 101 | + |
| 102 | + params = locals() |
| 103 | + for key, val in iteritems(params['kwargs']): |
| 104 | + if key not in all_params: |
| 105 | + raise TypeError( |
| 106 | + "Got an unexpected keyword argument '%s'" |
| 107 | + " to method get_emv_tags" % key |
| 108 | + ) |
| 109 | + params[key] = val |
| 110 | + del params['kwargs'] |
| 111 | + |
| 112 | + collection_formats = {} |
| 113 | + |
| 114 | + path_params = {} |
| 115 | + |
| 116 | + query_params = [] |
| 117 | + |
| 118 | + header_params = {} |
| 119 | + |
| 120 | + form_params = [] |
| 121 | + local_var_files = {} |
| 122 | + |
| 123 | + body_params = None |
| 124 | + if 'GET' in ('POST'): |
| 125 | + body_params = '{}' |
| 126 | + # HTTP header `Accept` |
| 127 | + header_params['Accept'] = self.api_client.\ |
| 128 | + select_header_accept(['application/json;charset=utf-8']) |
| 129 | + |
| 130 | + # HTTP header `Content-Type` |
| 131 | + header_params['Content-Type'] = self.api_client.\ |
| 132 | + select_header_content_type(['application/json;charset=utf-8']) |
| 133 | + |
| 134 | + # Authentication setting |
| 135 | + auth_settings = [] |
| 136 | + |
| 137 | + return self.api_client.call_api(f'/tss/v2/transactions/emvTagDetails', 'GET', |
| 138 | + path_params, |
| 139 | + query_params, |
| 140 | + header_params, |
| 141 | + body=body_params, |
| 142 | + post_params=form_params, |
| 143 | + files=local_var_files, |
| 144 | + response_type='TssV2GetEmvTags200Response', |
| 145 | + auth_settings=auth_settings, |
| 146 | + callback=params.get('callback'), |
| 147 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 148 | + _preload_content=params.get('_preload_content', True), |
| 149 | + _request_timeout=params.get('_request_timeout'), |
| 150 | + collection_formats=collection_formats) |
| 151 | + |
| 152 | + def parse_emv_tags(self, body, **kwargs): |
| 153 | + """ |
| 154 | + Parse an EMV String |
| 155 | + Pass an EMV Tag-Length-Value (TLV) string for parsing. |
| 156 | + This method makes a synchronous HTTP request by default. To make an |
| 157 | + asynchronous HTTP request, please define a `callback` function |
| 158 | + to be invoked when receiving the response. |
| 159 | + >>> def callback_function(response): |
| 160 | + >>> pprint(response) |
| 161 | + >>> |
| 162 | + >>> thread = api.parse_emv_tags(body, callback=callback_function) |
| 163 | +
|
| 164 | + :param callback function: The callback function |
| 165 | + for asynchronous request. (optional) |
| 166 | + :param Body body: (required) |
| 167 | + :return: TssV2PostEmvTags200Response |
| 168 | + If the method is called asynchronously, |
| 169 | + returns the request thread. |
| 170 | + """ |
| 171 | + |
| 172 | + if self.api_client.mconfig.log_config.enable_log: |
| 173 | + self.logger.info("CALL TO METHOD `parse_emv_tags` STARTED") |
| 174 | + |
| 175 | + kwargs['_return_http_data_only'] = True |
| 176 | + if kwargs.get('callback'): |
| 177 | + return self.parse_emv_tags_with_http_info(body, **kwargs) |
| 178 | + else: |
| 179 | + (data) = self.parse_emv_tags_with_http_info(body, **kwargs) |
| 180 | + return data |
| 181 | + |
| 182 | + def parse_emv_tags_with_http_info(self, body, **kwargs): |
| 183 | + """ |
| 184 | + Parse an EMV String |
| 185 | + Pass an EMV Tag-Length-Value (TLV) string for parsing. |
| 186 | + This method makes a synchronous HTTP request by default. To make an |
| 187 | + asynchronous HTTP request, please define a `callback` function |
| 188 | + to be invoked when receiving the response. |
| 189 | + >>> def callback_function(response): |
| 190 | + >>> pprint(response) |
| 191 | + >>> |
| 192 | + >>> thread = api.parse_emv_tags_with_http_info(body, callback=callback_function) |
| 193 | +
|
| 194 | + :param callback function: The callback function |
| 195 | + for asynchronous request. (optional) |
| 196 | + :param Body body: (required) |
| 197 | + :return: TssV2PostEmvTags200Response |
| 198 | + If the method is called asynchronously, |
| 199 | + returns the request thread. |
| 200 | + """ |
| 201 | + |
| 202 | + all_params = ['body'] |
| 203 | + all_params.append('callback') |
| 204 | + all_params.append('_return_http_data_only') |
| 205 | + all_params.append('_preload_content') |
| 206 | + all_params.append('_request_timeout') |
| 207 | + |
| 208 | + params = locals() |
| 209 | + for key, val in iteritems(params['kwargs']): |
| 210 | + if key not in all_params: |
| 211 | + raise TypeError( |
| 212 | + "Got an unexpected keyword argument '%s'" |
| 213 | + " to method parse_emv_tags" % key |
| 214 | + ) |
| 215 | + params[key] = val |
| 216 | + del params['kwargs'] |
| 217 | + # verify the required parameter 'body' is set |
| 218 | + if ('body' not in params) or (params['body'] is None): |
| 219 | + if self.api_client.mconfig.log_config.enable_log: |
| 220 | + self.logger.error("InvalidArgumentException : Missing the required parameter `body` when calling `parse_emv_tags`") |
| 221 | + raise ValueError("Missing the required parameter `body` when calling `parse_emv_tags`") |
| 222 | + |
| 223 | + |
| 224 | + collection_formats = {} |
| 225 | + |
| 226 | + path_params = {} |
| 227 | + |
| 228 | + query_params = [] |
| 229 | + |
| 230 | + header_params = {} |
| 231 | + |
| 232 | + form_params = [] |
| 233 | + local_var_files = {} |
| 234 | + |
| 235 | + body_params = None |
| 236 | + if 'body' in params: |
| 237 | + body_params = params['body'] |
| 238 | + # HTTP header `Accept` |
| 239 | + header_params['Accept'] = self.api_client.\ |
| 240 | + select_header_accept(['application/hal+json;charset=utf-8']) |
| 241 | + |
| 242 | + # HTTP header `Content-Type` |
| 243 | + header_params['Content-Type'] = self.api_client.\ |
| 244 | + select_header_content_type(['application/json;charset=utf-8']) |
| 245 | + |
| 246 | + # Authentication setting |
| 247 | + auth_settings = [] |
| 248 | + |
| 249 | + return self.api_client.call_api(f'/tss/v2/transactions/emvTagDetails', 'POST', |
| 250 | + path_params, |
| 251 | + query_params, |
| 252 | + header_params, |
| 253 | + body=body_params, |
| 254 | + post_params=form_params, |
| 255 | + files=local_var_files, |
| 256 | + response_type='TssV2PostEmvTags200Response', |
| 257 | + auth_settings=auth_settings, |
| 258 | + callback=params.get('callback'), |
| 259 | + _return_http_data_only=params.get('_return_http_data_only'), |
| 260 | + _preload_content=params.get('_preload_content', True), |
| 261 | + _request_timeout=params.get('_request_timeout'), |
| 262 | + collection_formats=collection_formats) |
0 commit comments