Class: Io::Flow::V0::Models::OnlineAuthorization

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

Instance Attribute Summary collapse

Attributes inherited from Authorization

#discriminator

Instance Method Summary collapse

Methods inherited from Authorization

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ OnlineAuthorization

Returns a new instance of OnlineAuthorization.



50927
50928
50929
50930
50931
50932
50933
50934
50935
50936
50937
50938
50939
50940
50941
50942
50943
50944
50945
50946
50947
50948
50949
50950
50951
50952
50953
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50927

def initialize(incoming={})
  super(:discriminator => Authorization::Types::ONLINE_AUTHORIZATION)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :amount, :currency, :customer, :attributes, :result, :created_at], 'OnlineAuthorization')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @method = (x = opts.delete(:method); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentMethod) ? x : ::Io::Flow::V0::Models::PaymentMethod.new(x)))
  @merchant_of_record = (x = (x = opts.delete(:merchant_of_record); x.nil? ? "flow" : x); x.is_a?(::Io::Flow::V0::Models::MerchantOfRecord) ? x : ::Io::Flow::V0::Models::MerchantOfRecord.apply(x))
  @details = (x = opts.delete(:details); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OnlineAuthorizationDetails) ? x : ::Io::Flow::V0::Models::OnlineAuthorizationDetails.from_json(x)))
  @payment = (x = opts.delete(:payment); x.nil? ? nil : HttpClient::Preconditions.assert_class('payment', HttpClient::Helper.to_object(x), Hash))
  @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)
  @requested = (x = opts.delete(:requested); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x)))
  @customer = (x = opts.delete(:customer); x.is_a?(::Io::Flow::V0::Models::OrderCustomer) ? x : ::Io::Flow::V0::Models::OrderCustomer.new(x))
  @attributes = HttpClient::Preconditions.assert_class('attributes', opts.delete(:attributes), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
  @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
  @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)))
  @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::AuthorizationOrderReference) ? x : ::Io::Flow::V0::Models::AuthorizationOrderReference.new(x)))
  @payment_order_reference = (x = opts.delete(:payment_order_reference); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::PaymentOrderReference) ? x : ::Io::Flow::V0::Models::PaymentOrderReference.from_json(x)))
  @ip = (x = opts.delete(:ip); x.nil? ? nil : HttpClient::Preconditions.assert_class('ip', x, String))
  @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::AuthorizationResult) ? x : ::Io::Flow::V0::Models::AuthorizationResult.new(x))
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
  @expires_at = (x = opts.delete(:expires_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @base = (x = opts.delete(:base); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x)))
  @processor = (x = opts.delete(:processor); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExpandablePaymentProcessor) ? x : ::Io::Flow::V0::Models::ExpandablePaymentProcessor.from_json(x)))
  @confirmation_details = (x = opts.delete(:confirmation_details); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ConfirmationDetails) ? x : ::Io::Flow::V0::Models::ConfirmationDetails.from_json(x)))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def amount
  @amount
end

#attributesObject (readonly)

Returns the value of attribute attributes.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def attributes
  @attributes
end

#baseObject (readonly)

Returns the value of attribute base.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def base
  @base
end

#billing_addressObject (readonly)

Returns the value of attribute billing_address.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def billing_address
  @billing_address
end

#confirmation_detailsObject (readonly)

Returns the value of attribute confirmation_details.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def confirmation_details
  @confirmation_details
end

#created_atObject (readonly)

Returns the value of attribute created_at.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def currency
  @currency
end

#customerObject (readonly)

Returns the value of attribute customer.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def customer
  @customer
end

#destinationObject (readonly)

Returns the value of attribute destination.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def destination
  @destination
end

#detailsObject (readonly)

Returns the value of attribute details.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def details
  @details
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def expires_at
  @expires_at
end

#idObject (readonly)

Returns the value of attribute id.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def id
  @id
end

#ipObject (readonly)

Returns the value of attribute ip.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def ip
  @ip
end

#keyObject (readonly)

Returns the value of attribute key.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def key
  @key
end

#merchant_of_recordObject (readonly)

Returns the value of attribute merchant_of_record.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def merchant_of_record
  @merchant_of_record
end

#methodObject (readonly)

Returns the value of attribute method.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def method
  @method
end

#orderObject (readonly)

Returns the value of attribute order.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def order
  @order
end

#paymentObject (readonly)

Returns the value of attribute payment.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def payment
  @payment
end

#payment_order_referenceObject (readonly)

Returns the value of attribute payment_order_reference.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def payment_order_reference
  @payment_order_reference
end

#processorObject (readonly)

Returns the value of attribute processor.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def processor
  @processor
end

#requestedObject (readonly)

Returns the value of attribute requested.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def requested
  @requested
end

#resultObject (readonly)

Returns the value of attribute result.



50925
50926
50927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50925

def result
  @result
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



50959
50960
50961
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50959

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

#subtype_to_hashObject



50963
50964
50965
50966
50967
50968
50969
50970
50971
50972
50973
50974
50975
50976
50977
50978
50979
50980
50981
50982
50983
50984
50985
50986
50987
50988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50963

def subtype_to_hash
  {
    :id => id,
    :key => key,
    :method => method.nil? ? nil : method.to_hash,
    :merchant_of_record => merchant_of_record.value,
    :details => details.nil? ? nil : details.to_hash,
    :payment => payment,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :requested => requested.nil? ? nil : requested.to_hash,
    :customer => customer.to_hash,
    :attributes => attributes,
    :destination => destination.nil? ? nil : destination.to_hash,
    :billing_address => billing_address.nil? ? nil : billing_address.to_hash,
    :order => order.nil? ? nil : order.to_hash,
    :payment_order_reference => payment_order_reference.nil? ? nil : payment_order_reference.to_hash,
    :ip => ip,
    :result => result.to_hash,
    :created_at => created_at,
    :expires_at => expires_at,
    :base => base.nil? ? nil : base.to_hash,
    :processor => processor.nil? ? nil : processor.to_hash,
    :confirmation_details => confirmation_details.nil? ? nil : confirmation_details.to_hash
  }
end

#to_jsonObject



50955
50956
50957
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 50955

def to_json
  JSON.dump(to_hash)
end