Class: Io::Flow::V0::Models::RefundOrderSummary

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

Overview

For merchant of record authorizations, we provide a summary of refund information primarily to support customer service workflow.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundOrderSummary

Returns a new instance of RefundOrderSummary.



63277
63278
63279
63280
63281
63282
63283
63284
63285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63277

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order_number, :currency, :captured, :refunded, :amounts], 'RefundOrderSummary')
  @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @captured = HttpClient::Preconditions.assert_class('captured', HttpClient::Helper.to_big_decimal(opts.delete(:captured)), BigDecimal)
  @refunded = HttpClient::Preconditions.assert_class('refunded', HttpClient::Helper.to_big_decimal(opts.delete(:refunded)), BigDecimal)
  @amounts = (x = opts.delete(:amounts); x.is_a?(::Io::Flow::V0::Models::RefundOrderSummaryAmounts) ? x : ::Io::Flow::V0::Models::RefundOrderSummaryAmounts.new(x))
end

Instance Attribute Details

#amountsObject (readonly)

Returns the value of attribute amounts.



63275
63276
63277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63275

def amounts
  @amounts
end

#capturedObject (readonly)

Returns the value of attribute captured.



63275
63276
63277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63275

def captured
  @captured
end

#currencyObject (readonly)

Returns the value of attribute currency.



63275
63276
63277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63275

def currency
  @currency
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



63275
63276
63277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63275

def order_number
  @order_number
end

#refundedObject (readonly)

Returns the value of attribute refunded.



63275
63276
63277
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63275

def refunded
  @refunded
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63291
63292
63293
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63291

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

#to_hashObject



63295
63296
63297
63298
63299
63300
63301
63302
63303
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63295

def to_hash
  {
    :order_number => order_number,
    :currency => currency,
    :captured => captured.to_f.to_s,
    :refunded => refunded.to_f.to_s,
    :amounts => amounts.to_hash
  }
end

#to_jsonObject



63287
63288
63289
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63287

def to_json
  JSON.dump(to_hash)
end