@classytic/revenue 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bank-feed-DJtLvz_7.mjs +133 -0
- package/dist/bank-feed.enums-BadqNJTC.d.mts +118 -0
- package/dist/bank-feed.enums-kYTLTTbe.mjs +165 -0
- package/dist/bridges/index.d.mts +1 -1
- package/dist/core/state-machines.d.mts +25 -2
- package/dist/core/state-machines.mjs +43 -3
- package/dist/{engine-types-CcjIb4Fy.d.mts → engine-types-txFXOiQS.d.mts} +451 -14
- package/dist/enums/index.d.mts +4 -3
- package/dist/enums/index.mjs +4 -3
- package/dist/{errors-DHa8JVQ-.mjs → errors-Dt46UZL_.mjs} +23 -1
- package/dist/{escrow.schema-D5X32LwX.d.mts → escrow.schema-9yh4Q-aQ.d.mts} +23 -23
- package/dist/{event-constants-CEMitnIV.mjs → event-constants-CTiDNWzc.mjs} +6 -0
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +3 -3
- package/dist/index.d.mts +21 -11
- package/dist/index.mjs +120 -19
- package/dist/providers/index.d.mts +2 -2
- package/dist/providers/index.mjs +2 -2
- package/dist/registry-h8sasoLh.d.mts +145 -0
- package/dist/repositories/create-repositories.d.mts +1 -1
- package/dist/repositories/create-repositories.mjs +1 -1
- package/dist/{revenue-bridges-sdlrR85c.d.mts → revenue-bridges-BtkWFsJu.d.mts} +107 -1
- package/dist/{revenue-event-catalog-LqxPnsU_.mjs → revenue-event-catalog-CgZ57M-f.mjs} +77 -3
- package/dist/{revenue-event-catalog-BX3g7RUi.d.mts → revenue-event-catalog-JpJcyK1E.d.mts} +198 -2
- package/dist/{settlement.repository-DHIPx5S4.mjs → settlement.repository-Ba2U17zY.mjs} +559 -17
- package/dist/shared/index.d.mts +1 -1
- package/dist/shared/index.mjs +2 -2
- package/dist/{subscription.enums-tfoAgsTv.mjs → subscription.enums-DoIr56O6.mjs} +1 -40
- package/dist/{transaction.enums-u4MshXcL.d.mts → subscription.enums-k24kLpF7.d.mts} +1 -36
- package/dist/validators/index.d.mts +158 -2
- package/dist/validators/index.mjs +95 -2
- package/package.json +7 -7
- package/dist/registry-DhFMsSn5.mjs +0 -150
- package/dist/registry-SvIGPAx_.d.mts +0 -143
- /package/dist/{audit-B39B0Sdq.mjs → audit-Ba2XB2C4.mjs} +0 -0
- /package/dist/{audit-DZ0eTr9g.d.mts → audit-DRKuLBFO.d.mts} +0 -0
- /package/dist/{context-DRqSeTPM.d.mts → context-pjP1QeE3.d.mts} +0 -0
- /package/dist/{escrow.schema-BBv9oVEW.mjs → escrow.schema-C-b41z_G.mjs} +0 -0
- /package/dist/{monetization.enums-BtiU3t8o.mjs → monetization.enums-B9HBOecd.mjs} +0 -0
- /package/dist/{monetization.enums-D2xbxXJM.d.mts → monetization.enums-DzAI4sT7.d.mts} +0 -0
- /package/dist/{splits-BAfY-a9P.mjs → splits-D8XkNWgX.mjs} +0 -0
|
@@ -1,19 +1,50 @@
|
|
|
1
|
-
import { t as RevenueContext } from "./context-
|
|
2
|
-
import { t as RevenueBridges } from "./revenue-bridges-
|
|
3
|
-
import {
|
|
1
|
+
import { t as RevenueContext } from "./context-pjP1QeE3.mjs";
|
|
2
|
+
import { t as RevenueBridges } from "./revenue-bridges-BtkWFsJu.mjs";
|
|
3
|
+
import { u as TransactionKindValue } from "./bank-feed.enums-BadqNJTC.mjs";
|
|
4
|
+
import { a as BankFeedProviderRegistry, d as PaymentProvider, o as FetchTransactionsParams, r as BankFeedProvider, t as ProviderRegistry } from "./registry-h8sasoLh.mjs";
|
|
4
5
|
import { RepositoryPluginBundle, RevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
5
6
|
import { PluginType, Repository } from "@classytic/mongokit";
|
|
6
|
-
import { TenantConfig } from "@classytic/
|
|
7
|
+
import { TenantConfig } from "@classytic/repo-core/tenant";
|
|
7
8
|
import mongoose, { Connection, Model, Schema } from "mongoose";
|
|
8
9
|
import { EventTransport } from "@classytic/primitives/events";
|
|
9
10
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
11
|
+
import { BankImportReport, BankImportRowError, BankTransaction } from "@classytic/primitives/bank-transaction";
|
|
12
|
+
import { ApprovalChain } from "@classytic/primitives/approval";
|
|
10
13
|
|
|
11
14
|
//#region src/models/transaction.schema.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Counterparty on a bank-feed entry. Untyped Mixed at the Mongoose level
|
|
17
|
+
* (banks populate different fields), but typed here so consumers and
|
|
18
|
+
* validators can introspect.
|
|
19
|
+
*/
|
|
20
|
+
interface TransactionCounterparty {
|
|
21
|
+
name?: string;
|
|
22
|
+
identifier?: string;
|
|
23
|
+
iban?: string;
|
|
24
|
+
accountNumber?: string;
|
|
25
|
+
bic?: string;
|
|
26
|
+
routingNumber?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Polymorphic ledger journal-entry reference. String-typed (PACKAGE_RULES
|
|
30
|
+
* §7) so it works for ledger documents stored in another connection,
|
|
31
|
+
* Postgres ledgers, or external accounting systems (QBO Journal IDs).
|
|
32
|
+
*/
|
|
33
|
+
interface JournalEntryRef {
|
|
34
|
+
type: string;
|
|
35
|
+
id: string;
|
|
36
|
+
}
|
|
12
37
|
interface TransactionDocument {
|
|
13
38
|
_id: mongoose.Types.ObjectId;
|
|
14
39
|
publicId: string;
|
|
15
40
|
organizationId?: string;
|
|
16
41
|
customerId?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Selects the state machine that governs this row's `status` field.
|
|
44
|
+
* Defaults to `'payment_flow'` so existing data reads identically.
|
|
45
|
+
* See `core/state-machines.ts:smFor()`.
|
|
46
|
+
*/
|
|
47
|
+
kind: TransactionKindValue;
|
|
17
48
|
type: string;
|
|
18
49
|
flow: 'inflow' | 'outflow';
|
|
19
50
|
tags: string[];
|
|
@@ -27,8 +58,32 @@ interface TransactionDocument {
|
|
|
27
58
|
rate?: number;
|
|
28
59
|
isInclusive?: boolean;
|
|
29
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Multi-currency reconciliation (3.0). When the bank deposit clears
|
|
63
|
+
* in a currency different from the originating charge, store the
|
|
64
|
+
* other side here. Cross-currency `findMatchCandidates` reads these
|
|
65
|
+
* to compare same-currency-equivalent amounts.
|
|
66
|
+
*/
|
|
67
|
+
fxRate?: number;
|
|
68
|
+
originalAmount?: number;
|
|
69
|
+
originalCurrency?: string;
|
|
30
70
|
method: string;
|
|
31
71
|
status: string;
|
|
72
|
+
/**
|
|
73
|
+
* Optional embedded approval chain — P7. Hosts that gate manual /
|
|
74
|
+
* non-gateway transactions on a maker-checker review attach a chain via
|
|
75
|
+
* `createChain()` from `@classytic/primitives/approval`; the host's
|
|
76
|
+
* approval action checks `isApproved(doc.approvals)` before flipping
|
|
77
|
+
* status to `succeeded`. Auto-gateway transactions (Stripe, SSLCommerz,
|
|
78
|
+
* etc.) bypass this entirely — synchronous gateway success is the gate.
|
|
79
|
+
*
|
|
80
|
+
* Use cases:
|
|
81
|
+
* - Manual cash receipts (front desk → bookkeeper verify)
|
|
82
|
+
* - Manual bank transfers (supplier-paid → finance verify)
|
|
83
|
+
* - Cheque deposits (queued until cleared)
|
|
84
|
+
* - **Refunds especially** — the audit-defining moment
|
|
85
|
+
*/
|
|
86
|
+
approvals?: ApprovalChain;
|
|
32
87
|
gateway?: {
|
|
33
88
|
type: string;
|
|
34
89
|
sessionId?: string;
|
|
@@ -77,6 +132,59 @@ interface TransactionDocument {
|
|
|
77
132
|
}>;
|
|
78
133
|
metadata?: Record<string, unknown>;
|
|
79
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* Vendor-stable id from the upstream feed (FITID, NtryRef, qbo Id,
|
|
137
|
+
* Plaid transaction_id). Used to enforce idempotent re-import via the
|
|
138
|
+
* `(orgId, bankAccountId, externalId)` partial unique index.
|
|
139
|
+
*
|
|
140
|
+
* Distinct from `idempotencyKey` (host-chosen, request-scoped). See
|
|
141
|
+
* `@classytic/primitives/bank-transaction` and PACKAGE_RULES §8.
|
|
142
|
+
*/
|
|
143
|
+
externalId?: string;
|
|
144
|
+
/** When the bank booked the entry. */
|
|
145
|
+
postedDate?: Date;
|
|
146
|
+
/** When funds clear / become available. */
|
|
147
|
+
valueDate?: Date;
|
|
148
|
+
/** Free-text bank description. */
|
|
149
|
+
description?: string;
|
|
150
|
+
counterparty?: TransactionCounterparty;
|
|
151
|
+
/** Check number, payment reference, end-to-end ID. */
|
|
152
|
+
reference?: string;
|
|
153
|
+
/** Running balance on the account after this entry, if the format provides it. */
|
|
154
|
+
balanceAfter?: number;
|
|
155
|
+
/** Bank's own category (rare in OFX, common in Plaid / Mint exports). */
|
|
156
|
+
vendorCategory?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Polymorphic external ref to the bank account this row belongs to.
|
|
159
|
+
* String per PACKAGE_RULES §7 — accepts ObjectId hex, UUID, external
|
|
160
|
+
* IDs (Plaid `account_id`, QBO Account Id). Distinct from
|
|
161
|
+
* `customerId`; the `bankAccount` resource lives on the host side.
|
|
162
|
+
*/
|
|
163
|
+
bankAccountId?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Provenance — which feed produced this row. One of the values from
|
|
166
|
+
* `BANK_FEED_SOURCE` (`'ofx'`, `'plaid'`, `'qbo'`, …). Drives admin UI
|
|
167
|
+
* filtering and duplicate-detection rules.
|
|
168
|
+
*/
|
|
169
|
+
source?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Bidirectional link to the journal entry that posted this row to the
|
|
172
|
+
* GL. Stamped by `journalize()` after the host's LedgerBridge confirms
|
|
173
|
+
* the JE was created. Polymorphic — `type` names the foreign model
|
|
174
|
+
* (`'JournalEntry'`, `'QboJournalEntry'`, …).
|
|
175
|
+
*/
|
|
176
|
+
journalEntryRef?: JournalEntryRef;
|
|
177
|
+
/**
|
|
178
|
+
* Operator-supplied mapping from bank line → GL accounts. Stored at
|
|
179
|
+
* match time so re-running the journalize step is deterministic.
|
|
180
|
+
*/
|
|
181
|
+
matching?: {
|
|
182
|
+
debitAccount?: string;
|
|
183
|
+
creditAccount?: string;
|
|
184
|
+
notes?: string;
|
|
185
|
+
matchedAt?: Date;
|
|
186
|
+
matchedBy?: string;
|
|
187
|
+
};
|
|
80
188
|
sourceId?: string;
|
|
81
189
|
sourceModel?: string;
|
|
82
190
|
relatedTransactionId?: mongoose.Types.ObjectId;
|
|
@@ -121,6 +229,19 @@ interface SubscriptionDocument {
|
|
|
121
229
|
canceledAt?: Date;
|
|
122
230
|
cancelAt?: Date;
|
|
123
231
|
cancellationReason?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Optional embedded approval chain — P7. Hosts that gate high-value
|
|
234
|
+
* subscription transitions on a maker-checker review attach a chain via
|
|
235
|
+
* `createChain()` from `@classytic/primitives/approval`; the host's
|
|
236
|
+
* approval action checks `isApproved(doc.approvals)` before applying
|
|
237
|
+
* the change. Routine renewals/auto-pause flows leave it undefined.
|
|
238
|
+
*
|
|
239
|
+
* Use cases:
|
|
240
|
+
* - Cancel-with-refund (manager sign-off before issuing credit)
|
|
241
|
+
* - Plan change with credit note (finance verifies proration)
|
|
242
|
+
* - Manual reactivation after dunning failure
|
|
243
|
+
*/
|
|
244
|
+
approvals?: ApprovalChain;
|
|
124
245
|
renewalTransactionId?: mongoose.Types.ObjectId;
|
|
125
246
|
renewalCount: number;
|
|
126
247
|
metadata?: Record<string, unknown>;
|
|
@@ -138,6 +259,19 @@ interface SettlementDocument {
|
|
|
138
259
|
recipientType: string;
|
|
139
260
|
type: string;
|
|
140
261
|
status: string;
|
|
262
|
+
/**
|
|
263
|
+
* Optional embedded approval chain — P7. Hosts that gate payout release
|
|
264
|
+
* on a maker-checker review attach a chain via `createChain()` from
|
|
265
|
+
* `@classytic/primitives/approval`; the host's approval action checks
|
|
266
|
+
* `isApproved(doc.approvals)` before transitioning the settlement to
|
|
267
|
+
* `processed`/`completed`. Auto-disbursement flows leave it undefined.
|
|
268
|
+
*
|
|
269
|
+
* Use cases:
|
|
270
|
+
* - Vendor payout sign-off (finance verifies before funds release)
|
|
271
|
+
* - High-value mobile-wallet / crypto disbursement review
|
|
272
|
+
* - Manual bank-transfer payouts to recipients
|
|
273
|
+
*/
|
|
274
|
+
approvals?: ApprovalChain;
|
|
141
275
|
payoutMethod: string;
|
|
142
276
|
amount: number;
|
|
143
277
|
currency: string;
|
|
@@ -203,6 +337,12 @@ interface TransactionRepoDeps {
|
|
|
203
337
|
*/
|
|
204
338
|
outbox?: OutboxStore | undefined;
|
|
205
339
|
providers: ProviderRegistry;
|
|
340
|
+
/**
|
|
341
|
+
* Bank-feed provider registry (3.0). Optional — when omitted, the
|
|
342
|
+
* `drainSync` and `parseAndImport` verbs throw on use. The host typically
|
|
343
|
+
* wires Plaid / fin-io / a custom CSV provider here.
|
|
344
|
+
*/
|
|
345
|
+
bankFeedProviders?: BankFeedProviderRegistry | undefined;
|
|
206
346
|
bridges: RevenueBridges;
|
|
207
347
|
commission?: CommissionConfig;
|
|
208
348
|
defaultCurrency: string;
|
|
@@ -210,15 +350,6 @@ interface TransactionRepoDeps {
|
|
|
210
350
|
error(...args: unknown[]): void;
|
|
211
351
|
} | undefined;
|
|
212
352
|
}
|
|
213
|
-
/**
|
|
214
|
-
* TransactionRepository — extends mongokit Repository.
|
|
215
|
-
*
|
|
216
|
-
* CRUD inherited: getAll, getById, getByQuery, create, update, delete, count, exists.
|
|
217
|
-
* Domain verbs: createPaymentIntent, verify, refund, handleWebhook, hold, release, split.
|
|
218
|
-
*
|
|
219
|
-
* All domain verbs return raw mongokit docs — no custom envelopes.
|
|
220
|
-
* Composite results (refund creates a new doc) are stored in metadata on the primary doc.
|
|
221
|
-
*/
|
|
222
353
|
declare class TransactionRepository extends Repository<TransactionDocument> {
|
|
223
354
|
private deps;
|
|
224
355
|
constructor(model: Model<TransactionDocument>, plugins?: PluginType[]);
|
|
@@ -326,6 +457,223 @@ declare class TransactionRepository extends Repository<TransactionDocument> {
|
|
|
326
457
|
recipientType: string;
|
|
327
458
|
rate: number;
|
|
328
459
|
}>, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
460
|
+
/**
|
|
461
|
+
* Idempotent bulk import of bank-feed rows.
|
|
462
|
+
*
|
|
463
|
+
* Each row is upserted by `(orgId, bankAccountId, externalId)` — the
|
|
464
|
+
* partial unique index declared in `create-models.ts`. Re-running the
|
|
465
|
+
* same Plaid sync, OFX upload, or QBO CDC drain produces zero new
|
|
466
|
+
* inserts on the second call (modified counts may rise as
|
|
467
|
+
* descriptions/categories evolve upstream).
|
|
468
|
+
*
|
|
469
|
+
* Signed bank `amount` is normalized into the (`amount` >= 0, `flow`)
|
|
470
|
+
* shape revenue uses internally so downstream queries (`flow:
|
|
471
|
+
* 'inflow'`) work uniformly across kinds.
|
|
472
|
+
*
|
|
473
|
+
* Emits one `revenue:transaction.imported` event per **inserted** row
|
|
474
|
+
* (not per row in `rows` — re-imports do not re-fire). Hosts wanting
|
|
475
|
+
* batch-level signal subscribe to the per-doc events and aggregate.
|
|
476
|
+
*
|
|
477
|
+
* Per-row failures (validation, hash collisions on a non-unique
|
|
478
|
+
* `externalId`) collect into `errors[]` instead of aborting the whole
|
|
479
|
+
* batch — the typical Plaid drain pulls thousands of rows; one bad
|
|
480
|
+
* row should not block the rest.
|
|
481
|
+
*
|
|
482
|
+
* @param rows Canonical bank transactions, structurally compatible
|
|
483
|
+
* with `@classytic/fin-io` parsers' output.
|
|
484
|
+
* @param opts `bankAccountId` (required, polymorphic ID) and
|
|
485
|
+
* `source` (provenance — `'plaid'`, `'ofx'`, …).
|
|
486
|
+
*/
|
|
487
|
+
import(rows: BankTransaction[], opts: {
|
|
488
|
+
bankAccountId: string;
|
|
489
|
+
source: string;
|
|
490
|
+
method?: string;
|
|
491
|
+
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
492
|
+
/**
|
|
493
|
+
* Drain a bank-feed provider into the collection.
|
|
494
|
+
*
|
|
495
|
+
* Pulls pages from `provider.fetchTransactions()` (Plaid cursor, QBO
|
|
496
|
+
* CDC) and feeds each batch through `import()`. Yields the running
|
|
497
|
+
* report so a host cron can stream-progress-report to logs / metrics.
|
|
498
|
+
*
|
|
499
|
+
* Stops when the provider returns no new rows AND no removals AND no
|
|
500
|
+
* `nextCursor`. Caller is responsible for persisting the final cursor
|
|
501
|
+
* in their own checkpoint table — `result.nextCursor` is returned so
|
|
502
|
+
* the host can write it after a successful drain.
|
|
503
|
+
*
|
|
504
|
+
* Plaid `removed[]` rows (and any provider that retracts entries) are
|
|
505
|
+
* routed through `removeByFeed` so the host's LedgerBridge can void
|
|
506
|
+
* any JE that was already posted.
|
|
507
|
+
*/
|
|
508
|
+
drainSync(providerName: string, params: FetchTransactionsParams & {
|
|
509
|
+
bankAccountId: string;
|
|
510
|
+
}, ctx?: RevenueContext): Promise<{
|
|
511
|
+
totalImported: number;
|
|
512
|
+
totalUpdated: number;
|
|
513
|
+
totalRemoved: number;
|
|
514
|
+
nextCursor?: string;
|
|
515
|
+
errors: BankImportRowError[];
|
|
516
|
+
}>;
|
|
517
|
+
/**
|
|
518
|
+
* Parse an upload (OFX / CAMT.053 / MT940 / CSV) via a registered
|
|
519
|
+
* bank-feed provider, then `import()` the result.
|
|
520
|
+
*
|
|
521
|
+
* Convenience over manually calling `provider.parseUpload()` and
|
|
522
|
+
* threading the canonical rows into `import()` — the file-upload
|
|
523
|
+
* route handler is one line.
|
|
524
|
+
*/
|
|
525
|
+
parseAndImport(providerName: string, upload: {
|
|
526
|
+
buffer: Buffer | string | Uint8Array;
|
|
527
|
+
format?: string;
|
|
528
|
+
bankAccountId: string;
|
|
529
|
+
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
530
|
+
/**
|
|
531
|
+
* Hand-keyed entry — treasurer logs a cash deposit, owner injects
|
|
532
|
+
* capital, refund correction. Created in `pending` (manual SM); host
|
|
533
|
+
* proceeds with `match()` → `journalize()` to post it to the ledger.
|
|
534
|
+
*
|
|
535
|
+
* `kind: 'manual'` is enforced — calls passing other kinds throw.
|
|
536
|
+
*/
|
|
537
|
+
createManual(data: {
|
|
538
|
+
amount: number;
|
|
539
|
+
currency: string;
|
|
540
|
+
flow: 'inflow' | 'outflow';
|
|
541
|
+
type: string;
|
|
542
|
+
description?: string;
|
|
543
|
+
counterparty?: TransactionDocument['counterparty'];
|
|
544
|
+
reference?: string;
|
|
545
|
+
postedDate?: Date;
|
|
546
|
+
valueDate?: Date;
|
|
547
|
+
bankAccountId?: string;
|
|
548
|
+
sourceId?: string;
|
|
549
|
+
sourceModel?: string;
|
|
550
|
+
metadata?: Record<string, unknown>;
|
|
551
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
552
|
+
/**
|
|
553
|
+
* Match a bank-feed / manual transaction to GL accounts, optionally
|
|
554
|
+
* cross-linking to an upstream payment-flow transaction.
|
|
555
|
+
*
|
|
556
|
+
* Atomic state CAS via `claim()` — the `where: { kind: { $in: [...] } }`
|
|
557
|
+
* predicate prevents a payment-flow row from being matched through this
|
|
558
|
+
* verb. Multi-source `from` (`['imported', 'matched']`) supports
|
|
559
|
+
* re-match after `unmatch()` (`matched → imported → matched`) without
|
|
560
|
+
* losing the prior mapping if the host wants to overwrite it.
|
|
561
|
+
*
|
|
562
|
+
* After a successful claim, `LedgerBridge.onTransactionMatched` runs
|
|
563
|
+
* — the canonical implementation creates a journal entry and chains
|
|
564
|
+
* `journalize()` to record the JE ref. The bridge call is OUTSIDE the
|
|
565
|
+
* claim's CAS window because JE posting is a side effect that may
|
|
566
|
+
* take seconds (cross-process call to ledger).
|
|
567
|
+
*/
|
|
568
|
+
match(id: string, data: {
|
|
569
|
+
mapping: {
|
|
570
|
+
debitAccount?: string;
|
|
571
|
+
creditAccount?: string;
|
|
572
|
+
notes?: string;
|
|
573
|
+
};
|
|
574
|
+
relatedTransactionId?: string;
|
|
575
|
+
matchedBy?: string;
|
|
576
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
577
|
+
/**
|
|
578
|
+
* Revert a matched transaction back to `imported`. Clears the
|
|
579
|
+
* `matching` block and `relatedTransactionId`. Notifies the
|
|
580
|
+
* LedgerBridge (which typically voids the journal entry) AFTER the
|
|
581
|
+
* state CAS lands.
|
|
582
|
+
*
|
|
583
|
+
* Only legal for `kind: 'bank_feed'` — manual entries don't allow
|
|
584
|
+
* un-match (the manual SM has no `matched → pending` edge).
|
|
585
|
+
*/
|
|
586
|
+
unmatch(id: string, options?: {
|
|
587
|
+
unmatchedBy?: string;
|
|
588
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
589
|
+
/**
|
|
590
|
+
* Stamp the journal entry reference and transition `matched →
|
|
591
|
+
* journalized`. Typical caller is the `LedgerBridge.onTransactionMatched`
|
|
592
|
+
* implementation — after creating a JE, it calls this verb so the row
|
|
593
|
+
* carries the back-reference.
|
|
594
|
+
*/
|
|
595
|
+
journalize(id: string, data: {
|
|
596
|
+
journalEntryRef: {
|
|
597
|
+
type: string;
|
|
598
|
+
id: string;
|
|
599
|
+
};
|
|
600
|
+
journalizedBy?: string;
|
|
601
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
602
|
+
/**
|
|
603
|
+
* Operator skip — marks an imported / matched / pending row as
|
|
604
|
+
* rejected (terminal). Use cases: duplicate of an already-imported
|
|
605
|
+
* row, non-cash entry the host doesn't want in the ledger, manual
|
|
606
|
+
* correction overrides.
|
|
607
|
+
*
|
|
608
|
+
* `relatedTransactionId` is preserved; reversal is the host's call.
|
|
609
|
+
*/
|
|
610
|
+
reject(id: string, data: {
|
|
611
|
+
reason: string;
|
|
612
|
+
rejectedBy?: string;
|
|
613
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
614
|
+
/**
|
|
615
|
+
* Soft-delete bank-feed rows that the upstream feed has retracted
|
|
616
|
+
* (Plaid `removed[]`, OFX correction).
|
|
617
|
+
*
|
|
618
|
+
* Each row is matched by `(orgId, bankAccountId, externalId)`; rows
|
|
619
|
+
* already journalized are NOT silently kept — they're surfaced in
|
|
620
|
+
* `retainedJournalized` so the caller can surface them in the UI
|
|
621
|
+
* ("the feed retracted these N rows but they're posted; reverse
|
|
622
|
+
* manually"). The host's `LedgerBridge` should post a reversing JE
|
|
623
|
+
* for those before any subsequent `delete()` can succeed.
|
|
624
|
+
*
|
|
625
|
+
* @returns `removed` (count soft-deleted), `retainedJournalized`
|
|
626
|
+
* (rows kept because they're already in the GL).
|
|
627
|
+
*/
|
|
628
|
+
removeByFeed(externalIds: string[], opts: {
|
|
629
|
+
bankAccountId: string;
|
|
630
|
+
source: string;
|
|
631
|
+
}, ctx?: RevenueContext): Promise<{
|
|
632
|
+
removed: number;
|
|
633
|
+
retainedJournalized: TransactionDocument[];
|
|
634
|
+
}>;
|
|
635
|
+
/**
|
|
636
|
+
* Find candidate matches for cross-referencing a payment-flow row to
|
|
637
|
+
* its bank deposit (or vice-versa).
|
|
638
|
+
*
|
|
639
|
+
* Heuristic:
|
|
640
|
+
* - same currency by default; cross-currency requires `fxRate` on
|
|
641
|
+
* the candidate row (multi-currency reconciliation).
|
|
642
|
+
* - amount within `amountTolerancePct` (default 1%) — accounts for
|
|
643
|
+
* gateway fees / FX rounding.
|
|
644
|
+
* - posted/created within `toleranceDays` of the target date
|
|
645
|
+
* (default 3 days — covers ACH delays, weekend settlement).
|
|
646
|
+
* - terminal verified states only (`verified` / `completed` for
|
|
647
|
+
* payment_flow, `imported` / `matched` for bank_feed).
|
|
648
|
+
*
|
|
649
|
+
* Returned candidates are unsorted; callers rank by their own
|
|
650
|
+
* confidence model (counterparty fuzzy match, currency identity,
|
|
651
|
+
* exact-amount preference, …).
|
|
652
|
+
*/
|
|
653
|
+
findMatchCandidates(filter: {
|
|
654
|
+
amount: number;
|
|
655
|
+
currency?: string;
|
|
656
|
+
postedDate: Date;
|
|
657
|
+
toleranceDays?: number;
|
|
658
|
+
amountTolerancePct?: number;
|
|
659
|
+
counterpartyName?: string;
|
|
660
|
+
kind?: TransactionKindValue;
|
|
661
|
+
}, ctx?: RevenueContext): Promise<TransactionDocument[]>;
|
|
662
|
+
/**
|
|
663
|
+
* Running balance for a bank account as of `asOf` (defaults to now).
|
|
664
|
+
*
|
|
665
|
+
* Uses mongokit's tenant-scoped read via `findAll` — inflows minus
|
|
666
|
+
* outflows over `kind: 'bank_feed'`, terminal states only. For audit
|
|
667
|
+
* pages where exact-to-the-cent reconciliation is required, prefer
|
|
668
|
+
* the most recent row's `balanceAfter` (banks ship that field on
|
|
669
|
+
* every entry).
|
|
670
|
+
*/
|
|
671
|
+
getRunningBalance(bankAccountId: string, asOf?: Date, ctx?: RevenueContext): Promise<{
|
|
672
|
+
balance: number;
|
|
673
|
+
currency: string | null;
|
|
674
|
+
rowCount: number;
|
|
675
|
+
asOf: Date;
|
|
676
|
+
}>;
|
|
329
677
|
}
|
|
330
678
|
//#endregion
|
|
331
679
|
//#region src/repositories/subscription.repository.d.ts
|
|
@@ -456,6 +804,51 @@ interface RetryConfig {
|
|
|
456
804
|
maxAttempts?: number | undefined;
|
|
457
805
|
baseDelay?: number | undefined;
|
|
458
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* Per-index opt-in for the bank-feed lifecycle. Each flag controls one
|
|
809
|
+
* MongoDB index on the `Transaction` collection. Defaults are tuned for
|
|
810
|
+
* "moderate use" — required indexes are on, dashboard indexes are on,
|
|
811
|
+
* heavy reconciliation indexes are off.
|
|
812
|
+
*
|
|
813
|
+
* Toggle these to match real usage. Index builds are non-trivial on a
|
|
814
|
+
* collection with millions of rows; turning unused ones off saves disk +
|
|
815
|
+
* write amplification.
|
|
816
|
+
*/
|
|
817
|
+
interface BankFeedIndexConfig {
|
|
818
|
+
/**
|
|
819
|
+
* `(orgId, bankAccountId, externalId)` partial unique index. Required
|
|
820
|
+
* for `import()` to enforce idempotent re-import — turning this off
|
|
821
|
+
* means a Plaid drain that retries can produce duplicate rows.
|
|
822
|
+
*
|
|
823
|
+
* Default: `true`. Disable only if you don't use `import()` /
|
|
824
|
+
* `drainSync()` / `parseAndImport()`.
|
|
825
|
+
*/
|
|
826
|
+
idempotentImport?: boolean | undefined;
|
|
827
|
+
/**
|
|
828
|
+
* `(bankAccountId, postedDate -1)` partial — drives the treasurer
|
|
829
|
+
* dashboard ("show me last 30 days of transactions for account X").
|
|
830
|
+
* Cheap; on by default.
|
|
831
|
+
*/
|
|
832
|
+
byAccount?: boolean | undefined;
|
|
833
|
+
/**
|
|
834
|
+
* `(kind, amount, postedDate)` and `(kind, amount, createdAt)` —
|
|
835
|
+
* back the cross-reference query in `findMatchCandidates`. Two
|
|
836
|
+
* compound indexes; turn on when you actively reconcile bank
|
|
837
|
+
* deposits to gateway charges.
|
|
838
|
+
*
|
|
839
|
+
* Default: `false`. Enable when running a recon dashboard.
|
|
840
|
+
*/
|
|
841
|
+
matchCandidates?: boolean | undefined;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Bank-feed module configuration. Pass `true` for defaults, `false` to
|
|
845
|
+
* disable the module (skips the bulkWrite plugin + every bank-feed
|
|
846
|
+
* index), or an object to fine-tune indexes.
|
|
847
|
+
*/
|
|
848
|
+
interface BankFeedModuleConfig {
|
|
849
|
+
enabled?: boolean | undefined;
|
|
850
|
+
indexes?: BankFeedIndexConfig | undefined;
|
|
851
|
+
}
|
|
459
852
|
interface RevenueConfig {
|
|
460
853
|
connection: Connection;
|
|
461
854
|
defaultCurrency: string;
|
|
@@ -534,8 +927,44 @@ interface RevenueConfig {
|
|
|
534
927
|
escrow?: boolean | undefined;
|
|
535
928
|
settlement?: boolean | undefined;
|
|
536
929
|
commission?: CommissionConfig | boolean | undefined;
|
|
930
|
+
/**
|
|
931
|
+
* Bank-feed / accounting-feed module (3.0). Default: enabled (the
|
|
932
|
+
* schema fields are always present so the discriminator works
|
|
933
|
+
* uniformly). Disabling this suppresses the auto-wiring of
|
|
934
|
+
* `bankFeedProviders`, the bulk-write plugin, AND every bank-feed
|
|
935
|
+
* index — set to `false` for hosts that purely use the payment-
|
|
936
|
+
* flow lifecycle and want to omit those costs.
|
|
937
|
+
*
|
|
938
|
+
* Pass an object to fine-tune which bank-feed indexes are built.
|
|
939
|
+
* Examples:
|
|
940
|
+
* `{ bankFeed: { indexes: { matchCandidates: true } } }`
|
|
941
|
+
* — turn on cross-ref indexes for an active recon dashboard.
|
|
942
|
+
* `{ bankFeed: { indexes: { idempotentImport: false, byAccount: false } } }`
|
|
943
|
+
* — host doesn't use `import()` and doesn't need treasurer dashboards.
|
|
944
|
+
*/
|
|
945
|
+
bankFeed?: boolean | BankFeedModuleConfig | undefined;
|
|
537
946
|
} | undefined;
|
|
538
947
|
providers?: Record<string, PaymentProvider> | undefined;
|
|
948
|
+
/**
|
|
949
|
+
* Bank-feed providers — Plaid, fin-io OFX/CAMT/MT940/CSV, QBO/Xero CDC
|
|
950
|
+
* adapters. Wired into `engine.bankFeedProviders` and consumed by
|
|
951
|
+
* `transactionRepository.drainSync()` and `parseAndImport()`.
|
|
952
|
+
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```ts
|
|
955
|
+
* import { PlaidBankFeedProvider } from '@classytic/revenue-plaid';
|
|
956
|
+
* import { FinIoBankFeedProvider } from '@classytic/revenue-fin-io';
|
|
957
|
+
*
|
|
958
|
+
* const engine = await createRevenue({
|
|
959
|
+
* ...,
|
|
960
|
+
* bankFeedProviders: {
|
|
961
|
+
* plaid: new PlaidBankFeedProvider({ clientId, secret }),
|
|
962
|
+
* ofx: new FinIoBankFeedProvider(),
|
|
963
|
+
* },
|
|
964
|
+
* });
|
|
965
|
+
* ```
|
|
966
|
+
*/
|
|
967
|
+
bankFeedProviders?: Record<string, BankFeedProvider> | undefined;
|
|
539
968
|
bridges?: RevenueBridges | undefined;
|
|
540
969
|
repositoryPlugins?: RepositoryPluginBundle | undefined;
|
|
541
970
|
schemaOptions?: RevenueSchemaOptions | undefined;
|
|
@@ -602,10 +1031,18 @@ interface RevenueEngine {
|
|
|
602
1031
|
models: RevenueModels;
|
|
603
1032
|
repositories: RevenueRepositories;
|
|
604
1033
|
providers: ProviderRegistry;
|
|
1034
|
+
/**
|
|
1035
|
+
* Bank-feed providers registry (3.0). Populated when `bankFeed`
|
|
1036
|
+
* module is enabled and `bankFeedProviders` config is non-empty.
|
|
1037
|
+
* Used by `transactionRepository.drainSync()` and
|
|
1038
|
+
* `parseAndImport()`. Hosts can `register` providers at runtime too
|
|
1039
|
+
* (e.g. after the engine boots, to add a per-tenant Plaid client).
|
|
1040
|
+
*/
|
|
1041
|
+
bankFeedProviders: BankFeedProviderRegistry;
|
|
605
1042
|
events: EventTransport;
|
|
606
1043
|
/** Explicitly build all schema-declared indexes. Non-destructive. */
|
|
607
1044
|
syncIndexes(): Promise<void>;
|
|
608
1045
|
destroy(): Promise<void>;
|
|
609
1046
|
}
|
|
610
1047
|
//#endregion
|
|
611
|
-
export {
|
|
1048
|
+
export { RevenueConfig as a, SubscriptionRepository as c, RevenueSchemaOptions as d, SettlementDocument as f, RetryConfig as i, TransactionRepository as l, TransactionDocument as m, BankFeedModuleConfig as n, RevenueEngine as o, SubscriptionDocument as p, CommissionConfig as r, SettlementRepository as s, BankFeedIndexConfig as t, RevenueModels as u };
|
package/dist/enums/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
1
|
+
import { A as SettlementStatus, B as HoldReason, C as isPayoutMethod, D as SETTLEMENT_STATUS_VALUES, E as SETTLEMENT_STATUS, F as isSettlementType, G as RELEASE_REASON_VALUES, H as HoldStatus, I as HOLD_REASON, J as isHoldReason, K as ReleaseReason, L as HOLD_REASON_VALUES, M as SettlementType, N as SettlementTypeValue, O as SETTLEMENT_TYPE, P as isSettlementStatus, R as HOLD_STATUS, S as SplitTypeValue, T as isSplitType, U as HoldStatusValue, V as HoldReasonValue, W as RELEASE_REASON, X as isReleaseReason, Y as isHoldStatus, _ as SPLIT_TYPE, a as SUBSCRIPTION_STATUS, b as SplitStatusValue, c as SubscriptionStatusValue, d as PAYOUT_METHOD, f as PAYOUT_METHOD_VALUES, g as SPLIT_STATUS_VALUES, h as SPLIT_STATUS, i as PlanKeys, j as SettlementStatusValue, k as SETTLEMENT_TYPE_VALUES, l as isPlanKey, m as PayoutMethodValue, n as PLAN_KEY_VALUES, o as SUBSCRIPTION_STATUS_VALUES, p as PayoutMethod, q as ReleaseReasonValue, r as PlanKeyValue, s as SubscriptionStatus, t as PLAN_KEYS, u as isSubscriptionStatus, v as SPLIT_TYPE_VALUES, w as isSplitStatus, x as SplitType, y as SplitStatus, z as HOLD_STATUS_VALUES } from "../subscription.enums-k24kLpF7.mjs";
|
|
2
|
+
import { A as isTransactionFlow, C as TRANSACTION_STATUS, D as TransactionStatus, E as TransactionFlowValue, O as TransactionStatusValue, S as TRANSACTION_FLOW_VALUES, T as TransactionFlow, _ as LIBRARY_CATEGORIES, a as BankFeedSourceValue, b as LibraryCategoryValue, c as TRANSACTION_KIND_VALUES, d as initialStatusFor, f as isBankFeedSource, g as statusesForKind, h as isTransactionKind, i as BANK_FEED_STATUS_VALUES, j as isTransactionStatus, k as isLibraryCategory, l as TransactionKind, m as isStatusValidForKind, n as BANK_FEED_SOURCE_VALUES, o as BankFeedStatusValue, p as isBankFeedStatus, r as BANK_FEED_STATUS, s as TRANSACTION_KIND, t as BANK_FEED_SOURCE, u as TransactionKindValue, v as LIBRARY_CATEGORY_VALUES, w as TRANSACTION_STATUS_VALUES, x as TRANSACTION_FLOW, y as LibraryCategories } from "../bank-feed.enums-BadqNJTC.mjs";
|
|
3
|
+
import { a as isMonetizationType, c as PAYMENT_STATUS, d as PaymentGatewayTypeValue, f as PaymentStatus, h as isPaymentStatus, i as MonetizationTypes, l as PAYMENT_STATUS_VALUES, m as isPaymentGatewayType, n as MONETIZATION_TYPE_VALUES, o as PAYMENT_GATEWAY_TYPE, p as PaymentStatusValue, r as MonetizationTypeValue, s as PAYMENT_GATEWAY_TYPE_VALUES, t as MONETIZATION_TYPES, u as PaymentGatewayType } from "../monetization.enums-DzAI4sT7.mjs";
|
|
4
|
+
export { BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedSourceValue, BankFeedStatusValue, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATUS, HOLD_STATUS_VALUES, HoldReason, HoldReasonValue, HoldStatus, HoldStatusValue, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, LibraryCategories, LibraryCategoryValue, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MonetizationTypeValue, MonetizationTypes, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, PaymentGatewayType, PaymentGatewayTypeValue, PaymentStatus, PaymentStatusValue, PayoutMethod, PayoutMethodValue, PlanKeyValue, PlanKeys, RELEASE_REASON, RELEASE_REASON_VALUES, ReleaseReason, ReleaseReasonValue, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementStatus, SettlementStatusValue, SettlementType, SettlementTypeValue, SplitStatus, SplitStatusValue, SplitType, SplitTypeValue, SubscriptionStatus, SubscriptionStatusValue, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, TransactionFlow, TransactionFlowValue, TransactionKind, TransactionKindValue, TransactionStatus, TransactionStatusValue, initialStatusFor, isBankFeedSource, isBankFeedStatus, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, statusesForKind };
|
package/dist/enums/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND, b as isTransactionFlow, c as isBankFeedSource, d as isTransactionKind, f as statusesForKind, g as TRANSACTION_FLOW_VALUES, h as TRANSACTION_FLOW, i as BANK_FEED_STATUS_VALUES, l as isBankFeedStatus, m as LIBRARY_CATEGORY_VALUES, n as BANK_FEED_SOURCE_VALUES, o as TRANSACTION_KIND_VALUES, p as LIBRARY_CATEGORIES, r as BANK_FEED_STATUS, s as initialStatusFor, t as BANK_FEED_SOURCE, u as isStatusValidForKind, v as TRANSACTION_STATUS_VALUES, x as isTransactionStatus, y as isLibraryCategory } from "../bank-feed.enums-kYTLTTbe.mjs";
|
|
2
|
+
import { A as isReleaseReason, C as HOLD_REASON_VALUES, D as RELEASE_REASON_VALUES, E as RELEASE_REASON, O as isHoldReason, S as HOLD_REASON, T as HOLD_STATUS_VALUES, _ as SETTLEMENT_STATUS_VALUES, a as isPlanKey, b as isSettlementStatus, c as PAYOUT_METHOD_VALUES, d as SPLIT_TYPE, f as SPLIT_TYPE_VALUES, g as SETTLEMENT_STATUS, h as isSplitType, i as SUBSCRIPTION_STATUS_VALUES, k as isHoldStatus, l as SPLIT_STATUS, m as isSplitStatus, n as PLAN_KEY_VALUES, o as isSubscriptionStatus, p as isPayoutMethod, r as SUBSCRIPTION_STATUS, s as PAYOUT_METHOD, t as PLAN_KEYS, u as SPLIT_STATUS_VALUES, v as SETTLEMENT_TYPE, w as HOLD_STATUS, x as isSettlementType, y as SETTLEMENT_TYPE_VALUES } from "../subscription.enums-DoIr56O6.mjs";
|
|
3
|
+
import { a as PAYMENT_GATEWAY_TYPE_VALUES, c as isPaymentGatewayType, i as PAYMENT_GATEWAY_TYPE, l as isPaymentStatus, n as MONETIZATION_TYPE_VALUES, o as PAYMENT_STATUS, r as isMonetizationType, s as PAYMENT_STATUS_VALUES, t as MONETIZATION_TYPES } from "../monetization.enums-B9HBOecd.mjs";
|
|
3
4
|
|
|
4
|
-
export { HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATUS, HOLD_STATUS_VALUES, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, RELEASE_REASON, RELEASE_REASON_VALUES, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isSubscriptionStatus, isTransactionFlow, isTransactionStatus };
|
|
5
|
+
export { BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATUS, HOLD_STATUS_VALUES, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, RELEASE_REASON, RELEASE_REASON_VALUES, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, initialStatusFor, isBankFeedSource, isBankFeedStatus, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, statusesForKind };
|
|
@@ -87,6 +87,28 @@ var PaymentVerificationError = class extends RevenueError {
|
|
|
87
87
|
this.name = "PaymentVerificationError";
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
+
var BankFeedImportError = class extends RevenueError {
|
|
91
|
+
constructor(message, details) {
|
|
92
|
+
super(message, "BANK_FEED_IMPORT_ERROR", details);
|
|
93
|
+
this.name = "BankFeedImportError";
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var WrongTransactionKindError = class extends RevenueError {
|
|
97
|
+
constructor(transactionId, expected, actual) {
|
|
98
|
+
super(`Transaction '${transactionId}' is kind '${actual}', not '${expected}'`, "WRONG_TRANSACTION_KIND", {
|
|
99
|
+
transactionId,
|
|
100
|
+
expected,
|
|
101
|
+
actual
|
|
102
|
+
});
|
|
103
|
+
this.name = "WrongTransactionKindError";
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var BankFeedProviderNotFoundError = class extends RevenueError {
|
|
107
|
+
constructor(providerName) {
|
|
108
|
+
super(`Bank-feed provider '${providerName}' not registered. Use \`engine.bankFeedProviders.register(name, provider)\`.`, "BANK_FEED_PROVIDER_NOT_FOUND", { providerName });
|
|
109
|
+
this.name = "BankFeedProviderNotFoundError";
|
|
110
|
+
}
|
|
111
|
+
};
|
|
90
112
|
|
|
91
113
|
//#endregion
|
|
92
|
-
export {
|
|
114
|
+
export { InvalidStateTransitionError as a, ProviderCapabilityError as c, RevenueError as d, SettlementNotFoundError as f, WrongTransactionKindError as g, ValidationError as h, ConfigurationError as i, ProviderNotFoundError as l, TransactionNotFoundError as m, BankFeedImportError as n, PaymentIntentCreationError as o, SubscriptionNotFoundError as p, BankFeedProviderNotFoundError as r, PaymentVerificationError as s, AlreadyVerifiedError as t, RefundNotSupportedError as u };
|