Method: CyberSource::PaymentInstrumentApi#paymentinstruments_post_with_http_info

Defined in:
lib/cyberSource_client/api/payment_instrument_api.rb

#paymentinstruments_post_with_http_info(profile_id, body, opts = {}) ⇒ Array<(InlineResponse2016, Fixnum, Hash)>

Create a Payment Instrument

Parameters:

  • profile_id

    The id of a profile containing user specific TMS configuration.

  • body

    Please specify the customers payment details for card or bank account.

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

    the optional parameters

Returns:

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

    InlineResponse2016 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
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cyberSource_client/api/payment_instrument_api.rb', line 37

def paymentinstruments_post_with_http_info(profile_id, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentInstrumentApi.paymentinstruments_post ...'
  end
  # verify the required parameter 'profile_id' is set
  if @api_client.config.client_side_validation && profile_id.nil?
    fail ArgumentError, "Missing the required parameter 'profile_id' when calling PaymentInstrumentApi.paymentinstruments_post"
  end
  # if @api_client.config.client_side_validation && profile_id > 36
  #   fail ArgumentError, 'invalid value for "profile_id" when calling PaymentInstrumentApi.paymentinstruments_post, must be smaller than or equal to 36.'
  # end

  # if @api_client.config.client_side_validation && profile_id < 36
  #   fail ArgumentError, 'invalid value for "profile_id" when calling PaymentInstrumentApi.paymentinstruments_post, must be greater than or equal to 36.'
  # end

  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling PaymentInstrumentApi.paymentinstruments_post"
  end
  # resource path
  local_var_path = 'tms/v1/paymentinstruments'

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

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