class Io::Flow::V0::Models::PaymentInformation

Attributes

amount_capturable[R]
amount_captured[R]
amount_refundable[R]
amount_refunded[R]
authorizations[R]
capturable_before[R]
refundable_before[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56866
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:authorizations], 'PaymentInformation')
  @amount_refundable = (x = opts.delete(:amount_refundable); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_refundable', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @amount_refunded = (x = opts.delete(:amount_refunded); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_refunded', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @refundable_before = (x = opts.delete(:refundable_before); x.nil? ? nil : HttpClient::Preconditions.assert_class('refundable_before', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @amount_capturable = (x = opts.delete(:amount_capturable); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_capturable', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @amount_captured = (x = opts.delete(:amount_captured); x.nil? ? nil : HttpClient::Preconditions.assert_class('amount_captured', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @capturable_before = (x = opts.delete(:capturable_before); x.nil? ? nil : HttpClient::Preconditions.assert_class('capturable_before', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @authorizations = HttpClient::Preconditions.assert_class('authorizations', opts.delete(:authorizations), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::PaymentAuthorization) ? x : ::Io::Flow::V0::Models::PaymentAuthorization.new(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56882
def copy(incoming={})
  PaymentInformation.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56886
def to_hash
  {
    :amount_refundable => amount_refundable.to_f.to_s,
    :amount_refunded => amount_refunded.to_f.to_s,
    :refundable_before => refundable_before,
    :amount_capturable => amount_capturable.to_f.to_s,
    :amount_captured => amount_captured.to_f.to_s,
    :capturable_before => capturable_before,
    :authorizations => authorizations.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 56878
def to_json
  JSON.dump(to_hash)
end