Skip to content

Commit b1c864b

Browse files
authored
Merge pull request #18 from CyberSource/mar2019rel
New version of SDK
2 parents 8c824cd + 067adac commit b1c864b

File tree

476 files changed

+28694
-5064
lines changed

Some content is hidden

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

476 files changed

+28694
-5064
lines changed

CyberSource/__init__.py

+68-7
Large diffs are not rendered by default.

CyberSource/api_client.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from authenticationsdk.util.GlobalLabelParameters import *
3434
from six.moves.urllib.parse import urlencode
3535

36+
3637
class ApiClient(object):
3738
"""
3839
Generic API client for Swagger client library builds.
@@ -72,7 +73,6 @@ def __init__(self, host=None, header_name=None, header_value=None, cookie=None):
7273
if header_name is not None:
7374
self.default_headers[header_name] = header_value
7475
if host is None:
75-
7676
self.host = Configuration().host
7777
else:
7878
self.host = host
@@ -134,10 +134,14 @@ def set_configuration(self,config):
134134
self.host = mconfig.request_host
135135

136136
# Calling the authentication header
137-
def call_authentication_header(self,method, header_params, body):
138-
137+
def call_authentication_header(self, method, header_params, body):
138+
139139
time = mconfig.get_time()
140+
140141
mconfig.request_type_method = method
142+
143+
144+
141145
if method.upper() == GlobalLabelParameters.POST or method.upper() == GlobalLabelParameters.PUT or method.upper() == GlobalLabelParameters.PATCH:
142146
mconfig.request_json_path_data = body
143147

@@ -152,7 +156,7 @@ def call_authentication_header(self,method, header_params, body):
152156
header_params["Host"] = mconfig.request_host
153157
header_params["User-Agent"] = GlobalLabelParameters.USER_AGENT_VALUE
154158
if method.upper() == GlobalLabelParameters.POST or method.upper() == GlobalLabelParameters.PUT or method.upper() == GlobalLabelParameters.PATCH:
155-
'''print((ast.literal_eval(json.dumps(self.del_none(json.loads(body))))))'''
159+
156160
digest_header = self.set_digest((body))
157161

158162
header_params[
@@ -163,6 +167,7 @@ def call_authentication_header(self,method, header_params, body):
163167

164168
token = "Bearer " + token.decode("utf-8")
165169
header_params['Authorization'] = str(token)
170+
166171

167172
# Set the digest
168173
def set_digest(self, body):
@@ -172,13 +177,19 @@ def set_digest(self, body):
172177

173178

174179
return encoded_digest
175-
180+
181+
176182
# Adds query param to URL
177183
def set_query_params(self, path, query_param):
178184
if query_param:
179185
path += '?' + urlencode(query_param)
180186

181187
return path
188+
189+
190+
191+
192+
182193

183194
def __call_api(self, resource_path, method,
184195
path_params=None, query_params=None, header_params=None,
@@ -231,7 +242,7 @@ def __call_api(self, resource_path, method,
231242

232243
# request url
233244
url = GlobalLabelParameters.HTTP_URL_PREFIX+self.host + resource_path
234-
245+
235246

236247
# perform request and return response
237248
response_data = self.request(method, url,

CyberSource/apis/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
# import apis into api package
44
from .capture_api import CaptureApi
5+
from .conversion_details_api import ConversionDetailsApi
56
from .credit_api import CreditApi
67
from .flex_token_api import FlexTokenApi
78
from .instrument_identifier_api import InstrumentIdentifierApi
89
from .instrument_identifiers_api import InstrumentIdentifiersApi
910
from .key_generation_api import KeyGenerationApi
11+
from .net_fundings_api import NetFundingsApi
1012
from .notification_of_changes_api import NotificationOfChangesApi
1113
from .payment_instruments_api import PaymentInstrumentsApi
1214
from .payments_api import PaymentsApi
@@ -20,7 +22,6 @@
2022
from .reversal_api import ReversalApi
2123
from .search_transactions_api import SearchTransactionsApi
2224
from .secure_file_share_api import SecureFileShareApi
23-
from .transaction_batch_api import TransactionBatchApi
2425
from .transaction_batches_api import TransactionBatchesApi
2526
from .transaction_details_api import TransactionDetailsApi
2627
from .user_management_api import UserManagementApi

CyberSource/apis/capture_api.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, merchant_config, api_client=None):
3939
if not config.api_client:
4040
config.api_client = ApiClient()
4141
self.api_client = config.api_client
42-
self.api_client.set_configuration(merchant_config)
42+
self.api_client.set_configuration(merchant_config)
4343

4444

4545
def capture_payment(self, capture_payment_request, id, **kwargs):
@@ -130,12 +130,12 @@ def capture_payment_with_http_info(self, capture_payment_request, id, **kwargs):
130130
if 'capture_payment_request' in params:
131131
body_params = params['capture_payment_request']
132132
# HTTP header `Accept`
133-
header_params['Accept'] = self.api_client. \
133+
header_params['Accept'] = self.api_client.\
134134
select_header_accept(['application/hal+json;charset=utf-8'])
135135

136136
# HTTP header `Content-Type`
137-
header_params['Content-Type'] = self.api_client. \
138-
select_header_content_type(['application/json'])
137+
header_params['Content-Type'] = self.api_client.\
138+
select_header_content_type(['application/json;charset=utf-8'])
139139

140140
# Authentication setting
141141
auth_settings = []
+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# coding: utf-8
2+
3+
"""
4+
CyberSource Flex API
5+
6+
Simple PAN tokenization service
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+
26+
27+
class ConversionDetailsApi(object):
28+
"""
29+
NOTE: This class is auto generated by the swagger code generator program.
30+
Do not edit the class manually.
31+
Ref: https://github.com/swagger-api/swagger-codegen
32+
"""
33+
34+
def __init__(self, merchant_config, api_client=None):
35+
config = Configuration()
36+
if api_client:
37+
self.api_client = api_client
38+
else:
39+
if not config.api_client:
40+
config.api_client = ApiClient()
41+
self.api_client = config.api_client
42+
self.api_client.set_configuration(merchant_config)
43+
44+
45+
def get_conversion_detail(self, start_time, end_time, **kwargs):
46+
"""
47+
Get conversion detail transactions
48+
Get conversion detail of transactions for a merchant.
49+
This method makes a synchronous HTTP request by default. To make an
50+
asynchronous HTTP request, please define a `callback` function
51+
to be invoked when receiving the response.
52+
>>> def callback_function(response):
53+
>>> pprint(response)
54+
>>>
55+
>>> thread = api.get_conversion_detail(start_time, end_time, callback=callback_function)
56+
57+
:param callback function: The callback function
58+
for asynchronous request. (optional)
59+
:param datetime start_time: Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd'T'HH:mm:ssXXX (required)
60+
:param datetime end_time: Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd'T'HH:mm:ssXXX (required)
61+
:param str organization_id: Valid Cybersource Organization Id
62+
:return: ReportingV3ConversionDetailsGet200Response
63+
If the method is called asynchronously,
64+
returns the request thread.
65+
"""
66+
kwargs['_return_http_data_only'] = True
67+
if kwargs.get('callback'):
68+
return self.get_conversion_detail_with_http_info(start_time, end_time, **kwargs)
69+
else:
70+
(data) = self.get_conversion_detail_with_http_info(start_time, end_time, **kwargs)
71+
return data
72+
73+
def get_conversion_detail_with_http_info(self, start_time, end_time, **kwargs):
74+
"""
75+
Get conversion detail transactions
76+
Get conversion detail of transactions for a merchant.
77+
This method makes a synchronous HTTP request by default. To make an
78+
asynchronous HTTP request, please define a `callback` function
79+
to be invoked when receiving the response.
80+
>>> def callback_function(response):
81+
>>> pprint(response)
82+
>>>
83+
>>> thread = api.get_conversion_detail_with_http_info(start_time, end_time, callback=callback_function)
84+
85+
:param callback function: The callback function
86+
for asynchronous request. (optional)
87+
:param datetime start_time: Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd'T'HH:mm:ssXXX (required)
88+
:param datetime end_time: Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format. - https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 **Example date format:** - yyyy-MM-dd'T'HH:mm:ssXXX (required)
89+
:param str organization_id: Valid Cybersource Organization Id
90+
:return: ReportingV3ConversionDetailsGet200Response
91+
If the method is called asynchronously,
92+
returns the request thread.
93+
"""
94+
95+
all_params = ['start_time', 'end_time', 'organization_id']
96+
all_params.append('callback')
97+
all_params.append('_return_http_data_only')
98+
all_params.append('_preload_content')
99+
all_params.append('_request_timeout')
100+
101+
params = locals()
102+
for key, val in iteritems(params['kwargs']):
103+
if key not in all_params:
104+
raise TypeError(
105+
"Got an unexpected keyword argument '%s'"
106+
" to method get_conversion_detail" % key
107+
)
108+
params[key] = val
109+
del params['kwargs']
110+
# verify the required parameter 'start_time' is set
111+
if ('start_time' not in params) or (params['start_time'] is None):
112+
raise ValueError("Missing the required parameter `start_time` when calling `get_conversion_detail`")
113+
# verify the required parameter 'end_time' is set
114+
if ('end_time' not in params) or (params['end_time'] is None):
115+
raise ValueError("Missing the required parameter `end_time` when calling `get_conversion_detail`")
116+
117+
if 'organization_id' in params and len(params['organization_id']) > 32:
118+
raise ValueError("Invalid value for parameter `organization_id` when calling `get_conversion_detail`, length must be less than or equal to `32`")
119+
if 'organization_id' in params and len(params['organization_id']) < 1:
120+
raise ValueError("Invalid value for parameter `organization_id` when calling `get_conversion_detail`, length must be greater than or equal to `1`")
121+
if 'organization_id' in params and not re.search('[a-zA-Z0-9-_]+', params['organization_id']):
122+
raise ValueError("Invalid value for parameter `organization_id` when calling `get_conversion_detail`, must conform to the pattern `/[a-zA-Z0-9-_]+/`")
123+
124+
collection_formats = {}
125+
126+
path_params = {}
127+
128+
query_params = []
129+
if 'start_time' in params:
130+
query_params.append(('startTime', params['start_time']))
131+
if 'end_time' in params:
132+
query_params.append(('endTime', params['end_time']))
133+
if 'organization_id' in params:
134+
query_params.append(('organizationId', params['organization_id']))
135+
136+
header_params = {}
137+
138+
form_params = []
139+
local_var_files = {}
140+
141+
body_params = None
142+
# HTTP header `Accept`
143+
header_params['Accept'] = self.api_client.\
144+
select_header_accept(['application/hal+json'])
145+
146+
# HTTP header `Content-Type`
147+
header_params['Content-Type'] = self.api_client.\
148+
select_header_content_type(['application/json;charset=utf-8'])
149+
150+
# Authentication setting
151+
auth_settings = []
152+
153+
return self.api_client.call_api('/reporting/v3/conversion-details', 'GET',
154+
path_params,
155+
query_params,
156+
header_params,
157+
body=body_params,
158+
post_params=form_params,
159+
files=local_var_files,
160+
response_type='ReportingV3ConversionDetailsGet200Response',
161+
auth_settings=auth_settings,
162+
callback=params.get('callback'),
163+
_return_http_data_only=params.get('_return_http_data_only'),
164+
_preload_content=params.get('_preload_content', True),
165+
_request_timeout=params.get('_request_timeout'),
166+
collection_formats=collection_formats)

