Class: Io::Flow::V0::Models::InlineAuthorizationForm

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

Overview

Executes a widget-based payment based on the provided payment method.

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

Returns a new instance of InlineAuthorizationForm.



45874
45875
45876
45877
45878
45879
45880
45881
45882
45883
45884
45885
45886
45887
45888
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45874

def initialize(incoming={})
  super(:discriminator => AuthorizationForm::Types::INLINE_AUTHORIZATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:method, :order_number, :amount, :currency], 'InlineAuthorizationForm')
  @method = HttpClient::Preconditions.assert_class('method', opts.delete(:method), String)
  @issuer = (x = opts.delete(:issuer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::IssuerReference) ? x : ::Io::Flow::V0::Models::IssuerReference.new(x)))
  @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)
  @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x)))
  @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))
  @payload = (x = opts.delete(:payload); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationPayload) ? x : ::Io::Flow::V0::Models::AuthorizationPayload.new(x)))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def attributes
  @attributes
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def billing_address
  @billing_address
end

#currencyObject (readonly)

Returns the value of attribute currency.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def currency
  @currency
end

#ipObject (readonly)

Returns the value of attribute ip.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def ip
  @ip
end

#issuerObject (readonly)

Returns the value of attribute issuer.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def issuer
  @issuer
end

#keyObject (readonly)

Returns the value of attribute key.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def key
  @key
end

#methodObject (readonly)

Returns the value of attribute method.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def method
  @method
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def order_number
  @order_number
end

#payloadObject (readonly)

Returns the value of attribute payload.



45872
45873
45874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45872

def payload
  @payload
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



45894
45895
45896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45894

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

#subtype_to_hashObject



45898
45899
45900
45901
45902
45903
45904
45905
45906
45907
45908
45909
45910
45911
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45898

def subtype_to_hash
  {
    :method => method,
    :issuer => issuer.nil? ? nil : issuer.to_hash,
    :order_number => order_number,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :billing_address => billing_address.nil? ? nil : billing_address.to_hash,
    :key => key,
    :attributes => attributes.nil? ? nil : attributes,
    :ip => ip,
    :payload => payload.nil? ? nil : payload.to_hash
  }
end

#to_jsonObject



45890
45891
45892
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45890

def to_json
  JSON.dump(to_hash)
end