Class: ModernTreasury::Models::LedgerEntry

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/modern_treasury/models/ledger_entry.rb

Overview

Defined Under Namespace

Modules: Status

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, amount:, created_at:, direction:, discarded_at:, effective_at:, ledger_account_currency:, ledger_account_currency_exponent:, ledger_account_id:, ledger_account_lock_version:, ledger_transaction_id:, live_mode:, metadata:, object:, resulting_ledger_account_balances:, status:, updated_at:) ⇒ Object

Some parameter documentations has been truncated, see ModernTreasury::Models::LedgerEntry for more details.

Parameters:

  • id (String)
  • amount (Integer)

    Value in specified currency’s smallest unit. e.g. $10 would be represented as 10

  • created_at (Time)
  • direction (Symbol, ModernTreasury::Models::TransactionDirection)

    One of ‘credit`, `debit`. Describes the direction money is flowing in the transa

  • discarded_at (Time, nil)
  • effective_at (Time)

    The timestamp (ISO8601 format) at which the ledger transaction happened for repo

  • ledger_account_currency (String)

    The currency of the ledger account.

  • ledger_account_currency_exponent (Integer)

    The currency exponent of the ledger account.

  • ledger_account_id (String)

    The ledger account that this ledger entry is associated with.

  • ledger_account_lock_version (Integer, nil)

    Lock version of the ledger account. This can be passed when creating a ledger tr

  • ledger_transaction_id (String)

    The ledger transaction that this ledger entry is associated with.

  • live_mode (Boolean)

    This field will be true if this object exists in the live environment or false i

  • metadata (Hash{Symbol=>String})

    Additional data represented as key-value pairs. Both the key and value must be s

  • object (String)
  • resulting_ledger_account_balances (ModernTreasury::Models::LedgerBalances, nil)

    The pending, posted, and available balances for this ledger entry’s ledger accou

  • status (Symbol, ModernTreasury::Models::LedgerEntry::Status)

    Equal to the state of the ledger transaction when the ledger entry was created.

  • updated_at (Time)


# File 'lib/modern_treasury/models/ledger_entry.rb', line 121

Instance Attribute Details

#amountInteger

Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000. Can be any integer up to 36 digits.

Returns:

  • (Integer)


17
# File 'lib/modern_treasury/models/ledger_entry.rb', line 17

required :amount, Integer

#created_atTime

Returns:

  • (Time)


22
# File 'lib/modern_treasury/models/ledger_entry.rb', line 22

required :created_at, Time

#directionSymbol, ModernTreasury::Models::TransactionDirection

One of ‘credit`, `debit`. Describes the direction money is flowing in the transaction. A `credit` moves money from your account to someone else’s. A ‘debit` pulls money from someone else’s account to your own. Note that wire, rtp, and check payments will always be ‘credit`.



31
# File 'lib/modern_treasury/models/ledger_entry.rb', line 31

required :direction, enum: -> { ModernTreasury::TransactionDirection }

#discarded_atTime?

Returns:

  • (Time, nil)


36
# File 'lib/modern_treasury/models/ledger_entry.rb', line 36

required :discarded_at, Time, nil?: true

#effective_atTime

The timestamp (ISO8601 format) at which the ledger transaction happened for reporting purposes.

Returns:

  • (Time)


43
# File 'lib/modern_treasury/models/ledger_entry.rb', line 43

required :effective_at, Time

#idString

Returns:

  • (String)


10
# File 'lib/modern_treasury/models/ledger_entry.rb', line 10

required :id, String

#ledger_account_currencyString

The currency of the ledger account.

Returns:

  • (String)


49
# File 'lib/modern_treasury/models/ledger_entry.rb', line 49

required :ledger_account_currency, String

#ledger_account_currency_exponentInteger

The currency exponent of the ledger account.

Returns:

  • (Integer)


55
# File 'lib/modern_treasury/models/ledger_entry.rb', line 55

required :ledger_account_currency_exponent, Integer

#ledger_account_idString

The ledger account that this ledger entry is associated with.

Returns:

  • (String)


61
# File 'lib/modern_treasury/models/ledger_entry.rb', line 61

required :ledger_account_id, String

#ledger_account_lock_versionInteger?

Lock version of the ledger account. This can be passed when creating a ledger transaction to only succeed if no ledger transactions have posted since the given version. See our post about Designing the Ledgers API with Optimistic Locking for more details.

Returns:

  • (Integer, nil)


70
# File 'lib/modern_treasury/models/ledger_entry.rb', line 70

required :ledger_account_lock_version, Integer, nil?: true

#ledger_transaction_idString

The ledger transaction that this ledger entry is associated with.

Returns:

  • (String)


76
# File 'lib/modern_treasury/models/ledger_entry.rb', line 76

required :ledger_transaction_id, String

#live_modeBoolean

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (Boolean)


83
# File 'lib/modern_treasury/models/ledger_entry.rb', line 83

required :live_mode, ModernTreasury::Internal::Type::Boolean

#metadataHash{Symbol=>String}

Additional data represented as key-value pairs. Both the key and value must be strings.

Returns:

  • (Hash{Symbol=>String})


90
# File 'lib/modern_treasury/models/ledger_entry.rb', line 90

required :metadata, ModernTreasury::Internal::Type::HashOf[String]

#objectString

Returns:

  • (String)


95
# File 'lib/modern_treasury/models/ledger_entry.rb', line 95

required :object, String

#resulting_ledger_account_balancesModernTreasury::Models::LedgerBalances?

The pending, posted, and available balances for this ledger entry’s ledger account. The posted balance is the sum of all posted entries on the account. The pending balance is the sum of all pending and posted entries on the account. The available balance is the posted incoming entries minus the sum of the pending and posted outgoing amounts. Please see docs.moderntreasury.com/docs/transaction-status-and-balances for more details.



107
# File 'lib/modern_treasury/models/ledger_entry.rb', line 107

required :resulting_ledger_account_balances, -> { ModernTreasury::LedgerBalances }, nil?: true

#statusSymbol, ModernTreasury::Models::LedgerEntry::Status

Equal to the state of the ledger transaction when the ledger entry was created. One of ‘pending`, `posted`, or `archived`.



114
# File 'lib/modern_treasury/models/ledger_entry.rb', line 114

required :status, enum: -> { ModernTreasury::LedgerEntry::Status }

#updated_atTime

Returns:

  • (Time)


119
# File 'lib/modern_treasury/models/ledger_entry.rb', line 119

required :updated_at, Time