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

#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.|      |**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)


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

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



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

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