CyberSource/apis/credit_api.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, merchant_config, api_client=None):
3939
if not config.api_client:
4040
config.api_client = ApiClient()
4141
self.api_client = config.api_client
42-
self.api_client.set_configuration(merchant_config)
42+
self.api_client.set_configuration(merchant_config)
4343

4444

4545
def create_credit(self, create_credit_request, **kwargs):
@@ -123,12 +123,12 @@ def create_credit_with_http_info(self, create_credit_request, **kwargs):
123123
if 'create_credit_request' in params:
124124
body_params = params['create_credit_request']
125125
# HTTP header `Accept`
126-
header_params['Accept'] = self.api_client. \
126+
header_params['Accept'] = self.api_client.\
127127
select_header_accept(['application/hal+json;charset=utf-8'])
128128

129129
# HTTP header `Content-Type`
130-
header_params['Content-Type'] = self.api_client. \
131-
select_header_content_type(['application/json'])
130+
header_params['Content-Type'] = self.api_client.\
131+
select_header_content_type(['application/json;charset=utf-8'])
132132

133133
# Authentication setting
134134
auth_settings = []

CyberSource/apis/flex_token_api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __init__(self, merchant_config, api_client=None):
3939
if not config.api_client:
4040
config.api_client = ApiClient()
4141
self.api_client = config.api_client
42-
self.api_client.set_configuration(merchant_config)
42+
self.api_client.set_configuration(merchant_config)
4343

4444

4545
def tokenize(self, **kwargs):
@@ -125,7 +125,7 @@ def tokenize_with_http_info(self, **kwargs):
125125

126126
# HTTP header `Content-Type`
127127
header_params['Content-Type'] = self.api_client.\
128-
select_header_content_type(['application/json'])
128+
select_header_content_type(['application/json;charset=utf-8'])
129129

130130
# Authentication setting
131131
auth_settings = []

0 commit comments

Comments
 (0)