class Io::Flow::V0::Models::OrderRefundSummaryAmounts

Detailed examples of amount to refund following common e-commerce use cases.

Attributes

balance[R]
discount[R]
duty[R]
item_subtotal[R]
refund_total[R]
shipping[R]
vat[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 53698
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:balance, :item_subtotal, :refund_total, :shipping, :vat, :duty], 'OrderRefundSummaryAmounts')
  @balance = HttpClient::Preconditions.assert_class('balance', HttpClient::Helper.to_big_decimal(opts.delete(:balance)), BigDecimal)
  @item_subtotal = HttpClient::Preconditions.assert_class('item_subtotal', HttpClient::Helper.to_big_decimal(opts.delete(:item_subtotal)), BigDecimal)
  @discount = (x = opts.delete(:discount); x.nil? ? nil : HttpClient::Preconditions.assert_class('discount', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @refund_total = HttpClient::Preconditions.assert_class('refund_total', HttpClient::Helper.to_big_decimal(opts.delete(:refund_total)), BigDecimal)
  @shipping = HttpClient::Preconditions.assert_class('shipping', HttpClient::Helper.to_big_decimal(opts.delete(:shipping)), BigDecimal)
  @vat = HttpClient::Preconditions.assert_class('vat', HttpClient::Helper.to_big_decimal(opts.delete(:vat)), BigDecimal)
  @duty = HttpClient::Preconditions.assert_class('duty', HttpClient::Helper.to_big_decimal(opts.delete(:duty)), BigDecimal)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 53714
def copy(incoming={})
  OrderRefundSummaryAmounts.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 53718
def to_hash
  {
    :balance => balance.to_f.to_s,
    :item_subtotal => item_subtotal.to_f.to_s,
    :discount => discount.to_f.to_s,
    :refund_total => refund_total.to_f.to_s,
    :shipping => shipping.to_f.to_s,
    :vat => vat.to_f.to_s,
    :duty => duty.to_f.to_s
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 53710
def to_json
  JSON.dump(to_hash)
end