Class: ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry

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

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:, 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:) ⇒ Object

Some parameter documentations has been truncated, see ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::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

  • 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::LedgerTransactions::LedgerTransactionVersion::LedgerEntry::Status)

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



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 194

class LedgerEntry < ModernTreasury::Internal::Type::BaseModel
  # @!attribute id
  #
  #   @return [String]
  required :id, String

  # @!attribute amount
  #   Value in specified currency's smallest unit. e.g. $10 would be represented
  #   as 1000. Can be any integer up to 36 digits.
  #
  #   @return [Integer]
  required :amount, Integer

  # @!attribute created_at
  #
  #   @return [Time]
  required :created_at, Time

  # @!attribute direction
  #   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`.
  #
  #   @return [Symbol, ModernTreasury::Models::TransactionDirection]
  required :direction, enum: -> { ModernTreasury::TransactionDirection }

  # @!attribute effective_at
  #   The timestamp (ISO8601 format) at which the ledger transaction happened for
  #   reporting purposes.
  #
  #   @return [Time]
  required :effective_at, Time

  # @!attribute ledger_account_currency
  #   The currency of the ledger account.
  #
  #   @return [String]
  required :ledger_account_currency, String

  # @!attribute ledger_account_currency_exponent
  #   The currency exponent of the ledger account.
  #
  #   @return [Integer]
  required :ledger_account_currency_exponent, Integer

  # @!attribute ledger_account_id
  #   The ledger account that this ledger entry is associated with.
  #
  #   @return [String]
  required :ledger_account_id, String

  # @!attribute ledger_account_lock_version
  #   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.
  #
  #   @return [Integer, nil]
  required :ledger_account_lock_version, Integer, nil?: true

  # @!attribute ledger_transaction_id
  #   The ledger transaction that this ledger entry is associated with.
  #
  #   @return [String]
  required :ledger_transaction_id, String

  # @!attribute live_mode
  #   This field will be true if this object exists in the live environment or false
  #   if it exists in the test environment.
  #
  #   @return [Boolean]
  required :live_mode, ModernTreasury::Internal::Type::Boolean

  # @!attribute metadata
  #   Additional data represented as key-value pairs. Both the key and value must be
  #   strings.
  #
  #   @return [Hash{Symbol=>String}]
  required :metadata, ModernTreasury::Internal::Type::HashOf[String]

  # @!attribute object
  #
  #   @return [String]
  required :object, String

  # @!attribute resulting_ledger_account_balances
  #   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
  #   https://docs.moderntreasury.com/docs/transaction-status-and-balances for more
  #   details.
  #
  #   @return [ModernTreasury::Models::LedgerBalances, nil]
  required :resulting_ledger_account_balances, -> { ModernTreasury::LedgerBalances }, nil?: true

  # @!attribute status
  #   Equal to the state of the ledger transaction when the ledger entry was created.
  #   One of `pending`, `posted`, or `archived`.
  #
  #   @return [Symbol, ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry::Status]
  required :status,
           enum: -> { ModernTreasury::LedgerTransactions::LedgerTransactionVersion::LedgerEntry::Status }

  # @!method initialize(id:, amount:, created_at:, direction:, 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:)
  #   Some parameter documentations has been truncated, see
  #   {ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry}
  #   for more details.
  #
  #   @param id [String]
  #
  #   @param amount [Integer] Value in specified currency's smallest unit. e.g. $10 would be represented as 10
  #
  #   @param created_at [Time]
  #
  #   @param direction [Symbol, ModernTreasury::Models::TransactionDirection] One of `credit`, `debit`. Describes the direction money is flowing in the transa
  #
  #   @param effective_at [Time] The timestamp (ISO8601 format) at which the ledger transaction happened for repo
  #
  #   @param ledger_account_currency [String] The currency of the ledger account.
  #
  #   @param ledger_account_currency_exponent [Integer] The currency exponent of the ledger account.
  #
  #   @param ledger_account_id [String] The ledger account that this ledger entry is associated with.
  #
  #   @param ledger_account_lock_version [Integer, nil] Lock version of the ledger account. This can be passed when creating a ledger tr
  #
  #   @param ledger_transaction_id [String] The ledger transaction that this ledger entry is associated with.
  #
  #   @param live_mode [Boolean] This field will be true if this object exists in the live environment or false i
  #
  #   @param metadata [Hash{Symbol=>String}] Additional data represented as key-value pairs. Both the key and value must be s
  #
  #   @param object [String]
  #
  #   @param resulting_ledger_account_balances [ModernTreasury::Models::LedgerBalances, nil] The pending, posted, and available balances for this ledger entry's ledger accou
  #
  #   @param status [Symbol, ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry::Status] Equal to the state of the ledger transaction when the ledger entry was created.

  # Equal to the state of the ledger transaction when the ledger entry was created.
  # One of `pending`, `posted`, or `archived`.
  #
  # @see ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry#status
  module Status
    extend ModernTreasury::Internal::Type::Enum

    ARCHIVED = :archived
    PENDING = :pending
    POSTED = :posted

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

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)


205
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 205

required :amount, Integer

#created_atTime

Returns:

  • (Time)


210
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 210

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`.



219
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 219

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

#effective_atTime

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

Returns:

  • (Time)


226
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 226

required :effective_at, Time

#idString

Returns:

  • (String)


198
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 198

required :id, String

#ledger_account_currencyString

The currency of the ledger account.

Returns:

  • (String)


232
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 232

required :ledger_account_currency, String

#ledger_account_currency_exponentInteger

The currency exponent of the ledger account.

Returns:

  • (Integer)


238
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 238

required :ledger_account_currency_exponent, Integer

#ledger_account_idString

The ledger account that this ledger entry is associated with.

Returns:

  • (String)


244
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 244

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)


253
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 253

required :ledger_account_lock_version, Integer, nil?: true

#ledger_transaction_idString

The ledger transaction that this ledger entry is associated with.

Returns:

  • (String)


259
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 259

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)


266
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 266

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})


273
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 273

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

#objectString

Returns:

  • (String)


278
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 278

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.



290
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 290

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

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

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



297
298
# File 'lib/modern_treasury/models/ledger_transactions/ledger_transaction_version.rb', line 297

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