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: , 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) (defaults to: )
  • amount (Integer) (defaults to: )

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

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

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

  • ledger_account_currency (String) (defaults to: )

    The currency of the ledger account.

  • ledger_account_currency_exponent (Integer) (defaults to: )

    The currency exponent of the ledger account.

  • ledger_account_id (String) (defaults to: )

    The ledger account that this ledger entry is associated with.

  • ledger_account_lock_version (Integer, nil) (defaults to: )

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

  • ledger_transaction_id (String) (defaults to: )

    The ledger transaction that this ledger entry is associated with.

  • live_mode (Boolean) (defaults to: )

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

  • metadata (Hash{Symbol=>String}) (defaults to: )

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

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

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

  • status (Symbol, ModernTreasury::Models::LedgerTransactions::LedgerTransactionVersion::LedgerEntry::Status) (defaults to: )

    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
# 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 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:, 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 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 }

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


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

required :ledger_account_currency, String

#ledger_account_currency_exponentInteger

The currency exponent of the ledger account.

Returns:

  • (Integer)


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

required :ledger_account_currency_exponent, Integer

#ledger_account_idString

The ledger account that this ledger entry is associated with.

Returns:

  • (String)


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

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)


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

required :ledger_account_lock_version, Integer, nil?: true

#ledger_transaction_idString

The ledger transaction that this ledger entry is associated with.

Returns:

  • (String)


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

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)


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

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


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

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

#objectString

Returns:

  • (String)


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

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.



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

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



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

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