Class: Io::Flow::V0::Models::RefundOrderSummaryAmounts

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

Overview

Detailed examples of amount to refund following common ecommerce use cases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundOrderSummaryAmounts

Returns a new instance of RefundOrderSummaryAmounts.



19171
19172
19173
19174
19175
19176
19177
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19171

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:balance], 'RefundOrderSummaryAmounts')
  @balance = HttpClient::Preconditions.assert_class('balance', HttpClient::Helper.to_big_decimal(opts.delete(:balance)), BigDecimal)
  @balance_excluding_shipping = (x = opts.delete(:balance_excluding_shipping); x.nil? ? nil : HttpClient::Preconditions.assert_class('balance_excluding_shipping', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @shipping = (x = opts.delete(:shipping); x.nil? ? nil : HttpClient::Preconditions.assert_class('shipping', HttpClient::Helper.to_big_decimal(x), BigDecimal))
end

Instance Attribute Details

#balance ⇒ Object (readonly)

Returns the value of attribute balance.



19169
19170
19171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19169

def balance
  @balance
end

#balance_excluding_shipping ⇒ Object (readonly)

Returns the value of attribute balance_excluding_shipping.



19169
19170
19171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19169

def balance_excluding_shipping
  @balance_excluding_shipping
end

#shipping ⇒ Object (readonly)

Returns the value of attribute shipping.



19169
19170
19171
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19169

def shipping
  @shipping
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19183
19184
19185
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19183

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

#to_hash ⇒ Object



19187
19188
19189
19190
19191
19192
19193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19187

def to_hash
  {
    :balance => balance,
    :balance_excluding_shipping => balance_excluding_shipping,
    :shipping => shipping
  }
end

#to_json ⇒ Object



19179
19180
19181
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19179

def to_json
  JSON.dump(to_hash)
end