Class: Io::Flow::V0::Models::CardPaymentSourceAuthorizationForm

Inherits:
AuthorizationForm show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Creates an authorization for a transaction from a card payment source.

Instance Attribute Summary collapse

Attributes inherited from AuthorizationForm

#discriminator

Instance Method Summary collapse

Methods inherited from AuthorizationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CardPaymentSourceAuthorizationForm

Returns a new instance of CardPaymentSourceAuthorizationForm.



25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25421

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::CARD_PAYMENT_SOURCE_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:card_payment_source_id, :order_number, :amount, :currency], 'CardPaymentSourceAuthorizationForm')
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @card_payment_source_id = HttpClient::Preconditions.assert_class('card_payment_source_id', opts.delete(:card_payment_source_id), String)
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @browser_info = (x = opts.delete(:browser_info); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BrowserInfo) ? x : ::Io::Flow::V0::Models::BrowserInfo.new(x)))
  @inline_action_configuration = (x = opts.delete(:inline_action_configuration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::InlineActionConfiguration) ? x : ::Io::Flow::V0::Models::InlineActionConfiguration.from_json(x)))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def amount
  @amount
end

#browser_infoObject (readonly)

Returns the value of attribute browser_info.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def browser_info
  @browser_info
end

#card_payment_source_idObject (readonly)

Returns the value of attribute card_payment_source_id.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def card_payment_source_id
  @card_payment_source_id
end

#currencyObject (readonly)

Returns the value of attribute currency.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def currency
  @currency
end

#inline_action_configurationObject (readonly)

Returns the value of attribute inline_action_configuration.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def inline_action_configuration
  @inline_action_configuration
end

#keyObject (readonly)

Returns the value of attribute key.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



25419
25420
25421
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25419

def order_number
  @order_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25438
25439
25440
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25438

def copy(incoming={})
  CardPaymentSourceAuthorizationForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25442

def subtype_to_hash
  {
    :key => key,
    :card_payment_source_id => card_payment_source_id,
    :order_number => order_number,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :browser_info => browser_info.nil? ? nil : browser_info.to_hash,
    :inline_action_configuration => inline_action_configuration.nil? ? nil : inline_action_configuration.to_hash
  }
end

#to_jsonObject



25434
25435
25436
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25434

def to_json
  JSON.dump(to_hash)
end