Create a reward entry for an entity, credit or debit
DEBITs are atomically validated against the entity's current balance and rejected with INSUFFICIENT_BALANCE if they would drive it negative. Concurrent writes on the same (customer, entity) pair are serialized via a postgres advisory lock held for the duration of the transaction.
Usage:
service.create({ phone, ... });
service.create({ entityId, ... });
ProtectedgetOptionalcategory?: stringOptionalcreatedAt?: DbTimestampCriteriaOptionalidempotencyKey?: stringOptionalids?: string[]OptionalorderBy?: DbOrderByCriterion<Optionalpage?: numberDefaults to 1
OptionalpageSize?: numberDefaults to 100
OptionaltransactionType?: "DEBIT" | "CREDIT"OptionalupdatedAt?: DbTimestampCriteriaentity reward entries
Manage rewards for entities
Internally, this is using a ledger so each reward causes a double-entry.