Class: CyberSource::TokenApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/token_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ TokenApi

Returns a new instance of TokenApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/token_api.rb', line 18

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/cybersource_rest_client/api/token_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#get_card_art_asset(instrument_identifier_id, token_provider, asset_type, opts = {}) ⇒ InlineResponse200

Retrieve Card Art 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.

Parameters:

  • instrument_identifier_id

    The Id of an Instrument Identifier.

  • token_provider

    The token provider.

  • asset_type

    The type of asset.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



31
32
33
34
# File 'lib/cybersource_rest_client/api/token_api.rb', line 31

def get_card_art_asset(instrument_identifier_id, token_provider, asset_type, opts = {})
  data, status_code, headers = get_card_art_asset_with_http_info(instrument_identifier_id, token_provider, asset_type, opts)
  return data, status_code, headers
end

#get_card_art_asset_with_http_info(instrument_identifier_id, token_provider, asset_type, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>

Retrieve Card Art Retrieves Card Art for a specific Instrument Identifier. The Card Art is a visual representation of the cardholder&#39;s payment card. Card Art is only available if a Network Token is successfully provisioned.

Parameters:

  • instrument_identifier_id

    The Id of an Instrument Identifier.

  • token_provider

    The token provider.

  • asset_type

    The type of asset.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse200, Fixnum, Hash)>)

    InlineResponse200 data, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cybersource_rest_client/api/token_api.rb', line 43

def get_card_art_asset_with_http_info(instrument_identifier_id, token_provider, asset_type, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: TokenApi.get_card_art_asset ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'instrument_identifier_id' is set
  if @api_client.config.client_side_validation && instrument_identifier_id.nil?
    fail ArgumentError, "Missing the required parameter 'instrument_identifier_id' when calling TokenApi.get_card_art_asset"
  end
  # verify the required parameter 'token_provider' is set
  if @api_client.config.client_side_validation && token_provider.nil?
    fail ArgumentError, "Missing the required parameter 'token_provider' when calling TokenApi.get_card_art_asset"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['vts', 'mdes', 'amex', 'mscof'].include?(token_provider)
    fail ArgumentError, "invalid value for 'token_provider', must be one of vts, mdes, amex, mscof"
  end
  # verify the required parameter 'asset_type' is set
  if @api_client.config.client_side_validation && asset_type.nil?
    fail ArgumentError, "Missing the required parameter 'asset_type' when calling TokenApi.get_card_art_asset"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['card-art-combined', 'brand-logo', 'issuer-logo', 'icon-logo'].include?(asset_type)
    fail ArgumentError, "invalid value for 'asset_type', must be one of card-art-combined, brand-logo, issuer-logo, icon-logo"
  end
  # resource path
  local_var_path = 'tms/v2/tokens/{instrumentIdentifierId}/{tokenProvider}/assets/{assetType}'.sub('{' + 'instrumentIdentifierId' + '}', instrument_identifier_id.to_s).sub('{' + 'tokenProvider' + '}', token_provider.to_s).sub('{' + 'assetType' + '}', asset_type.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters
  form_params = {}

  # http body (model)
  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["get_card_art_asset","get_card_art_asset_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse200')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TokenApi#get_card_art_asset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#post_token_payment_credentials(token_id, post_payment_credentials_request, opts = {}) ⇒ String

Generate Payment Credentials for a TMS Token | | | | | — | — | — | |Token
A Token can represent your tokenized Customer, Payment Instrument or Instrument Identifier information.|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|**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 or Instrument Identifier.

Parameters:

  • token_id

    The Id of a token representing a Customer, Payment Instrument or Instrument Identifier.

  • post_payment_credentials_request
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    The Id of a profile containing user specific TMS configuration.

Returns:

  • (String)


126
127
128
129
# File 'lib/cybersource_rest_client/api/token_api.rb', line 126

def post_token_payment_credentials(token_id, post_payment_credentials_request, opts = {})
  data, status_code, headers = post_token_payment_credentials_with_http_info(token_id, post_payment_credentials_request, opts)
  return data, status_code, headers
end

#post_token_payment_credentials_with_http_info(token_id, post_payment_credentials_request, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Generate Payment Credentials for a TMS Token | | | | | — | — | — | |Token&lt;br&gt;A Token can represent your tokenized Customer, Payment Instrument or Instrument Identifier information.|&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|**Payment Credentials**&lt;br&gt;Contains payment information such as the network token, generated cryptogram for Visa &amp; MasterCard or dynamic CVV for Amex in a JSON Web Encryption (JWE) response.&lt;br&gt;Your system can use this API to retrieve the Payment Credentials for an existing Customer, Payment Instrument or Instrument Identifier.

Parameters:

  • token_id

    The Id of a token representing a Customer, Payment Instrument or Instrument Identifier.

  • post_payment_credentials_request
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :profile_id (String)

    The Id of a profile containing user specific TMS configuration.

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/cybersource_rest_client/api/token_api.rb', line 138

def post_token_payment_credentials_with_http_info(token_id, post_payment_credentials_request, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: TokenApi.post_token_payment_credentials ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'token_id' is set
  if @api_client.config.client_side_validation && token_id.nil?
    fail ArgumentError, "Missing the required parameter 'token_id' when calling TokenApi.post_token_payment_credentials"
  end
  # verify the required parameter 'post_payment_credentials_request' is set
  if @api_client.config.client_side_validation && post_payment_credentials_request.nil?
    fail ArgumentError, "Missing the required parameter 'post_payment_credentials_request' when calling TokenApi.post_token_payment_credentials"
  end
  # resource path
  local_var_path = 'tms/v2/tokens/{tokenId}/payment-credentials'.sub('{' + 'tokenId' + '}', token_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/jose;charset=utf-8'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])
  header_params[:'profile-id'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(post_payment_credentials_request)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'PostPaymentCredentialsRequest', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["post_token_payment_credentials","post_token_payment_credentials_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TokenApi#post_token_payment_credentials\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end