Class: CyberSourceMergedSpec::NetworkTokensController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb

Overview

NetworkTokensController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#get_card_art_asset(instrument_identifier_id, token_provider, asset_type) ⇒ ApiResponse

Retrieves Card Art for a specific Instrument Identifier. The Card Art is a visual representation of the cardholder's payment card. Card Art is only available if a Network Token is successfully provisioned. Instrument Identifier. provider.

Parameters:

  • instrument_identifier_id (String)

    Required parameter: The Id of an

  • token_provider (TokenProvider)

    Required parameter: The token

  • asset_type (AssetType)

    Required parameter: The type of asset.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 302

def get_card_art_asset(instrument_identifier_id,
                       token_provider,
                       asset_type)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/tokens/{instrumentIdentifierId}/{tokenProvider}/assets/{assetType}',
                                 Server::DEFAULT)
               .template_param(new_parameter(instrument_identifier_id, key: 'instrumentIdentifierId')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(token_provider, key: 'tokenProvider')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(asset_type, key: 'assetType')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetCardArtAssetResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end

#get_tokenized_card(tokenized_card_id, profile_id: nil) ⇒ ApiResponse

|Tokenized Cards
A Tokenized Card represents a network token. Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires. This API returns the details of a tokenized card stored in TMS. You can use this API to check the status of a tokenized card and retrieve details such as the last four digits of the underlying card, expiration date, and card type. tokenized card. containing user specific TMS configuration.

Parameters:

  • tokenized_card_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 69

def get_tokenized_card(tokenized_card_id,
                       profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/tms/v2/tokenized-cards/{tokenizedCardId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(tokenized_card_id, key: 'tokenizedCardId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(GetTokenizedCardResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             GetTokenizedCardException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             GetTokenizedCardException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             GetTokenizedCardException3Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             GetTokenizedCardException4Exception)
                .local_error('500',
                             'Unexpected error.',
                             GetTokenizedCardException5Exception))
    .execute
end

#post_issuer_life_cycle_simulation(profile_id, tokenized_card_id, post_issuer_life_cycle_simulation_request) ⇒ ApiResponse

Lifecycle Management Events
Simulates an issuer life cycle manegement event for updates on the tokenized card. The events that can be simulated are:

  • Token status changes (e.g. active, suspended, deleted)
  • Updates to the underlying card, including card art changes, expiration date changes, and card number suffix. Note: This is only available in CAS environment. containing user specific TMS configuration. tokenized card. post_issuer_life_cycle_simulation_request Required parameter: TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 341

def post_issuer_life_cycle_simulation(profile_id,
                                      tokenized_card_id,
                                      post_issuer_life_cycle_simulation_request)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/tokenized-cards/{tokenizedCardId}/issuer-life-cycle-event-simulations',
                                 Server::DEFAULT)
               .header_param(new_parameter(profile_id, key: 'profile-id')
                              .is_required(true))
               .template_param(new_parameter(tokenized_card_id, key: 'tokenizedCardId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(post_issuer_life_cycle_simulation_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostIssuerLifeCycleSimulationException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostIssuerLifeCycleSimulationException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PostIssuerLifeCycleSimulationException3Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostIssuerLifeCycleSimulationException4Exception))
    .execute
end

#post_token_payment_credentials(token_id, post_payment_credentials_request, profile_id: nil) ⇒ ApiResponse

Note: This resource will be replace by payment credentials version 3. The SDK will remain available for now; however, it will no longer be documented or maintain in the Developer Centre.
Token
A Token can represent your tokenized Customer, Payment Instrument, Instrument Identifier or Tokenized Card information.
Payment Credentials
Contains payment information such as the network token, generated cryptogram for Visa & MasterCard or dynamic CVV for Amex in a JSON Web Encryption (JWE) response.
Your system can use this API to retrieve the Payment Credentials for an existing Customer, Payment Instrument, Instrument Identifier or Tokenized Card.
Optionally, authenticated identities information from Passkey authentication can be provided to potentially achieve liability shift, which may result in the return of an e-commerce indicator of 5 if successful. representing a Customer, Payment Instrument or Instrument Identifier. Required parameter: TODO: type description here containing user specific TMS configuration.

Parameters:

  • token_id (String)

    Required parameter: The Id of a token

  • post_payment_credentials_request (PostPaymentCredentialsRequest)
  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 250

def post_token_payment_credentials(token_id,
                                   post_payment_credentials_request,
                                   profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/tokens/{tokenId}/payment-credentials',
                                 Server::DEFAULT)
               .template_param(new_parameter(token_id, key: 'tokenId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(post_payment_credentials_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:deserialize_primitive_types))
                .deserialize_into(proc do |response| response&.to_s end)
                .is_api_response(true)
                .is_primitive_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostTokenPaymentCredentialsException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostTokenPaymentCredentialsException1Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PostTokenPaymentCredentialsException2Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PostTokenPaymentCredentialsException3Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostTokenPaymentCredentialsException4Exception)
                .local_error('502',
                             'Unexpected error.',
                             PostTokenPaymentCredentialsException5Exception))
    .execute
end

#post_token_payment_credentials_v3(token_id, post_payment_credentials_request, profile_id: nil) ⇒ ApiResponse

Payment Credentials
Contains payment information such as the network token, generated TAVV cryptogram for Visa & MasterCard, dynamic CVV for Amex, or DTVV cryptogram for VISA. This latest version (v3) returns the Primary Account Number details, if the network token is not present. The response is provided in JSON Web Encryption (JWE) format.
Your system can use this API to retrieve the Payment Credentials for an existing Customer, Payment Instrument, Instrument Identifier or Tokenized Card.
Optionally, authenticated identities information from Passkey authentication can be provided to potentially achieve liability shift, which may result in the return of an e-commerce indicator of 5 if successful. representing a Customer, Payment Instrument or Instrument Identifier. Required parameter: TODO: type description here containing user specific TMS configuration.

Parameters:

  • token_id (String)

    Required parameter: The Id of a token

  • post_payment_credentials_request (PostPaymentCredentialsRequest)
  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 182

def post_token_payment_credentials_v3(token_id,
                                      post_payment_credentials_request,
                                      profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v3/tokens/{tokenId}/payment-credentials',
                                 Server::DEFAULT)
               .template_param(new_parameter(token_id, key: 'tokenId')
                                .is_required(true)
                                .should_encode(true))
               .body_param(new_parameter(post_payment_credentials_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PostTokenPaymentCredentialsV3Response.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostTokenPaymentCredentialsV3Exception)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostTokenPaymentCredentialsV3Exception1Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PostTokenPaymentCredentialsV3Exception2Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostTokenPaymentCredentialsV3Exception3Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PostTokenPaymentCredentialsV3Exception4Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostTokenPaymentCredentialsV3Exception5Exception)
                .local_error('502',
                             'Unexpected error.',
                             PostTokenPaymentCredentialsV3Exception6Exception))
    .execute
end

#post_tokenized_card(post_tokenized_card_request, profile_id: nil) ⇒ ApiResponse

Tokenized cards
A Tokenized card represents a network token. Network tokens perform better than regular card numbers and they are not necessarily invalidated when a cardholder loses their card, or it expires. This API submits a request to the card association to create a network token. If successful, a tokenized card will be created in TMS to represent the network token. parameter: TODO: type description here containing user specific TMS configuration.

Parameters:

  • post_tokenized_card_request (PostTokenizedCardRequest)

    Required

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 20

def post_tokenized_card(post_tokenized_card_request,
                        profile_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/tokenized-cards',
                                 Server::DEFAULT)
               .body_param(new_parameter(post_tokenized_card_request)
                            .is_required(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PostTokenizedCardResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostTokenizedCardException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostTokenizedCardException2Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostTokenizedCardException3Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PostTokenizedCardException4Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostTokenizedCardException5Exception))
    .execute
end

#post_tokenized_card_delete(tokenized_card_id, profile_id: nil, post_tokenized_card_delete_request: nil) ⇒ ApiResponse

This API attempts to delete a network token from the card association with a specified reason. | If successful, the corresponding tokenized card will be deleted. | The reason for deletion can be specified to provide context for the deletion operation. tokenized card. containing user specific TMS configuration. Optional parameter: TODO: type description here

Parameters:

  • tokenized_card_id (String)

    Required parameter: The Id of a

  • profile_id (String) (defaults to: nil)

    Optional parameter: The Id of a profile

  • post_tokenized_card_delete_request (PostTokenizedCardDeleteRequest) (defaults to: nil)

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/cyber_source_merged_spec/controllers/network_tokens_controller.rb', line 118

def post_tokenized_card_delete(tokenized_card_id,
                               profile_id: nil,
                               post_tokenized_card_delete_request: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/tms/v2/tokenized-cards/{tokenizedCardId}/delete',
                                 Server::DEFAULT)
               .template_param(new_parameter(tokenized_card_id, key: 'tokenizedCardId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json;charset=utf-8', key: 'Content-Type'))
               .header_param(new_parameter(profile_id, key: 'profile-id'))
               .body_param(new_parameter(post_tokenized_card_delete_request))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true)
                .local_error('400',
                             'Bad Request: e.g. A required header value could be missing.',
                             PostTokenizedCardDeleteException)
                .local_error('403',
                             'Forbidden: e.g. The profile might not have permission to'\
                              ' perform the operation.',
                             PostTokenizedCardDeleteException2Exception)
                .local_error('404',
                             'Token Not Found. The Id may not exist or was entered'\
                              ' incorrectly.',
                             PostTokenizedCardDeleteException3Exception)
                .local_error('409',
                             'Conflict. The token is linked to a Payment Instrument.',
                             PostTokenizedCardDeleteException4Exception)
                .local_error('410',
                             'Token Not Available. The token has been deleted.',
                             PostTokenizedCardDeleteException5Exception)
                .local_error('424',
                             'Failed Dependency: e.g. The profile represented by the'\
                              ' profile-id may not exist or the profile-id was entered'\
                              ' incorrectly.',
                             PostTokenizedCardDeleteException6Exception)
                .local_error('500',
                             'Unexpected error.',
                             PostTokenizedCardDeleteException7Exception))
    .execute
end