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 e-commerce use cases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundOrderSummaryAmounts

Returns a new instance of RefundOrderSummaryAmounts.



25271
25272
25273
25274
25275
25276
25277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25271

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

#balanceObject (readonly)

Returns the value of attribute balance.



25269
25270
25271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25269

def balance
  @balance
end

#balance_excluding_shippingObject (readonly)

Returns the value of attribute balance_excluding_shipping.



25269
25270
25271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25269

def balance_excluding_shipping
  @balance_excluding_shipping
end

#shippingObject (readonly)

Returns the value of attribute shipping.



25269
25270
25271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25269

def shipping
  @shipping
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



25283
25284
25285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25283

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

#to_hashObject



25287
25288
25289
25290
25291
25292
25293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25287

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

#to_jsonObject



25279
25280
25281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25279

def to_json
  JSON.dump(to_hash)
end