Class: Io::Flow::V0::Models::PayoutTransaction
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PayoutTransaction
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Note there is no statement on the payout transaction. We intend to deprecate the statement field once payouts are fully rolled out
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#fees ⇒ Object
readonly
Returns the value of attribute fees.
-
#gross ⇒ Object
readonly
Returns the value of attribute gross.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#identifiers ⇒ Object
readonly
Returns the value of attribute identifiers.
-
#net ⇒ Object
readonly
Returns the value of attribute net.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#payment_request ⇒ Object
readonly
Returns the value of attribute payment_request.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#withholdings ⇒ Object
readonly
Returns the value of attribute withholdings.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ PayoutTransaction
constructor
A new instance of PayoutTransaction.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PayoutTransaction
Returns a new instance of PayoutTransaction.
59302 59303 59304 59305 59306 59307 59308 59309 59310 59311 59312 59313 59314 59315 59316 59317 59318 59319 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59302 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :currency, :source, :gross, :net, :created_at, :updated_at], 'PayoutTransaction') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @order = (x = opts.delete(:order); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingChannelOrderSummary) ? x : ::Io::Flow::V0::Models::BillingChannelOrderSummary.new(x))) @payment_request = (x = opts.delete(:payment_request); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingChannelPaymentRequestReference) ? x : ::Io::Flow::V0::Models::BillingChannelPaymentRequestReference.new(x))) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @source = (x = opts.delete(:source); x.is_a?(::Io::Flow::V0::Models::TransactionSource) ? x : ::Io::Flow::V0::Models::TransactionSource.apply(x)) @parent = (x = opts.delete(:parent); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ParentTransactionSummary) ? x : ::Io::Flow::V0::Models::ParentTransactionSummary.new(x))) @gross = HttpClient::Preconditions.assert_class('gross', HttpClient::Helper.to_big_decimal(opts.delete(:gross)), BigDecimal) @fees = HttpClient::Preconditions.assert_class('fees', (x = opts.delete(:fees); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FeeDeduction) ? x : ::Io::Flow::V0::Models::FeeDeduction.new(x)) } @withholdings = HttpClient::Preconditions.assert_class('withholdings', (x = opts.delete(:withholdings); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::WithholdingDeduction) ? x : ::Io::Flow::V0::Models::WithholdingDeduction.new(x)) } @discounts = HttpClient::Preconditions.assert_class('discounts', (x = opts.delete(:discounts); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::BillingDiscount) ? x : ::Io::Flow::V0::Models::BillingDiscount.new(x)) } @net = HttpClient::Preconditions.assert_class('net', HttpClient::Helper.to_big_decimal(opts.delete(:net)), BigDecimal) @identifiers = HttpClient::Preconditions.assert_class('identifiers', (x = opts.delete(:identifiers); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('identifiers', d[1], String); h } @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime) @updated_at = HttpClient::Preconditions.assert_class('updated_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:updated_at)), DateTime) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def created_at @created_at end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def currency @currency end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def discounts @discounts end |
#fees ⇒ Object (readonly)
Returns the value of attribute fees.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def fees @fees end |
#gross ⇒ Object (readonly)
Returns the value of attribute gross.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def gross @gross end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def id @id end |
#identifiers ⇒ Object (readonly)
Returns the value of attribute identifiers.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def identifiers @identifiers end |
#net ⇒ Object (readonly)
Returns the value of attribute net.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def net @net end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def order @order end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def parent @parent end |
#payment_request ⇒ Object (readonly)
Returns the value of attribute payment_request.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def payment_request @payment_request end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def source @source end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def updated_at @updated_at end |
#withholdings ⇒ Object (readonly)
Returns the value of attribute withholdings.
59300 59301 59302 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59300 def withholdings @withholdings end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
59325 59326 59327 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59325 def copy(incoming={}) PayoutTransaction.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
59329 59330 59331 59332 59333 59334 59335 59336 59337 59338 59339 59340 59341 59342 59343 59344 59345 59346 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59329 def to_hash { :id => id, :order => order.nil? ? nil : order.to_hash, :payment_request => payment_request.nil? ? nil : payment_request.to_hash, :currency => currency, :source => source.value, :parent => parent.nil? ? nil : parent.to_hash, :gross => gross.to_f.to_s, :fees => fees.map { |o| o.to_hash }, :withholdings => withholdings.map { |o| o.to_hash }, :discounts => discounts.map { |o| o.to_hash }, :net => net.to_f.to_s, :identifiers => identifiers, :created_at => created_at, :updated_at => updated_at } end |
#to_json ⇒ Object
59321 59322 59323 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59321 def to_json JSON.dump(to_hash) end |