DVMemoryPayoutLedger class

The payout ledger in memory, for tests and development.

Its checks and writes do not await, so on one isolate nothing interleaves between reading a balance and debiting it.

Implemented types

Constructors

DVMemoryPayoutLedger()

Properties

entries → List<DVPayoutEntry>
Every entry, oldest first.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

balance(String accountId, String currency, {bool available = false}) → Future<int>
The sum of accountId's entries in currency; with available, leaving out entries of sales on hold.
override
completePayout(String payoutId, String transferReference) → Future<void>
override
findPayout(String payoutId) → Future<DVPayoutRecord?>
override
hold(String saleId, String reason) → Future<void>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordReversal({required String saleId, required String reference, required int amount, required List<DVPayoutEntry> entries(DVPayoutSaleRecord sale, int before)}) → Future<bool?>
Records a reversal of amount of saleId under reference, unless one is recorded under it (false). entries is given the sale and how much was reversed before, and returns the entries. Returns null when amount is more than is left, recording nothing.
override
recordSale(DVPayoutSaleRecord sale, List<DVPayoutEntry> credits) → Future<bool>
Records sale and its credits unless the sale is recorded. False when it is.
override
release(String saleId) → Future<void>
override
removePayout(String payoutId) → Future<void>
override
reservePayout({required String accountId, required String currency, required String payoutId, required DateTime at}) → Future<DVPayoutReservation>
Reserves everything available to accountId in currency as payout payoutId, debiting it, as one step with reading the balance. Returns the existing record when payoutId is already reserved.
override
sale(String saleId) → Future<DVPayoutSaleRecord?>
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited