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.



19136
19137
19138
19139
19140
19141
19142
19143
19144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19136

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

#amounts ⇒ Object (readonly)

Returns the value of attribute amounts.



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def amounts
  @amounts
end

#captured ⇒ Object (readonly)

Returns the value of attribute captured.



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def captured
  @captured
end

#currency ⇒ Object (readonly)

Returns the value of attribute currency.



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def currency
  @currency
end

#order_number ⇒ Object (readonly)

Returns the value of attribute order_number.



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def order_number
  @order_number
end

#refunded ⇒ Object (readonly)

Returns the value of attribute refunded.



19134
19135
19136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19134

def refunded
  @refunded
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19150
19151
19152
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19150

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

#to_hash ⇒ Object



19154
19155
19156
19157
19158
19159
19160
19161
19162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19154

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

#to_json ⇒ Object



19146
19147
19148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19146

def to_json
  JSON.dump(to_hash)
end