Skip to content

Commit b00aeeb

Browse files
authored
Merge pull request #94 from CyberSource/march-changes
March changes
2 parents fe83fb5 + a55f9fa commit b00aeeb

601 files changed

Lines changed: 43825 additions & 11697 deletions

File tree

Some content is hidden

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

CyberSource/__init__.py

Lines changed: 112 additions & 13 deletions
Large diffs are not rendered by default.

CyberSource/api_client.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ def set_configuration(self,config):
164164
# This implements the fall back logic for JWT parameters key alias,key password,json file path
165165
self.mconfig.validate_merchant_details(config)
166166
# Setting the Host by reading the Environment(SANDBOX/PRODUCTION) from Merchant Config
167-
self.host = self.mconfig.request_host
167+
if self.mconfig.IntermediateHost:
168+
self.host = self.mconfig.IntermediateHost
169+
else:
170+
self.host = self.mconfig.request_host
168171

169172
# Calling the authentication header
170173
def call_authentication_header(self, method, header_params, body):
@@ -283,12 +286,30 @@ def __call_api(self, resource_path, method,
283286
body = self.sanitize_for_serialization(body)
284287

285288
# request url
286-
url = GlobalLabelParameters.HTTP_URL_PREFIX+self.host + resource_path
289+
if self.host.startswith("https://") or self.host.startswith("http://"):
290+
url = self.host + resource_path
291+
else:
292+
url = GlobalLabelParameters.HTTP_URL_PREFIX+self.host + resource_path
287293

288294
if self.download_file_path is not None:
289295
_preload_content = False
290296
_request_timeout = 3000
291297

298+
# add client additional headers and override the previous one except signature header
299+
if(self.mconfig.default_headers):
300+
signVal=None
301+
authVal=None
302+
if "Signature" in header_params:
303+
signVal= header_params['Signature']
304+
if "Authorization" in header_params:
305+
authVal= header_params['Authorization']
306+
307+
header_params.update(self.mconfig.default_headers)
308+
if(signVal is not None):
309+
header_params['Signature']=signVal
310+
if(authVal is not None):
311+
header_params['Authorization']=authVal
312+
292313
# perform request and return response
293314
response_data = self.request(method, url,
294315
query_params=query_params,

CyberSource/apis/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# import apis into api package
44
from .o_auth_api import OAuthApi
55
from .asymmetric_key_management_api import AsymmetricKeyManagementApi
6+
from .batches_api import BatchesApi
67
from .capture_api import CaptureApi
78
from .chargeback_details_api import ChargebackDetailsApi
89
from .chargeback_summaries_api import ChargebackSummariesApi
@@ -19,18 +20,19 @@
1920
from .interchange_clearing_level_details_api import InterchangeClearingLevelDetailsApi
2021
from .invoice_settings_api import InvoiceSettingsApi
2122
from .invoices_api import InvoicesApi
22-
from .key_generation_api import KeyGenerationApi
2323
from .keymanagement_api import KeymanagementApi
2424
from .keymanagementpassword_api import KeymanagementpasswordApi
2525
from .keymanagementpgp_api import KeymanagementpgpApi
2626
from .keymanagementscmp_api import KeymanagementscmpApi
27+
from .microform_integration_api import MicroformIntegrationApi
2728
from .net_fundings_api import NetFundingsApi
2829
from .notification_of_changes_api import NotificationOfChangesApi
2930
from .payer_authentication_api import PayerAuthenticationApi
3031
from .payment_batch_summaries_api import PaymentBatchSummariesApi
3132
from .payment_instrument_api import PaymentInstrumentApi
3233
from .payments_api import PaymentsApi
3334
from .payouts_api import PayoutsApi
35+
from .plans_api import PlansApi
3436
from .purchase_and_refund_details_api import PurchaseAndRefundDetailsApi
3537
from .push_funds_api import PushFundsApi
3638
from .refund_api import RefundApi
@@ -43,9 +45,10 @@
4345
from .reversal_api import ReversalApi
4446
from .search_transactions_api import SearchTransactionsApi
4547
from .secure_file_share_api import SecureFileShareApi
48+
from .subscriptions_api import SubscriptionsApi
4649
from .symmetric_key_management_api import SymmetricKeyManagementApi
4750
from .taxes_api import TaxesApi
48-
from .tokenization_api import TokenizationApi
51+
from .token_api import TokenApi
4952
from .transaction_batches_api import TransactionBatchesApi
5053
from .transaction_details_api import TransactionDetailsApi
5154
from .transient_token_data_api import TransientTokenDataApi

CyberSource/apis/batches_api.py

Lines changed: 535 additions & 0 deletions
Large diffs are not rendered by default.

CyberSource/apis/customer_api.py

Lines changed: 82 additions & 74 deletions
Large diffs are not rendered by default.

CyberSource/apis/customer_payment_instrument_api.py

Lines changed: 172 additions & 164 deletions
Large diffs are not rendered by default.

CyberSource/apis/customer_shipping_address_api.py

Lines changed: 172 additions & 164 deletions
Large diffs are not rendered by default.

CyberSource/apis/instrument_identifier_api.py

Lines changed: 138 additions & 126 deletions
Large diffs are not rendered by default.

CyberSource/apis/keymanagement_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def search_keys(self, **kwargs):
6767
:param list[str] key_types: Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
6868
:param datetime expiration_start_date: Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
6969
:param datetime expiration_end_date: Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
70-
:return: InlineResponse200
70+
:return: InlineResponse20011
7171
If the method is called asynchronously,
7272
returns the request thread.
7373
"""
@@ -104,7 +104,7 @@ def search_keys_with_http_info(self, **kwargs):
104104
:param list[str] key_types: Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
105105
:param datetime expiration_start_date: Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
106106
:param datetime expiration_end_date: Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
107-
:return: InlineResponse200
107+
:return: InlineResponse20011
108108
If the method is called asynchronously,
109109
returns the request thread.
110110
"""
@@ -185,7 +185,7 @@ def search_keys_with_http_info(self, **kwargs):
185185
body=body_params,
186186
post_params=form_params,
187187
files=local_var_files,
188-
response_type='InlineResponse200',
188+
response_type='InlineResponse20011',
189189
auth_settings=auth_settings,
190190
callback=params.get('callback'),
191191
_return_http_data_only=params.get('_return_http_data_only'),

CyberSource/apis/key_generation_api.py renamed to CyberSource/apis/microform_integration_api.py

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import CyberSource.logging.log_factory as LogFactory
2626

2727

28-
class KeyGenerationApi(object):
28+
class MicroformIntegrationApi(object):
2929
"""
3030
NOTE: This class is auto generated by the swagger code generator program.
3131
Do not edit the class manually.
@@ -45,59 +45,57 @@ def __init__(self, merchant_config, api_client=None):
4545

4646

4747

48-
def generate_public_key(self, format, generate_public_key_request, **kwargs):
48+
def generate_capture_context(self, generate_capture_context_request, **kwargs):
4949
"""
50-
Generate Key
51-
Generate a one-time use public key and key ID to encrypt the card number in the follow-on Tokenize Card request. The key used to encrypt the card number on the cardholder’s device or browser is valid for 15 minutes and must be used to verify the signature in the response message. CyberSource recommends creating a new key for each order. Generating a key is an authenticated request initiated from your servers, prior to requesting to tokenize the card data from your customer’s device or browser.
50+
Generate Capture Context
51+
This API is used to generate the Capture Context data structure for the Microform Integration. Microform is a browser-based acceptance solution that allows a seller to capture payment information is a secure manner from their website. For more information about Flex Microform transactions, see the [Flex Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-flex/SAFlexibleToken.html). For examples on how to integrate Flex Microform within your webpage please see our [GitHub Flex Samples](https://github.com/CyberSource?q=flex&type=&language=) This API is a server-to-server API to generate the capture context that can be used to initiate instance of microform on a acceptance page. The capture context is a digitally signed JWT that provides authentication, one-time keys, and the target origin to the Microform Integration application.
5252
This method makes a synchronous HTTP request by default. To make an
5353
asynchronous HTTP request, please define a `callback` function
5454
to be invoked when receiving the response.
5555
>>> def callback_function(response):
5656
>>> pprint(response)
5757
>>>
58-
>>> thread = api.generate_public_key(format, generate_public_key_request, callback=callback_function)
58+
>>> thread = api.generate_capture_context(generate_capture_context_request, callback=callback_function)
5959
6060
:param callback function: The callback function
6161
for asynchronous request. (optional)
62-
:param str format: Indicator to enable the receipt of the Keys response in Flex 11+ format (JWT) or legacy (parameter not required) (required)
63-
:param GeneratePublicKeyRequest generate_public_key_request: (required)
64-
:return: FlexV1KeysPost200Response
62+
:param GenerateCaptureContextRequest generate_capture_context_request: (required)
63+
:return: str
6564
If the method is called asynchronously,
6665
returns the request thread.
6766
"""
6867

6968
if self.api_client.mconfig.log_config.enable_log:
70-
self.logger.info("CALL TO METHOD `generate_public_key` STARTED")
69+
self.logger.info("CALL TO METHOD `generate_capture_context` STARTED")
7170

7271
kwargs['_return_http_data_only'] = True
7372
if kwargs.get('callback'):
74-
return self.generate_public_key_with_http_info(format, generate_public_key_request, **kwargs)
73+
return self.generate_capture_context_with_http_info(generate_capture_context_request, **kwargs)
7574
else:
76-
(data) = self.generate_public_key_with_http_info(format, generate_public_key_request, **kwargs)
75+
(data) = self.generate_capture_context_with_http_info(generate_capture_context_request, **kwargs)
7776
return data
7877

79-
def generate_public_key_with_http_info(self, format, generate_public_key_request, **kwargs):
78+
def generate_capture_context_with_http_info(self, generate_capture_context_request, **kwargs):
8079
"""
81-
Generate Key
82-
Generate a one-time use public key and key ID to encrypt the card number in the follow-on Tokenize Card request. The key used to encrypt the card number on the cardholder’s device or browser is valid for 15 minutes and must be used to verify the signature in the response message. CyberSource recommends creating a new key for each order. Generating a key is an authenticated request initiated from your servers, prior to requesting to tokenize the card data from your customer’s device or browser.
80+
Generate Capture Context
81+
This API is used to generate the Capture Context data structure for the Microform Integration. Microform is a browser-based acceptance solution that allows a seller to capture payment information is a secure manner from their website. For more information about Flex Microform transactions, see the [Flex Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-flex/SAFlexibleToken.html). For examples on how to integrate Flex Microform within your webpage please see our [GitHub Flex Samples](https://github.com/CyberSource?q=flex&type=&language=) This API is a server-to-server API to generate the capture context that can be used to initiate instance of microform on a acceptance page. The capture context is a digitally signed JWT that provides authentication, one-time keys, and the target origin to the Microform Integration application.
8382
This method makes a synchronous HTTP request by default. To make an
8483
asynchronous HTTP request, please define a `callback` function
8584
to be invoked when receiving the response.
8685
>>> def callback_function(response):
8786
>>> pprint(response)
8887
>>>
89-
>>> thread = api.generate_public_key_with_http_info(format, generate_public_key_request, callback=callback_function)
88+
>>> thread = api.generate_capture_context_with_http_info(generate_capture_context_request, callback=callback_function)
9089
9190
:param callback function: The callback function
9291
for asynchronous request. (optional)
93-
:param str format: Indicator to enable the receipt of the Keys response in Flex 11+ format (JWT) or legacy (parameter not required) (required)
94-
:param GeneratePublicKeyRequest generate_public_key_request: (required)
95-
:return: FlexV1KeysPost200Response
92+
:param GenerateCaptureContextRequest generate_capture_context_request: (required)
93+
:return: str
9694
If the method is called asynchronously,
9795
returns the request thread.
9896
"""
9997

100-
all_params = ['format', 'generate_public_key_request']
98+
all_params = ['generate_capture_context_request']
10199
all_params.append('callback')
102100
all_params.append('_return_http_data_only')
103101
all_params.append('_preload_content')
@@ -108,41 +106,34 @@ def generate_public_key_with_http_info(self, format, generate_public_key_request
108106
if key not in all_params:
109107
raise TypeError(
110108
"Got an unexpected keyword argument '%s'"
111-
" to method generate_public_key" % key
109+
" to method generate_capture_context" % key
112110
)
113111
params[key] = val
114112
del params['kwargs']
115-
# verify the required parameter 'format' is set
116-
if ('format' not in params) or (params['format'] is None):
113+
# verify the required parameter 'generate_capture_context_request' is set
114+
if ('generate_capture_context_request' not in params) or (params['generate_capture_context_request'] is None):
117115
if self.api_client.mconfig.log_config.enable_log:
118-
self.logger.error("InvalidArgumentException : Missing the required parameter `format` when calling `generate_public_key`")
119-
raise ValueError("Missing the required parameter `format` when calling `generate_public_key`")
120-
# verify the required parameter 'generate_public_key_request' is set
121-
if ('generate_public_key_request' not in params) or (params['generate_public_key_request'] is None):
122-
if self.api_client.mconfig.log_config.enable_log:
123-
self.logger.error("InvalidArgumentException : Missing the required parameter `generate_public_key_request` when calling `generate_public_key`")
124-
raise ValueError("Missing the required parameter `generate_public_key_request` when calling `generate_public_key`")
116+
self.logger.error("InvalidArgumentException : Missing the required parameter `generate_capture_context_request` when calling `generate_capture_context`")
117+
raise ValueError("Missing the required parameter `generate_capture_context_request` when calling `generate_capture_context`")
125118

126119

127120
collection_formats = {}
128121

129122
path_params = {}
130123

131124
query_params = []
132-
if 'format' in params:
133-
query_params.append(('format', params['format']))
134125

135126
header_params = {}
136127

137128
form_params = []
138129
local_var_files = {}
139130

140131
body_params = None
141-
if 'generate_public_key_request' in params:
142-
body_params = params['generate_public_key_request']
132+
if 'generate_capture_context_request' in params:
133+
body_params = params['generate_capture_context_request']
143134
# HTTP header `Accept`
144135
header_params['Accept'] = self.api_client.\
145-
select_header_accept(['application/json'])
136+
select_header_accept(['application/jwt'])
146137

147138
# HTTP header `Content-Type`
148139
header_params['Content-Type'] = self.api_client.\
@@ -151,14 +142,14 @@ def generate_public_key_with_http_info(self, format, generate_public_key_request
151142
# Authentication setting
152143
auth_settings = []
153144

154-
return self.api_client.call_api(f'/flex/v1/keys', 'POST',
145+
return self.api_client.call_api(f'/microform/v2/sessions', 'POST',
155146
path_params,
156147
query_params,
157148
header_params,
158149
body=body_params,
159150
post_params=form_params,
160151
files=local_var_files,
161-
response_type='FlexV1KeysPost200Response',
152+
response_type='str',
162153
auth_settings=auth_settings,
163154
callback=params.get('callback'),
164155
_return_http_data_only=params.get('_return_http_data_only'),

0 commit comments

Comments
 (0)