Class: CyberSource::KeyGenerationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cyberSource_client/api/key_generation_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ KeyGenerationApi

Returns a new instance of KeyGenerationApi.



19
20
21
# File 'lib/cyberSource_client/api/key_generation_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cyberSource_client/api/key_generation_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#generate_public_key(generate_public_key_request, opts = {}) ⇒ InlineResponse200

Generate Key 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.

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/cyberSource_client/api/key_generation_api.rb', line 27

def generate_public_key(generate_public_key_request, opts = {})
  data, _status_code, _headers = generate_public_key_with_http_info(generate_public_key_request, opts)
  return data, _status_code, _headers
end

#generate_public_key_with_http_info(generate_public_key_request, opts = {}) ⇒ Array<(InlineResponse200, Fixnum, Hash)>

Generate Key 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.

Parameters:

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

    the optional parameters

Returns:

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

    InlineResponse200 data, response status code and response headers



37
38
39
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
# File 'lib/cyberSource_client/api/key_generation_api.rb', line 37

def generate_public_key_with_http_info(generate_public_key_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: KeyGenerationApi.generate_public_key ...'
  end
  # verify the required parameter 'generate_public_key_request' is set
  if @api_client.config.client_side_validation && generate_public_key_request.nil?
    fail ArgumentError, "Missing the required parameter 'generate_public_key_request' when calling KeyGenerationApi.generate_public_key"
  end
  # resource path
  local_var_path = 'flex/v1/keys'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(generate_public_key_request)
  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 => 'InlineResponse200')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: KeyGenerationApi#generate_public_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end