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.



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

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.



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

def api_client
  @api_client
end

Instance Method Details

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

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

Parameters:

  • token_id

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

  • 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)


29
30
31
32
# File 'lib/cybersource_rest_client/api/token_api.rb', line 29

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

#post_token_payment_credentials_with_http_info(token_id, 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.

  • 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



40
41
42
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
# File 'lib/cybersource_rest_client/api/token_api.rb', line 40

def post_token_payment_credentials_with_http_info(token_id, 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
  if @api_client.config.client_side_validation && token_id.to_s.length > 32
    fail ArgumentError, 'invalid value for "token_id" when calling TokenApi.post_token_payment_credentials, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && token_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "token_id" when calling TokenApi.post_token_payment_credentials, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'profile_id'].nil? && opts[:'profile_id'].to_s.length > 36
    fail ArgumentError, 'invalid value for "opts[:"profile_id"]" when calling TokenApi.post_token_payment_credentials, the character length must be smaller than or equal to 36.'
  end

  if @api_client.config.client_side_validation && !opts[:'profile_id'].nil? && opts[:'profile_id'].to_s.length < 36
    fail ArgumentError, 'invalid value for "opts[:"profile_id"]" when calling TokenApi.post_token_payment_credentials, the character length must be great than or equal to 36.'
  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)

  if 'POST' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  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