Class: Inttegro::BalanceTransaction
- Inherits:
-
T::Struct
- Object
- T::Struct
- Inttegro::BalanceTransaction
- Extended by:
- T::Sig
- Defined in:
- lib/inttegro/balance_transaction/balance_transaction.rb,
lib/inttegro/balance_transaction/base.rb,
lib/inttegro/balance_transaction/page.rb,
lib/inttegro/balance_transaction/type.rb,
lib/inttegro/balance_transaction/amount.rb,
lib/inttegro/balance_transaction/response.rb,
lib/inttegro/balance_transaction/questions.rb,
lib/inttegro/balance_transaction/allocation.rb,
lib/inttegro/balance_transaction/page_request.rb,
lib/inttegro/balance_transaction/spent_amount.rb,
lib/inttegro/balance_transaction/page_response.rb,
lib/inttegro/balance_transaction/lookup_request.rb,
lib/inttegro/balance_transaction/pending_amount.rb,
lib/inttegro/balance_transaction/allocation_base.rb,
lib/inttegro/balance_transaction/available_amount.rb,
lib/inttegro/balance_transaction/allocation_status.rb,
lib/inttegro/balance_transaction/payout_allocation.rb,
lib/inttegro/balance_transaction/refund_allocation.rb,
lib/inttegro/balance_transaction/allocation_base_type.rb,
lib/inttegro/balance_transaction/payout_configuration.rb,
lib/inttegro/balance_transaction/payout_allocation_type.rb,
lib/inttegro/balance_transaction/refund_allocation_type.rb,
lib/inttegro/balance_transaction/payout_allocation_payout.rb,
lib/inttegro/balance_transaction/refund_allocation_refund.rb,
lib/inttegro/balance_transaction/payout_configuration_destination.rb
Overview
Merchant balance entry caused by a payment, refund, or payout. type is the discriminator
and describes the semantic source rather than the direction.
This generated model is immutable. Construct it with .new, or decode a string-keyed API
payload with .from_hash. #serialize produces a string-keyed hash using the original wire
field names and serialized enum values.
Defined Under Namespace
Classes: AllocationBase, AllocationBaseType, AllocationStatus, Amount, AvailableAmount, LookupRequest, Page, PageRequest, PageResponse, PayoutAllocation, PayoutAllocationPayout, PayoutAllocationType, PayoutConfiguration, PayoutConfigurationDestination, PendingAmount, RefundAllocation, RefundAllocationRefund, RefundAllocationType, Response, SpentAmount, Type
Constant Summary collapse
- Allocation =
A caller-safe allocation of part of a payment balance transaction to a refund or payout.
T.type_alias { T.any(Inttegro::BalanceTransaction::RefundAllocation, Inttegro::BalanceTransaction::PayoutAllocation) }
Instance Attribute Summary collapse
-
#allocations ⇒ Array<Inttegro::BalanceTransaction::Allocation>?
readonly
All current pending and completed allocations.
-
#amount ⇒ Inttegro::BalanceTransaction::Amount
readonly
Value of the
amountfield in the Inttegro API payload. -
#available_amount ⇒ Inttegro::BalanceTransaction::AvailableAmount?
readonly
Amount still available for a refund or payout.
-
#available_at ⇒ Time?
readonly
Value of the
available_atfield in the Inttegro API payload. -
#claimed_at ⇒ Time?
readonly
Legacy whole-transaction payout claim timestamp.
-
#created_at ⇒ Time
readonly
Value of the
created_atfield in the Inttegro API payload. -
#id ⇒ String
readonly
Value of the
idfield in the Inttegro API payload. -
#order_id ⇒ String?
readonly
Value of the
order_idfield in the Inttegro API payload. -
#paid_at ⇒ Time?
readonly
Legacy whole-transaction payout completion timestamp.
-
#payment_id ⇒ String?
readonly
Value of the
payment_idfield in the Inttegro API payload. -
#payout_configuration ⇒ Inttegro::BalanceTransaction::PayoutConfiguration?
readonly
Value of the
payout_configurationfield in the Inttegro API payload. -
#payout_id ⇒ String?
readonly
Payout that created this finalized debit.
-
#pending_amount ⇒ Inttegro::BalanceTransaction::PendingAmount?
readonly
Amount temporarily unavailable because a refund or payout is unresolved.
-
#refund_id ⇒ String?
readonly
Value of the
refund_idfield in the Inttegro API payload. -
#spent_amount ⇒ Inttegro::BalanceTransaction::SpentAmount?
readonly
Amount permanently consumed by completed refund and payout allocations.
-
#type ⇒ Inttegro::BalanceTransaction::Type
readonly
Value of the
typefield in the Inttegro API payload.
Class Method Summary collapse
Instance Method Summary collapse
-
#source_id ⇒ String?
Return the resource identifier that originated this transaction when the source is unambiguous.
-
#valid? ⇒ Boolean
Check the minimum identity invariants needed to address this transaction.
-
#valid_source? ⇒ Boolean
Determine whether this transaction identifies exactly one source matching #type.
Instance Attribute Details
#allocations ⇒ Array<Inttegro::BalanceTransaction::Allocation>? (readonly)
All current pending and completed allocations. Released allocations are omitted.
Optional in the API payload; omitted values default to nil. Wire name: allocations.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#amount ⇒ Inttegro::BalanceTransaction::Amount (readonly)
Value of the amount field in the Inttegro API payload.
Required in the API payload. Wire name: amount.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#available_amount ⇒ Inttegro::BalanceTransaction::AvailableAmount? (readonly)
Amount still available for a refund or payout.
Optional in the API payload; omitted values default to nil. Wire name: available_amount.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#available_at ⇒ Time? (readonly)
Value of the available_at field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: available_at.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#claimed_at ⇒ Time? (readonly)
Legacy whole-transaction payout claim timestamp. New integrations should inspect
allocations.
Optional in the API payload; omitted values default to nil. Wire name: claimed_at.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#created_at ⇒ Time (readonly)
Value of the created_at field in the Inttegro API payload.
Required in the API payload. Wire name: created_at.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#id ⇒ String (readonly)
Value of the id field in the Inttegro API payload.
Required in the API payload. Wire name: id.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#order_id ⇒ String? (readonly)
Value of the order_id field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: order_id.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#paid_at ⇒ Time? (readonly)
Legacy whole-transaction payout completion timestamp. New integrations should inspect
allocations.
Optional in the API payload; omitted values default to nil. Wire name: paid_at.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#payment_id ⇒ String? (readonly)
Value of the payment_id field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: payment_id.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#payout_configuration ⇒ Inttegro::BalanceTransaction::PayoutConfiguration? (readonly)
Value of the payout_configuration field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: payout_configuration.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#payout_id ⇒ String? (readonly)
Payout that created this finalized debit.
Optional in the API payload; omitted values default to nil. Wire name: payout_id.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#pending_amount ⇒ Inttegro::BalanceTransaction::PendingAmount? (readonly)
Amount temporarily unavailable because a refund or payout is unresolved.
Optional in the API payload; omitted values default to nil. Wire name: pending_amount.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#refund_id ⇒ String? (readonly)
Value of the refund_id field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: refund_id.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#spent_amount ⇒ Inttegro::BalanceTransaction::SpentAmount? (readonly)
Amount permanently consumed by completed refund and payout allocations.
Optional in the API payload; omitted values default to nil. Wire name: spent_amount.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
#type ⇒ Inttegro::BalanceTransaction::Type (readonly)
Value of the type field in the Inttegro API payload.
Required in the API payload. Wire name: type.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 122 class BalanceTransaction const :amount, Inttegro::BalanceTransaction::Amount const :created_at, Time const :id, String const :type, Inttegro::BalanceTransaction::Type const :allocations, T.nilable(T::Array[Inttegro::BalanceTransaction::Allocation]), default: nil const :available_amount, T.nilable(Inttegro::BalanceTransaction::AvailableAmount), default: nil const :available_at, T.nilable(Time), default: nil const :claimed_at, T.nilable(Time), default: nil const :order_id, T.nilable(String), default: nil const :paid_at, T.nilable(Time), default: nil const :payment_id, T.nilable(String), default: nil const :payout_id, T.nilable(String), default: nil const :payout_configuration, T.nilable(Inttegro::BalanceTransaction::PayoutConfiguration), default: nil const :pending_amount, T.nilable(Inttegro::BalanceTransaction::PendingAmount), default: nil const :spent_amount, T.nilable(Inttegro::BalanceTransaction::SpentAmount), default: nil const :refund_id, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end end |
Class Method Details
.from_hash(hash, strict = false) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/inttegro/balance_transaction/balance_transaction.rb', line 143 def self.from_hash(hash, strict = false) data = hash.dup if (allocations_value = data["allocations"]).is_a?(Array) data["allocations"] = allocations_value.map do |item| next item unless item.is_a?(Hash) case item["type"] when "payout" Inttegro::BalanceTransaction::PayoutAllocation.from_hash(item) when "refund" Inttegro::BalanceTransaction::RefundAllocation.from_hash(item) else item end end end super(data, strict) end |
Instance Method Details
#source_id ⇒ String?
Return the resource identifier that originated this transaction when the source is unambiguous.
Payment transactions return #payment_id; refund transactions return #refund_id. The
method returns nil when the matching identifier is absent, empty, or conflicts with the
identifier for the other source type.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/inttegro/balance_transaction/questions.rb', line 16 def source_id payment = payment_id refund = refund_id if type == Inttegro::BalanceTransaction::Type::PAYMENT && payment && !payment.empty? && refund.nil? return payment end if type == Inttegro::BalanceTransaction::Type::REFUND && refund && !refund.empty? && payment.nil? return refund end nil end |
#valid? ⇒ Boolean
Check the minimum identity invariants needed to address this transaction.
A valid transaction has non-empty transaction and order identifiers as well as an unambiguous source identifier. This is a local structural check; it does not contact the API.
44 45 46 47 |
# File 'lib/inttegro/balance_transaction/questions.rb', line 44 def valid? order = order_id !id.empty? && !order.nil? && !order.empty? && valid_source? end |
#valid_source? ⇒ Boolean
Determine whether this transaction identifies exactly one source matching #type.
33 34 35 |
# File 'lib/inttegro/balance_transaction/questions.rb', line 33 def valid_source? !source_id.nil? end |