class BleumiPay::HostedCheckoutsApi

Attributes

api_client[RW]
request_validator[RW]

Public Class Methods

new(api_client = ApiClient.default, request_validator = RequestValidator.default) click to toggle source
# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 20
def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
  @api_client = api_client
  @request_validator = request_validator
end

Public Instance Methods

create_checkout_url(create_checkout_url_request, opts = {}) click to toggle source

Generate a unique checkout URL to accept payment. @param create_checkout_url_request [CreateCheckoutUrlRequest] Specify checkout URL creation parameters. @param [Hash] opts the optional parameters @return [CreateCheckoutUrlResponse]

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 28
def create_checkout_url(create_checkout_url_request, opts = {})
  data, _status_code, _headers = create_checkout_url_with_http_info(create_checkout_url_request, opts)
  data
end
create_checkout_url_with_http_info(create_checkout_url_request, opts = {}) click to toggle source

Generate a unique checkout URL to accept payment. @param create_checkout_url_request [CreateCheckoutUrlRequest] Specify checkout URL creation parameters. @param [Hash] opts the optional parameters @return [Array<(CreateCheckoutUrlResponse, Integer, Hash)>] CreateCheckoutUrlResponse data, response status code and response headers

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 37
def create_checkout_url_with_http_info(create_checkout_url_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.create_checkout_url ...'
  end
  # verify the required parameter 'create_checkout_url_request' is set
  if @api_client.config.client_side_validation && create_checkout_url_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_checkout_url_request' when calling HostedCheckoutsApi.create_checkout_url"
  end
  # verify the values in the request body are valid
  msg = @request_validator.validate_create_checkout_url_request(create_checkout_url_request)
  if (@request_validator.is_not_empty(msg))
    fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.create_checkout_url"
  end 
  # resource path
  local_var_path = '/v1/payment/hc'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(create_checkout_url_request) 

  # return_type
  return_type = opts[:return_type] || 'CreateCheckoutUrlResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HostedCheckoutsApi#create_checkout_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_tokens(opts = {}) click to toggle source

Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard. @param [Hash] opts the optional parameters @return [Array<CheckoutToken>]

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 94
def list_tokens(opts = {})
  data, _status_code, _headers = list_tokens_with_http_info(opts)
  data
end
list_tokens_with_http_info(opts = {}) click to toggle source

Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard. @param [Hash] opts the optional parameters @return [Array<(Array<CheckoutToken>, Integer, Hash)>] Array<CheckoutToken> data, response status code and response headers

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 102
def list_tokens_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.list_tokens ...'
  end
  # resource path
  local_var_path = '/v1/payment/hc/tokens'

  # query parameters
  query_params = opts[:query_params] || {}

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

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<CheckoutToken>' 

  # auth_names
  auth_names = opts[:auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HostedCheckoutsApi#list_tokens\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
validate_checkout_payment(validate_checkout_request, opts = {}) click to toggle source

Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment. @param validate_checkout_request [ValidateCheckoutRequest] Specify validation of checkout parameters. @param [Hash] opts the optional parameters @return [ValidateCheckoutResponse]

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 149
def validate_checkout_payment(validate_checkout_request, opts = {})
  data, _status_code, _headers = validate_checkout_payment_with_http_info(validate_checkout_request, opts)
  data
end
validate_checkout_payment_with_http_info(validate_checkout_request, opts = {}) click to toggle source

Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment. @param validate_checkout_request [ValidateCheckoutRequest] Specify validation of checkout parameters. @param [Hash] opts the optional parameters @return [Array<(ValidateCheckoutResponse, Integer, Hash)>] ValidateCheckoutResponse data, response status code and response headers

# File lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb, line 158
def validate_checkout_payment_with_http_info(validate_checkout_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: HostedCheckoutsApi.validate_checkout_payment ...'
  end
  # verify the required parameter 'validate_checkout_request' is set
  if @api_client.config.client_side_validation && validate_checkout_request.nil?
    fail ArgumentError, "Missing the required parameter 'validate_checkout_request' when calling HostedCheckoutsApi.validate_checkout_payment"
  end
  # verify the values in the request body are valid
  msg = @request_validator.validate_checkout_payment_params(validate_checkout_request)
  if (@request_validator.is_not_empty(msg))
    fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.validate_checkout_payment"
  end 
  # resource path
  local_var_path = '/v1/payment/hc/validate'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(validate_checkout_request) 

  # return_type
  return_type = opts[:return_type] || 'ValidateCheckoutResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HostedCheckoutsApi#validate_checkout_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end