class Io::Flow::V0::Models::RefundCapture

Refund captures provide the detailed information on the amount refunded against a specific capture

Attributes

amount[R]
base[R]
capture[R]
currency[R]
id[R]
refund[R]
status[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62966
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :refund, :capture, :amount, :currency, :base], 'RefundCapture')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @refund = (x = opts.delete(:refund); x.is_a?(::Io::Flow::V0::Models::Refund) ? x : ::Io::Flow::V0::Models::Refund.new(x))
  @capture = (x = opts.delete(:capture); x.is_a?(::Io::Flow::V0::Models::Capture) ? x : ::Io::Flow::V0::Models::Capture.new(x))
  @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)
  @base = (x = opts.delete(:base); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
  @status = (x = (x = opts.delete(:status); x.nil? ? "succeeded" : x); x.is_a?(::Io::Flow::V0::Models::RefundStatus) ? x : ::Io::Flow::V0::Models::RefundStatus.apply(x))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62982
def copy(incoming={})
  RefundCapture.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 62986
def to_hash
  {
    :id => id,
    :refund => refund.to_hash,
    :capture => capture.to_hash,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :base => base.to_hash,
    :status => status.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62978
def to_json
  JSON.dump(to_hash)
end