Skip to content

basalt / subscriptions-sqlite/src / SqlitePaymentStore

Class: SqlitePaymentStore ​

Defined in: subscriptions-sqlite/src/index.ts:348

SQLite-backed PaymentStore — the payment ledger keyed by the gateway payment id. create is an idempotent INSERT OR IGNORE; setStatus updates in place (inserting if the payment was never recorded). Money is a 64-bit INTEGER (minor units).

Implements ​

Constructors ​

Constructor ​

> new SqlitePaymentStore(db): SqlitePaymentStore

Defined in: subscriptions-sqlite/src/index.ts:349

Parameters ​

db ​

DatabaseSync

Returns ​

SqlitePaymentStore

Methods ​

create() ​

> create(payment): Promise<void>

Defined in: subscriptions-sqlite/src/index.ts:351

Insert a pending payment. Idempotent: a no-op if the id already exists.

Parameters ​

payment ​

NewPayment

Returns ​

Promise<void>

Implementation of ​

PaymentStore.create


get() ​

> get(id): Promise<PaymentRecord | undefined>

Defined in: subscriptions-sqlite/src/index.ts:397

Parameters ​

id ​

string

Returns ​

Promise<PaymentRecord | undefined>

Implementation of ​

PaymentStore.get


setStatus() ​

> setStatus(id, status, patch?): Promise<void>

Defined in: subscriptions-sqlite/src/index.ts:369

Apply a terminal status; upserts if the payment wasn't recorded first.

Parameters ​

id ​

string

status ​

PaymentRecordStatus

patch? ​
amount? ​

number

raw? ​

unknown

Returns ​

Promise<void>

Implementation of ​

PaymentStore.setStatus

Released under the MIT License.