Class: Io::Flow::V0::Models::AchAuthorizationForm

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

Overview

Used for initiating an ACH (Automated Clearing House) bank transfer.

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 = {}) ⇒ AchAuthorizationForm

Returns a new instance of AchAuthorizationForm.



26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26830

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::ACH_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:account_owner_name, :account_number, :routing_number, :billing_address, :amount, :currency], 'AchAuthorizationForm')
  @account_owner_name = HttpClient::Preconditions.assert_class('account_owner_name', opts.delete(:account_owner_name), String)
  @account_number = HttpClient::Preconditions.assert_class('account_number', opts.delete(:account_number), String)
  @routing_number = HttpClient::Preconditions.assert_class('routing_number', opts.delete(:routing_number), String)
  @billing_address = (x = opts.delete(:billing_address); x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x))
  @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, 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)
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h })
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
end

Instance Attribute Details

#account_numberObject (readonly)

Returns the value of attribute account_number.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def 
  @account_number
end

#account_owner_nameObject (readonly)

Returns the value of attribute account_owner_name.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def 
  @account_owner_name
end

#amountObject (readonly)

Returns the value of attribute amount.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def attributes
  @attributes
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def billing_address
  @billing_address
end

#currencyObject (readonly)

Returns the value of attribute currency.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def currency
  @currency
end

#ipObject (readonly)

Returns the value of attribute ip.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def key
  @key
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def order_number
  @order_number
end

#routing_numberObject (readonly)

Returns the value of attribute routing_number.



26828
26829
26830
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26828

def routing_number
  @routing_number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26850
26851
26852
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26850

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

#subtype_to_hashObject



26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26854

def subtype_to_hash
  {
    :account_owner_name => ,
    :account_number => ,
    :routing_number => routing_number,
    :billing_address => billing_address.to_hash,
    :order_number => order_number,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :key => key,
    :attributes => attributes.nil? ? nil : attributes,
    :ip => ip
  }
end

#to_jsonObject



26846
26847
26848
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26846

def to_json
  JSON.dump(to_hash)
end