@classytic/revenue 2.1.3 → 2.2.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/CHANGELOG.md +29 -0
- package/README.md +8 -0
- package/dist/{bank-feed-BlQeq2rK.mjs → bank-feed-ClxNob_I.mjs} +1 -1
- package/dist/core/state-machines.mjs +1 -1
- package/dist/{engine-types-Jctrbasz.d.mts → engine-types-ChFPg3kw.d.mts} +38 -0
- package/dist/{errors-LYYg9wcs.mjs → errors-Bt5NRVMq.mjs} +19 -2
- package/dist/{escrow.schema-C-b41z_G.mjs → escrow.schema-BcKdzrJ7.mjs} +5 -0
- package/dist/{escrow.schema-YuBgjL-I.d.mts → escrow.schema-BdDHuQ8C.d.mts} +83 -23
- package/dist/{event-constants-Dn1TKahe.mjs → event-constants-DM_-A57b.mjs} +7 -0
- package/dist/events/index.d.mts +1 -1
- package/dist/events/index.mjs +2 -2
- package/dist/index.d.mts +27 -5
- package/dist/index.mjs +14 -7
- package/dist/providers/index.mjs +1 -1
- package/dist/repositories/create-repositories.d.mts +1 -1
- package/dist/repositories/create-repositories.mjs +1 -1
- package/dist/{revenue-event-catalog-BvjNVnPd.mjs → revenue-event-catalog-B9aZmNpL.mjs} +90 -2
- package/dist/{revenue-event-catalog-JpJcyK1E.d.mts → revenue-event-catalog-BU_KYN2-.d.mts} +645 -0
- package/dist/{settlement.repository-BAdc9qGl.mjs → settlement.repository-CfvgX3et.mjs} +65 -4
- package/dist/validators/index.d.mts +1 -1
- package/dist/validators/index.mjs +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
4
|
adhering to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## [2.2.0] - 2026-05-26
|
|
7
|
+
|
|
8
|
+
### Added — auth/capture + dispute event coverage
|
|
9
|
+
|
|
10
|
+
Seven new event constants on `REVENUE_EVENTS` aligning with the
|
|
11
|
+
`@classytic/primitives@0.7.1` payment event catalogue:
|
|
12
|
+
`PAYMENT_AUTHORIZED`, `PAYMENT_CAPTURED`, `PAYMENT_AUTH_VOIDED`,
|
|
13
|
+
`PAYMENT_DISPUTED`, `PAYMENT_DISPUTE_WON`, `PAYMENT_DISPUTE_LOST`,
|
|
14
|
+
`PAYMENT_SETTLED`. Catalog payload schemas updated to match.
|
|
15
|
+
|
|
16
|
+
### Added — `RevenueError.httpStatus`
|
|
17
|
+
|
|
18
|
+
`RevenueError` carries an optional `httpStatus` field so Arc / Express
|
|
19
|
+
hosts can map errors to response codes without per-error switch
|
|
20
|
+
statements. Defaults to 500 in the host mapper when unset.
|
|
21
|
+
|
|
22
|
+
### Added — `MethodKindLockedError` (409)
|
|
23
|
+
|
|
24
|
+
New error thrown by `TransactionRepository.backfillMethodKind` when the
|
|
25
|
+
existing doc is not backfill-eligible (methodKind already specific OR
|
|
26
|
+
status no longer `pending`). 409 because the request is well-formed but
|
|
27
|
+
conflicts with current resource state.
|
|
28
|
+
|
|
29
|
+
### Changed — peer bump: `@classytic/primitives` `>=0.7.1`
|
|
30
|
+
|
|
31
|
+
Catalogue now imports `PAYMENT_METHOD_KIND` from
|
|
32
|
+
`@classytic/primitives/payment-method-kind`. Hosts must bump primitives
|
|
33
|
+
to `>=0.7.1`.
|
|
34
|
+
|
|
6
35
|
## [2.1.1] — multi-tenant scope correctness across all repos
|
|
7
36
|
|
|
8
37
|
**Fix.** `SubscriptionRepository` and `SettlementRepository` lifecycle verbs
|
package/README.md
CHANGED
|
@@ -48,6 +48,14 @@ const refundTxn = await revenue.repositories.transaction.refund(
|
|
|
48
48
|
// refundTxn.type → 'refund', refundTxn.flow → 'outflow', refundTxn.amount → 5000
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## Hosted-checkout `methodKind` backfill
|
|
52
|
+
|
|
53
|
+
Every transaction carries a `methodKind: PaymentMethodKind` (`card`, `bank_transfer`, `wallet`, `cash`, `cheque`, `cryptocurrency`, `manual`, `other`). For hosted-checkout flows where the customer picks their method on the gateway's UI (Stripe Checkout, PayPal redirect, Razorpay Checkout), create the PaymentIntent with `methodKind: 'other'` — then call `transactionRepository.backfillMethodKind(transactionId, kind)` from your verification webhook handler once you know the actual choice. The backfill is an atomic CAS — allowed only when the doc still has `methodKind === 'other'` AND `status === 'pending'`; any other transition throws `MethodKindLockedError` (HTTP 409). For the Stripe case, `@classytic/revenue-stripe` exposes `stripePaymentIntentToKind(intent)` so the host doesn't write the mapping table itself.
|
|
54
|
+
|
|
55
|
+
## Bank-feed `import()` requires `methodKind`
|
|
56
|
+
|
|
57
|
+
`TransactionRepository.import()` (and the higher-level `drainSync` / `parseAndImport`) require an explicit `opts.methodKind` — no silent default. Pass `'bank_transfer'` for Plaid/OFX/CAMT/MT940 drains, `'card'` for a Stripe-balance import, `'wallet'` for PayPal exports, `'cryptocurrency'` for exchange CSVs. This forces every feed integration to be intentional about how its rows show up in downstream analytics and accounting reports.
|
|
58
|
+
|
|
51
59
|
## Architecture
|
|
52
60
|
|
|
53
61
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND } from "../bank-feed.enums-kYTLTTbe.mjs";
|
|
2
2
|
import { g as SETTLEMENT_STATUS, l as SPLIT_STATUS, r as SUBSCRIPTION_STATUS, w as HOLD_STATUS } from "../subscription.enums-95othr0i.mjs";
|
|
3
|
-
import { a as InvalidStateTransitionError } from "../errors-
|
|
3
|
+
import { a as InvalidStateTransitionError } from "../errors-Bt5NRVMq.mjs";
|
|
4
4
|
import { defineStateMachine } from "@classytic/primitives/state-machine";
|
|
5
5
|
|
|
6
6
|
//#region src/core/state-machines.ts
|
|
@@ -6,6 +6,7 @@ import { RepositoryPluginBundle, RevenueRepositories } from "./repositories/crea
|
|
|
6
6
|
import { PluginType, Repository } from "@classytic/mongokit";
|
|
7
7
|
import { TenantConfig } from "@classytic/repo-core/tenant";
|
|
8
8
|
import mongoose, { Connection, Model, Schema } from "mongoose";
|
|
9
|
+
import { PaymentMethodKind } from "@classytic/primitives/payment-method-kind";
|
|
9
10
|
import { DomainEvent, EventTransport } from "@classytic/primitives/events";
|
|
10
11
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
11
12
|
import { BankImportReport, BankImportRowError, BankTransaction } from "@classytic/primitives/bank-transaction";
|
|
@@ -68,6 +69,7 @@ interface TransactionDocument {
|
|
|
68
69
|
originalAmount?: number;
|
|
69
70
|
originalCurrency?: string;
|
|
70
71
|
method: string;
|
|
72
|
+
methodKind: PaymentMethodKind;
|
|
71
73
|
status: string;
|
|
72
74
|
/**
|
|
73
75
|
* Optional embedded approval chain — P7. Hosts that gate manual /
|
|
@@ -486,6 +488,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
486
488
|
amount: number;
|
|
487
489
|
currency?: string;
|
|
488
490
|
gateway: string;
|
|
491
|
+
methodKind: PaymentMethodKind;
|
|
489
492
|
paymentData?: Record<string, unknown>;
|
|
490
493
|
metadata?: Record<string, unknown>;
|
|
491
494
|
idempotencyKey?: string;
|
|
@@ -578,6 +581,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
578
581
|
import(rows: BankTransaction[], opts: {
|
|
579
582
|
bankAccountId: string;
|
|
580
583
|
source: string;
|
|
584
|
+
methodKind: PaymentMethodKind;
|
|
581
585
|
method?: string;
|
|
582
586
|
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
583
587
|
/**
|
|
@@ -598,6 +602,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
598
602
|
*/
|
|
599
603
|
drainSync(providerName: string, params: FetchTransactionsParams & {
|
|
600
604
|
bankAccountId: string;
|
|
605
|
+
methodKind: PaymentMethodKind;
|
|
601
606
|
}, ctx?: RevenueContext): Promise<{
|
|
602
607
|
totalImported: number;
|
|
603
608
|
totalUpdated: number;
|
|
@@ -617,6 +622,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
617
622
|
buffer: Buffer | string | Uint8Array;
|
|
618
623
|
format?: string;
|
|
619
624
|
bankAccountId: string;
|
|
625
|
+
methodKind: PaymentMethodKind;
|
|
620
626
|
}, ctx?: RevenueContext): Promise<BankImportReport>;
|
|
621
627
|
/**
|
|
622
628
|
* Hand-keyed entry — treasurer logs a cash deposit, owner injects
|
|
@@ -630,6 +636,7 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
630
636
|
currency: string;
|
|
631
637
|
flow: 'inflow' | 'outflow';
|
|
632
638
|
type: string;
|
|
639
|
+
methodKind: PaymentMethodKind;
|
|
633
640
|
description?: string;
|
|
634
641
|
counterparty?: TransactionDocument['counterparty'];
|
|
635
642
|
reference?: string;
|
|
@@ -640,6 +647,37 @@ declare class TransactionRepository extends RevenueRepositoryBase<TransactionDoc
|
|
|
640
647
|
sourceModel?: string;
|
|
641
648
|
metadata?: Record<string, unknown>;
|
|
642
649
|
}, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
650
|
+
/**
|
|
651
|
+
* Backfill the `methodKind` on a Transaction created with kind
|
|
652
|
+
* unknown — the canonical use case is hosted-checkout (Stripe
|
|
653
|
+
* Checkout, PayPal redirect, Razorpay Checkout) where the customer
|
|
654
|
+
* picks their payment method on the gateway's UI, AFTER the host has
|
|
655
|
+
* already created the PaymentIntent + Transaction with
|
|
656
|
+
* `methodKind: 'other'`.
|
|
657
|
+
*
|
|
658
|
+
* Call this from your verification / webhook handler once you know
|
|
659
|
+
* the customer's actual choice — e.g. inside
|
|
660
|
+
* `payment_intent.succeeded`:
|
|
661
|
+
*
|
|
662
|
+
* ```ts
|
|
663
|
+
* await transactionRepository.backfillMethodKind(
|
|
664
|
+
* tx._id,
|
|
665
|
+
* stripePaymentIntentToKind(event.data.object),
|
|
666
|
+
* ctx,
|
|
667
|
+
* );
|
|
668
|
+
* ```
|
|
669
|
+
*
|
|
670
|
+
* **Guard rule.** Atomic CAS — succeeds only when the doc has
|
|
671
|
+
* `methodKind === 'other'` AND `status === 'pending'`. Any other
|
|
672
|
+
* combination throws `MethodKindLockedError` (HTTP 409): once a
|
|
673
|
+
* transaction has a specific kind (or has settled past pending),
|
|
674
|
+
* silently overwriting it would corrupt downstream analytics and
|
|
675
|
+
* accounting reports.
|
|
676
|
+
*
|
|
677
|
+
* Emits `revenue:transaction.updated` with `changedFields:
|
|
678
|
+
* ['methodKind']` so subscribers can re-bucket the row.
|
|
679
|
+
*/
|
|
680
|
+
backfillMethodKind(transactionId: string, methodKind: PaymentMethodKind, ctx?: RevenueContext): Promise<TransactionDocument>;
|
|
643
681
|
/**
|
|
644
682
|
* Match a bank-feed / manual transaction to GL accounts, optionally
|
|
645
683
|
* cross-linking to an upstream payment-flow transaction.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
//#region src/core/errors.ts
|
|
2
2
|
var RevenueError = class extends Error {
|
|
3
|
-
constructor(message, code, details) {
|
|
3
|
+
constructor(message, code, details, httpStatus) {
|
|
4
4
|
super(message);
|
|
5
5
|
this.code = code;
|
|
6
6
|
this.details = details;
|
|
7
|
+
this.httpStatus = httpStatus;
|
|
7
8
|
this.name = "RevenueError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
@@ -103,6 +104,22 @@ var WrongTransactionKindError = class extends RevenueError {
|
|
|
103
104
|
this.name = "WrongTransactionKindError";
|
|
104
105
|
}
|
|
105
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Thrown by `TransactionRepository.backfillMethodKind` when the existing
|
|
109
|
+
* doc is NOT eligible for backfill (methodKind already specific, or
|
|
110
|
+
* status no longer `'pending'`). 409 because the request is well-formed
|
|
111
|
+
* but conflicts with the current resource state.
|
|
112
|
+
*/
|
|
113
|
+
var MethodKindLockedError = class extends RevenueError {
|
|
114
|
+
constructor(transactionId, currentMethodKind, currentStatus) {
|
|
115
|
+
super(`Transaction '${transactionId}' methodKind is locked (current: '${currentMethodKind}', status: '${currentStatus}'). Backfill is allowed only when methodKind === 'other' AND status === 'pending'.`, "METHOD_KIND_LOCKED", {
|
|
116
|
+
transactionId,
|
|
117
|
+
currentMethodKind,
|
|
118
|
+
currentStatus
|
|
119
|
+
}, 409);
|
|
120
|
+
this.name = "MethodKindLockedError";
|
|
121
|
+
}
|
|
122
|
+
};
|
|
106
123
|
var BankFeedProviderNotFoundError = class extends RevenueError {
|
|
107
124
|
constructor(providerName) {
|
|
108
125
|
super(`Bank-feed provider '${providerName}' not registered. Use \`engine.bankFeedProviders.register(name, provider)\`.`, "BANK_FEED_PROVIDER_NOT_FOUND", { providerName });
|
|
@@ -111,4 +128,4 @@ var BankFeedProviderNotFoundError = class extends RevenueError {
|
|
|
111
128
|
};
|
|
112
129
|
|
|
113
130
|
//#endregion
|
|
114
|
-
export { InvalidStateTransitionError as a,
|
|
131
|
+
export { WrongTransactionKindError as _, InvalidStateTransitionError as a, PaymentVerificationError as c, RefundNotSupportedError as d, RevenueError as f, ValidationError as g, TransactionNotFoundError as h, ConfigurationError as i, ProviderCapabilityError as l, SubscriptionNotFoundError as m, BankFeedImportError as n, MethodKindLockedError as o, SettlementNotFoundError as p, BankFeedProviderNotFoundError as r, PaymentIntentCreationError as s, AlreadyVerifiedError as t, ProviderNotFoundError as u };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { PAYMENT_METHOD_KIND } from "@classytic/primitives/payment-method-kind";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
//#region src/validators/transaction.schema.ts
|
|
5
|
+
const PAYMENT_METHOD_KIND_VALUES$1 = Object.values(PAYMENT_METHOD_KIND);
|
|
4
6
|
const commissionSchema = z.object({
|
|
5
7
|
rate: z.number().min(0).max(1),
|
|
6
8
|
grossAmount: z.number().int(),
|
|
@@ -78,6 +80,7 @@ const transactionBaseSchema = z.object({
|
|
|
78
80
|
isInclusive: z.boolean().optional()
|
|
79
81
|
}).optional(),
|
|
80
82
|
method: z.string(),
|
|
83
|
+
methodKind: z.enum(PAYMENT_METHOD_KIND_VALUES$1),
|
|
81
84
|
status: z.string().default("pending"),
|
|
82
85
|
gateway: gatewaySchema.optional(),
|
|
83
86
|
paymentDetails: z.record(z.string(), z.unknown()).optional(),
|
|
@@ -265,10 +268,12 @@ const settlementListFilterSchema = z.object({
|
|
|
265
268
|
|
|
266
269
|
//#endregion
|
|
267
270
|
//#region src/validators/payment.schema.ts
|
|
271
|
+
const PAYMENT_METHOD_KIND_VALUES = Object.values(PAYMENT_METHOD_KIND);
|
|
268
272
|
const paymentIntentSchema = z.object({
|
|
269
273
|
amount: z.number().int().min(1),
|
|
270
274
|
currency: z.string().min(3).max(3),
|
|
271
275
|
gateway: z.string(),
|
|
276
|
+
methodKind: z.enum(PAYMENT_METHOD_KIND_VALUES),
|
|
272
277
|
customerId: z.string().optional(),
|
|
273
278
|
sourceId: z.string().optional(),
|
|
274
279
|
sourceModel: z.string().optional(),
|
|
@@ -26,6 +26,21 @@ declare const transactionBaseSchema: z.ZodObject<{
|
|
|
26
26
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
27
27
|
}, z.core.$strip>>;
|
|
28
28
|
method: z.ZodString;
|
|
29
|
+
methodKind: z.ZodEnum<{
|
|
30
|
+
manual: "manual";
|
|
31
|
+
bank_transfer: "bank_transfer";
|
|
32
|
+
cryptocurrency: "cryptocurrency";
|
|
33
|
+
card: "card";
|
|
34
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
35
|
+
direct_debit: "direct_debit";
|
|
36
|
+
wallet: "wallet";
|
|
37
|
+
mobile_money: "mobile_money";
|
|
38
|
+
bnpl: "bnpl";
|
|
39
|
+
gift_card: "gift_card";
|
|
40
|
+
cash: "cash";
|
|
41
|
+
cheque: "cheque";
|
|
42
|
+
other: "other";
|
|
43
|
+
}>;
|
|
29
44
|
status: z.ZodDefault<z.ZodString>;
|
|
30
45
|
gateway: z.ZodOptional<z.ZodObject<{
|
|
31
46
|
type: z.ZodString;
|
|
@@ -95,30 +110,16 @@ declare const transactionBaseSchema: z.ZodObject<{
|
|
|
95
110
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
111
|
}, z.core.$strip>;
|
|
97
112
|
declare const transactionCreateSchema: z.ZodObject<{
|
|
113
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
115
|
type: z.ZodString;
|
|
99
|
-
amount: z.ZodNumber;
|
|
100
|
-
currency: z.ZodString;
|
|
101
|
-
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
102
116
|
flow: z.ZodEnum<{
|
|
103
117
|
inflow: "inflow";
|
|
104
118
|
outflow: "outflow";
|
|
105
119
|
}>;
|
|
106
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
107
|
-
status: z.ZodDefault<z.ZodString>;
|
|
108
|
-
gateway: z.ZodOptional<z.ZodObject<{
|
|
109
|
-
type: z.ZodString;
|
|
110
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
111
|
-
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
112
|
-
chargeId: z.ZodOptional<z.ZodString>;
|
|
113
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
114
|
-
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
|
-
}, z.core.$strip>>;
|
|
116
|
-
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
118
|
-
sourceModel: z.ZodOptional<z.ZodString>;
|
|
119
|
-
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
120
|
-
organizationId: z.ZodOptional<z.ZodString>;
|
|
121
120
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
121
|
+
amount: z.ZodNumber;
|
|
122
|
+
currency: z.ZodString;
|
|
122
123
|
fee: z.ZodDefault<z.ZodNumber>;
|
|
123
124
|
tax: z.ZodDefault<z.ZodNumber>;
|
|
124
125
|
net: z.ZodDefault<z.ZodNumber>;
|
|
@@ -132,6 +133,31 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
132
133
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
133
134
|
}, z.core.$strip>>;
|
|
134
135
|
method: z.ZodString;
|
|
136
|
+
methodKind: z.ZodEnum<{
|
|
137
|
+
manual: "manual";
|
|
138
|
+
bank_transfer: "bank_transfer";
|
|
139
|
+
cryptocurrency: "cryptocurrency";
|
|
140
|
+
card: "card";
|
|
141
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
142
|
+
direct_debit: "direct_debit";
|
|
143
|
+
wallet: "wallet";
|
|
144
|
+
mobile_money: "mobile_money";
|
|
145
|
+
bnpl: "bnpl";
|
|
146
|
+
gift_card: "gift_card";
|
|
147
|
+
cash: "cash";
|
|
148
|
+
cheque: "cheque";
|
|
149
|
+
other: "other";
|
|
150
|
+
}>;
|
|
151
|
+
status: z.ZodDefault<z.ZodString>;
|
|
152
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
153
|
+
gateway: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
type: z.ZodString;
|
|
155
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
157
|
+
chargeId: z.ZodOptional<z.ZodString>;
|
|
158
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
159
|
+
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
160
|
+
}, z.core.$strip>>;
|
|
135
161
|
paymentDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
162
|
commission: z.ZodOptional<z.ZodObject<{
|
|
137
163
|
rate: z.ZodNumber;
|
|
@@ -172,6 +198,10 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
172
198
|
}, z.core.$strip>>>;
|
|
173
199
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
174
200
|
}, z.core.$strip>>;
|
|
201
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
202
|
+
sourceModel: z.ZodOptional<z.ZodString>;
|
|
203
|
+
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
175
205
|
}, z.core.$strip>;
|
|
176
206
|
declare const transactionUpdateSchema: z.ZodObject<{
|
|
177
207
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -198,6 +228,21 @@ declare const transactionUpdateSchema: z.ZodObject<{
|
|
|
198
228
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
199
229
|
}, z.core.$strip>>>;
|
|
200
230
|
method: z.ZodOptional<z.ZodString>;
|
|
231
|
+
methodKind: z.ZodOptional<z.ZodEnum<{
|
|
232
|
+
manual: "manual";
|
|
233
|
+
bank_transfer: "bank_transfer";
|
|
234
|
+
cryptocurrency: "cryptocurrency";
|
|
235
|
+
card: "card";
|
|
236
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
237
|
+
direct_debit: "direct_debit";
|
|
238
|
+
wallet: "wallet";
|
|
239
|
+
mobile_money: "mobile_money";
|
|
240
|
+
bnpl: "bnpl";
|
|
241
|
+
gift_card: "gift_card";
|
|
242
|
+
cash: "cash";
|
|
243
|
+
cheque: "cheque";
|
|
244
|
+
other: "other";
|
|
245
|
+
}>>;
|
|
201
246
|
status: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
202
247
|
gateway: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
203
248
|
type: z.ZodString;
|
|
@@ -315,14 +360,14 @@ declare const subscriptionBaseSchema: z.ZodObject<{
|
|
|
315
360
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
316
361
|
}, z.core.$strip>;
|
|
317
362
|
declare const subscriptionCreateSchema: z.ZodObject<{
|
|
363
|
+
organizationId: z.ZodOptional<z.ZodString>;
|
|
364
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
318
365
|
amount: z.ZodNumber;
|
|
319
366
|
currency: z.ZodOptional<z.ZodString>;
|
|
367
|
+
paymentIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
368
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
321
|
-
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
322
369
|
planKey: z.ZodString;
|
|
323
|
-
paymentIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
324
370
|
transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
325
|
-
organizationId: z.ZodOptional<z.ZodString>;
|
|
326
371
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
327
372
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
328
373
|
pauseReason: z.ZodOptional<z.ZodString>;
|
|
@@ -433,6 +478,7 @@ declare const settlementBaseSchema: z.ZodObject<{
|
|
|
433
478
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
434
479
|
}, z.core.$strip>;
|
|
435
480
|
declare const settlementCreateSchema: z.ZodObject<{
|
|
481
|
+
organizationId: z.ZodString;
|
|
436
482
|
type: z.ZodEnum<{
|
|
437
483
|
split_payout: "split_payout";
|
|
438
484
|
platform_withdrawal: "platform_withdrawal";
|
|
@@ -441,7 +487,6 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
441
487
|
}>;
|
|
442
488
|
amount: z.ZodNumber;
|
|
443
489
|
currency: z.ZodString;
|
|
444
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
445
490
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
446
491
|
recipientId: z.ZodString;
|
|
447
492
|
recipientType: z.ZodEnum<{
|
|
@@ -451,7 +496,7 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
451
496
|
affiliate: "affiliate";
|
|
452
497
|
partner: "partner";
|
|
453
498
|
}>;
|
|
454
|
-
|
|
499
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
455
500
|
payoutMethod: z.ZodEnum<{
|
|
456
501
|
manual: "manual";
|
|
457
502
|
bank_transfer: "bank_transfer";
|
|
@@ -572,6 +617,21 @@ declare const paymentIntentSchema: z.ZodObject<{
|
|
|
572
617
|
amount: z.ZodNumber;
|
|
573
618
|
currency: z.ZodString;
|
|
574
619
|
gateway: z.ZodString;
|
|
620
|
+
methodKind: z.ZodEnum<{
|
|
621
|
+
manual: "manual";
|
|
622
|
+
bank_transfer: "bank_transfer";
|
|
623
|
+
cryptocurrency: "cryptocurrency";
|
|
624
|
+
card: "card";
|
|
625
|
+
instant_bank_transfer: "instant_bank_transfer";
|
|
626
|
+
direct_debit: "direct_debit";
|
|
627
|
+
wallet: "wallet";
|
|
628
|
+
mobile_money: "mobile_money";
|
|
629
|
+
bnpl: "bnpl";
|
|
630
|
+
gift_card: "gift_card";
|
|
631
|
+
cash: "cash";
|
|
632
|
+
cheque: "cheque";
|
|
633
|
+
other: "other";
|
|
634
|
+
}>;
|
|
575
635
|
customerId: z.ZodOptional<z.ZodString>;
|
|
576
636
|
sourceId: z.ZodOptional<z.ZodString>;
|
|
577
637
|
sourceModel: z.ZodOptional<z.ZodString>;
|
|
@@ -27,6 +27,13 @@ const REVENUE_EVENTS = {
|
|
|
27
27
|
PAYMENT_REFUNDED: "revenue:payment.refunded",
|
|
28
28
|
PAYMENT_REQUIRES_ACTION: "revenue:payment.requires_action",
|
|
29
29
|
PAYMENT_PROCESSING: "revenue:payment.processing",
|
|
30
|
+
PAYMENT_AUTHORIZED: "revenue:payment.authorized",
|
|
31
|
+
PAYMENT_CAPTURED: "revenue:payment.captured",
|
|
32
|
+
PAYMENT_AUTH_VOIDED: "revenue:payment.auth_voided",
|
|
33
|
+
PAYMENT_DISPUTED: "revenue:payment.disputed",
|
|
34
|
+
PAYMENT_DISPUTE_WON: "revenue:payment.dispute_won",
|
|
35
|
+
PAYMENT_DISPUTE_LOST: "revenue:payment.dispute_lost",
|
|
36
|
+
PAYMENT_SETTLED: "revenue:payment.settled",
|
|
30
37
|
MONETIZATION_CREATED: "revenue:monetization.created",
|
|
31
38
|
PURCHASE_CREATED: "revenue:purchase.created",
|
|
32
39
|
FREE_CREATED: "revenue:free.created",
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as TransactionJournalizedPayload, A as SettlementCreated, B as SubscriptionCancelled, C as PurchaseCreated, D as RevenueEventSchema, E as RevenueEventPayloadOf, F as SettlementProcessingPayload, G as SubscriptionPausedPayload, H as SubscriptionCreated, I as SettlementScheduled, J as SubscriptionResumed, K as SubscriptionRenewed, L as SettlementScheduledPayload, M as SettlementFailed, N as SettlementFailedPayload, O as SettlementCompleted, P as SettlementProcessing, Q as TransactionJournalized, R as SubscriptionActivated, S as PaymentVerifiedPayload, T as RevenueEventDefinition, U as SubscriptionCreatedPayload, V as SubscriptionCancelledPayload, W as SubscriptionPaused, X as TransactionImported, Y as SubscriptionResumedPayload, Z as TransactionImportedPayload, _ as PaymentRefunded, _t as InProcessRevenueBusOptions, a as EscrowReleased, at as TransactionRemovedByFeedPayload, b as PaymentRequiresActionPayload, c as EscrowSplitPayload, ct as TransactionUpdated, d as MonetizationCreated, dt as WebhookProcessedPayload, et as TransactionMatched, f as MonetizationCreatedPayload, ft as revenueEventDefinitions, g as PaymentProcessingPayload, gt as InProcessRevenueBus, h as PaymentProcessing, ht as createEvent, i as EscrowHeldPayload, it as TransactionRemovedByFeed, j as SettlementCreatedPayload, k as SettlementCompletedPayload, l as FreeCreated, lt as TransactionUpdatedPayload, m as PaymentFailedPayload, mt as RevenueEventName, n as EscrowCancelledPayload, nt as TransactionRejected, o as EscrowReleasedPayload, ot as TransactionUnmatched, p as PaymentFailed, pt as REVENUE_EVENTS, q as SubscriptionRenewedPayload, r as EscrowHeld, rt as TransactionRejectedPayload, s as EscrowSplit, st as TransactionUnmatchedPayload, t as EscrowCancelled, tt as TransactionMatchedPayload, u as FreeCreatedPayload, ut as WebhookProcessed, v as PaymentRefundedPayload, w as PurchaseCreatedPayload, x as PaymentVerified, y as PaymentRequiresAction, z as SubscriptionActivatedPayload } from "../revenue-event-catalog-
|
|
1
|
+
import { $ as TransactionJournalizedPayload, A as SettlementCreated, B as SubscriptionCancelled, C as PurchaseCreated, D as RevenueEventSchema, E as RevenueEventPayloadOf, F as SettlementProcessingPayload, G as SubscriptionPausedPayload, H as SubscriptionCreated, I as SettlementScheduled, J as SubscriptionResumed, K as SubscriptionRenewed, L as SettlementScheduledPayload, M as SettlementFailed, N as SettlementFailedPayload, O as SettlementCompleted, P as SettlementProcessing, Q as TransactionJournalized, R as SubscriptionActivated, S as PaymentVerifiedPayload, T as RevenueEventDefinition, U as SubscriptionCreatedPayload, V as SubscriptionCancelledPayload, W as SubscriptionPaused, X as TransactionImported, Y as SubscriptionResumedPayload, Z as TransactionImportedPayload, _ as PaymentRefunded, _t as InProcessRevenueBusOptions, a as EscrowReleased, at as TransactionRemovedByFeedPayload, b as PaymentRequiresActionPayload, c as EscrowSplitPayload, ct as TransactionUpdated, d as MonetizationCreated, dt as WebhookProcessedPayload, et as TransactionMatched, f as MonetizationCreatedPayload, ft as revenueEventDefinitions, g as PaymentProcessingPayload, gt as InProcessRevenueBus, h as PaymentProcessing, ht as createEvent, i as EscrowHeldPayload, it as TransactionRemovedByFeed, j as SettlementCreatedPayload, k as SettlementCompletedPayload, l as FreeCreated, lt as TransactionUpdatedPayload, m as PaymentFailedPayload, mt as RevenueEventName, n as EscrowCancelledPayload, nt as TransactionRejected, o as EscrowReleasedPayload, ot as TransactionUnmatched, p as PaymentFailed, pt as REVENUE_EVENTS, q as SubscriptionRenewedPayload, r as EscrowHeld, rt as TransactionRejectedPayload, s as EscrowSplit, st as TransactionUnmatchedPayload, t as EscrowCancelled, tt as TransactionMatchedPayload, u as FreeCreatedPayload, ut as WebhookProcessed, v as PaymentRefundedPayload, w as PurchaseCreatedPayload, x as PaymentVerified, y as PaymentRequiresAction, z as SubscriptionActivatedPayload } from "../revenue-event-catalog-BU_KYN2-.mjs";
|
|
2
2
|
import { DomainEvent, EventHandler, EventTransport } from "@classytic/primitives/events";
|
|
3
3
|
export { type DomainEvent, EscrowCancelled, type EscrowCancelledPayload, EscrowHeld, type EscrowHeldPayload, EscrowReleased, type EscrowReleasedPayload, EscrowSplit, type EscrowSplitPayload, type EventHandler, type EventTransport, FreeCreated, type FreeCreatedPayload, InProcessRevenueBus, type InProcessRevenueBusOptions, MonetizationCreated, type MonetizationCreatedPayload, PaymentFailed, type PaymentFailedPayload, PaymentProcessing, type PaymentProcessingPayload, PaymentRefunded, type PaymentRefundedPayload, PaymentRequiresAction, type PaymentRequiresActionPayload, PaymentVerified, type PaymentVerifiedPayload, PurchaseCreated, type PurchaseCreatedPayload, REVENUE_EVENTS, type RevenueEventDefinition, type RevenueEventName, type RevenueEventPayloadOf, type RevenueEventSchema, SettlementCompleted, type SettlementCompletedPayload, SettlementCreated, type SettlementCreatedPayload, SettlementFailed, type SettlementFailedPayload, SettlementProcessing, type SettlementProcessingPayload, SettlementScheduled, type SettlementScheduledPayload, SubscriptionActivated, type SubscriptionActivatedPayload, SubscriptionCancelled, type SubscriptionCancelledPayload, SubscriptionCreated, type SubscriptionCreatedPayload, SubscriptionPaused, type SubscriptionPausedPayload, SubscriptionRenewed, type SubscriptionRenewedPayload, SubscriptionResumed, type SubscriptionResumedPayload, TransactionImported, type TransactionImportedPayload, TransactionJournalized, type TransactionJournalizedPayload, TransactionMatched, type TransactionMatchedPayload, TransactionRejected, type TransactionRejectedPayload, TransactionRemovedByFeed, type TransactionRemovedByFeedPayload, TransactionUnmatched, type TransactionUnmatchedPayload, TransactionUpdated, type TransactionUpdatedPayload, WebhookProcessed, type WebhookProcessedPayload, createEvent, revenueEventDefinitions };
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createEvent, t as REVENUE_EVENTS } from "../event-constants-
|
|
2
|
-
import { A as TransactionUpdated, C as SubscriptionResumed, D as TransactionRejected, E as TransactionMatched, M as revenueEventDefinitions, N as InProcessRevenueBus, O as TransactionRemovedByFeed, S as SubscriptionRenewed, T as TransactionJournalized, _ as SettlementScheduled, a as FreeCreated, b as SubscriptionCreated, c as PaymentProcessing, d as PaymentVerified, f as PurchaseCreated, g as SettlementProcessing, h as SettlementFailed, i as EscrowSplit, j as WebhookProcessed, k as TransactionUnmatched, l as PaymentRefunded, m as SettlementCreated, n as EscrowHeld, o as MonetizationCreated, p as SettlementCompleted, r as EscrowReleased, s as PaymentFailed, t as EscrowCancelled, u as PaymentRequiresAction, v as SubscriptionActivated, w as TransactionImported, x as SubscriptionPaused, y as SubscriptionCancelled } from "../revenue-event-catalog-
|
|
1
|
+
import { n as createEvent, t as REVENUE_EVENTS } from "../event-constants-DM_-A57b.mjs";
|
|
2
|
+
import { A as TransactionUpdated, C as SubscriptionResumed, D as TransactionRejected, E as TransactionMatched, M as revenueEventDefinitions, N as InProcessRevenueBus, O as TransactionRemovedByFeed, S as SubscriptionRenewed, T as TransactionJournalized, _ as SettlementScheduled, a as FreeCreated, b as SubscriptionCreated, c as PaymentProcessing, d as PaymentVerified, f as PurchaseCreated, g as SettlementProcessing, h as SettlementFailed, i as EscrowSplit, j as WebhookProcessed, k as TransactionUnmatched, l as PaymentRefunded, m as SettlementCreated, n as EscrowHeld, o as MonetizationCreated, p as SettlementCompleted, r as EscrowReleased, s as PaymentFailed, t as EscrowCancelled, u as PaymentRequiresAction, v as SubscriptionActivated, w as TransactionImported, x as SubscriptionPaused, y as SubscriptionCancelled } from "../revenue-event-catalog-B9aZmNpL.mjs";
|
|
3
3
|
|
|
4
4
|
export { EscrowCancelled, EscrowHeld, EscrowReleased, EscrowSplit, FreeCreated, InProcessRevenueBus, MonetizationCreated, PaymentFailed, PaymentProcessing, PaymentRefunded, PaymentRequiresAction, PaymentVerified, PurchaseCreated, REVENUE_EVENTS, SettlementCompleted, SettlementCreated, SettlementFailed, SettlementProcessing, SettlementScheduled, SubscriptionActivated, SubscriptionCancelled, SubscriptionCreated, SubscriptionPaused, SubscriptionRenewed, SubscriptionResumed, TransactionImported, TransactionJournalized, TransactionMatched, TransactionRejected, TransactionRemovedByFeed, TransactionUnmatched, TransactionUpdated, WebhookProcessed, createEvent, revenueEventDefinitions };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,11 +4,11 @@ import { A as SettlementStatus, B as HoldReason, C as isPayoutMethod, D as SETTL
|
|
|
4
4
|
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";
|
|
5
5
|
import { BANK_FEED_STATE_MACHINE, HOLD_STATE_MACHINE, MANUAL_STATE_MACHINE, PAYMENT_FLOW_STATE_MACHINE, SETTLEMENT_STATE_MACHINE, SPLIT_STATE_MACHINE, SUBSCRIPTION_STATE_MACHINE, StateChangeEvent, StateMachine, TRANSACTION_STATE_MACHINE, smFor } from "./core/state-machines.mjs";
|
|
6
6
|
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";
|
|
7
|
-
import { D as RevenueEventSchema, E as RevenueEventPayloadOf, T as RevenueEventDefinition, _t as InProcessRevenueBusOptions, ft as revenueEventDefinitions, gt as InProcessRevenueBus, ht as createEvent, mt as RevenueEventName, pt as REVENUE_EVENTS } from "./revenue-event-catalog-
|
|
7
|
+
import { D as RevenueEventSchema, E as RevenueEventPayloadOf, T as RevenueEventDefinition, _t as InProcessRevenueBusOptions, ft as revenueEventDefinitions, gt as InProcessRevenueBus, ht as createEvent, mt as RevenueEventName, pt as REVENUE_EVENTS } from "./revenue-event-catalog-BU_KYN2-.mjs";
|
|
8
8
|
import { a as BankFeedProviderRegistry, c as ParseUploadParams, d as PaymentProvider, i as BankFeedProviderCapabilities, l as ParseUploadResult, n as createProviderRegistry, o as FetchTransactionsParams, r as BankFeedProvider, s as FetchTransactionsResult, t as ProviderRegistry, u as createBankFeedProviderRegistry } from "./registry-h8sasoLh.mjs";
|
|
9
|
-
import { a as RevenueConfig, c as SubscriptionRepository, d as RevenueSchemaOptions, f as SettlementDocument, i as RetryConfig, l as TransactionRepository, m as TransactionDocument, n as BankFeedModuleConfig, o as RevenueEngine, p as SubscriptionDocument, r as CommissionConfig, s as SettlementRepository, t as BankFeedIndexConfig, u as RevenueModels } from "./engine-types-
|
|
9
|
+
import { a as RevenueConfig, c as SubscriptionRepository, d as RevenueSchemaOptions, f as SettlementDocument, i as RetryConfig, l as TransactionRepository, m as TransactionDocument, n as BankFeedModuleConfig, o as RevenueEngine, p as SubscriptionDocument, r as CommissionConfig, s as SettlementRepository, t as BankFeedIndexConfig, u as RevenueModels } from "./engine-types-ChFPg3kw.mjs";
|
|
10
10
|
import { RepositoryPluginBundle, RevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
11
|
-
import { A as transactionBaseSchema, C as subscriptionBaseSchema, D as TransactionCreateInput, E as subscriptionUpdateSchema, M as transactionListFilterSchema, N as transactionUpdateSchema, O as TransactionListFilter, S as SubscriptionUpdateInput, T as subscriptionListFilterSchema, _ as settlementCreateSchema, a as escrowReleaseSchema, b as SubscriptionCreateInput, c as PaymentVerifyInput, d as paymentVerifySchema, f as refundSchema, g as settlementBaseSchema, h as SettlementUpdateInput, i as escrowHoldSchema, j as transactionCreateSchema, k as TransactionUpdateInput, l as RefundInput, m as SettlementListFilter, n as EscrowReleaseInput, o as splitRuleSchema, p as SettlementCreateInput, r as SplitRuleInput, s as PaymentIntentInput, t as EscrowHoldInput, u as paymentIntentSchema, v as settlementListFilterSchema, w as subscriptionCreateSchema, x as SubscriptionListFilter, y as settlementUpdateSchema } from "./escrow.schema-
|
|
11
|
+
import { A as transactionBaseSchema, C as subscriptionBaseSchema, D as TransactionCreateInput, E as subscriptionUpdateSchema, M as transactionListFilterSchema, N as transactionUpdateSchema, O as TransactionListFilter, S as SubscriptionUpdateInput, T as subscriptionListFilterSchema, _ as settlementCreateSchema, a as escrowReleaseSchema, b as SubscriptionCreateInput, c as PaymentVerifyInput, d as paymentVerifySchema, f as refundSchema, g as settlementBaseSchema, h as SettlementUpdateInput, i as escrowHoldSchema, j as transactionCreateSchema, k as TransactionUpdateInput, l as RefundInput, m as SettlementListFilter, n as EscrowReleaseInput, o as splitRuleSchema, p as SettlementCreateInput, r as SplitRuleInput, s as PaymentIntentInput, t as EscrowHoldInput, u as paymentIntentSchema, v as settlementListFilterSchema, w as subscriptionCreateSchema, x as SubscriptionListFilter, y as settlementUpdateSchema } from "./escrow.schema-BdDHuQ8C.mjs";
|
|
12
12
|
import { A as SplitInfo, B as validateTaxCalculation, C as multiplyMoney, D as toCurrencyCode, E as sumMoney, F as TaxConfig, H as calculateCommission, I as TaxType, L as calculateTax, M as calculateOrganizationPayout, N as calculateSplits, O as toMajor, P as TaxCalculation, R as getTaxType, S as money, T as subtractMoney, U as reverseCommission, V as CommissionInfo, _ as isMoney, a as CurrencyCode, b as isZeroMoney, c as Money, d as addMoney, f as compareMoney, g as isCurrencyCode, h as fromSmallestUnit, i as CURRENCIES, j as SplitRule, k as toSmallestUnit, l as MoneyValue, m as fromMajor, n as getAuditTrail, o as CurrencyMismatchError, p as equalsMoney, r as getLastStateChange, s as MINOR_UNIT_FACTOR, t as appendAuditEvent, u as absMoney, v as isNegativeMoney, w as negateMoney, x as minorUnitFactor, y as isPositiveMoney, z as reverseTax } from "./audit-DRKuLBFO.mjs";
|
|
13
13
|
import { HookHandler, PluginContext, PluginManager, RevenuePluginDefinition } from "./plugins/plugin.interface.mjs";
|
|
14
14
|
import { DomainEvent, DomainEvent as DomainEvent$1, EventHandler, EventTransport } from "@classytic/primitives/events";
|
|
@@ -45,7 +45,20 @@ declare class MemoryOutboxStore implements OutboxStore$1 {
|
|
|
45
45
|
declare class RevenueError extends Error {
|
|
46
46
|
readonly code: string;
|
|
47
47
|
readonly details?: Record<string, unknown> | undefined;
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Suggested HTTP status. Hosts that surface RevenueError over HTTP
|
|
50
|
+
* (Arc, raw Express) read this to set the response code. Optional —
|
|
51
|
+
* defaults to 500 in the host's error mapper when unset.
|
|
52
|
+
*/
|
|
53
|
+
readonly httpStatus?: number | undefined;
|
|
54
|
+
constructor(message: string, code: string, details?: Record<string, unknown> | undefined,
|
|
55
|
+
/**
|
|
56
|
+
* Suggested HTTP status. Hosts that surface RevenueError over HTTP
|
|
57
|
+
* (Arc, raw Express) read this to set the response code. Optional —
|
|
58
|
+
* defaults to 500 in the host's error mapper when unset.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
httpStatus?: number | undefined);
|
|
49
62
|
}
|
|
50
63
|
declare class ValidationError extends RevenueError {
|
|
51
64
|
constructor(message: string, details?: Record<string, unknown>);
|
|
@@ -89,8 +102,17 @@ declare class BankFeedImportError extends RevenueError {
|
|
|
89
102
|
declare class WrongTransactionKindError extends RevenueError {
|
|
90
103
|
constructor(transactionId: string, expected: string, actual: string);
|
|
91
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Thrown by `TransactionRepository.backfillMethodKind` when the existing
|
|
107
|
+
* doc is NOT eligible for backfill (methodKind already specific, or
|
|
108
|
+
* status no longer `'pending'`). 409 because the request is well-formed
|
|
109
|
+
* but conflicts with the current resource state.
|
|
110
|
+
*/
|
|
111
|
+
declare class MethodKindLockedError extends RevenueError {
|
|
112
|
+
constructor(transactionId: string, currentMethodKind: string, currentStatus: string);
|
|
113
|
+
}
|
|
92
114
|
declare class BankFeedProviderNotFoundError extends RevenueError {
|
|
93
115
|
constructor(providerName: string);
|
|
94
116
|
}
|
|
95
117
|
//#endregion
|
|
96
|
-
export { AlreadyVerifiedError, type AnalyticsBridge, BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATE_MACHINE, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedImportError, type BankFeedIndexConfig, type BankFeedModuleConfig, BankFeedProvider, type BankFeedProviderCapabilities, BankFeedProviderNotFoundError, BankFeedProviderRegistry, BankFeedSourceValue, BankFeedStatusValue, CURRENCIES, type CommissionConfig, type CommissionInfo, ConfigurationError, type CurrencyBridge, type CurrencyCode, CurrencyMismatchError, type CustomerBridge, type DomainEvent, EscrowHoldInput, EscrowReleaseInput, type EventHandler, type EventTransport, type FetchTransactionsParams, type FetchTransactionsResult, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATE_MACHINE, HOLD_STATUS, HOLD_STATUS_VALUES, HoldReason, HoldReasonValue, HoldStatus, HoldStatusValue, type HookHandler, InProcessRevenueBus, type InProcessRevenueBusOptions, InvalidOutboxEventError, InvalidStateTransitionError, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, type LedgerBridge, LibraryCategories, LibraryCategoryValue, MANUAL_STATE_MACHINE, MINOR_UNIT_FACTOR, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MemoryOutboxStore, MonetizationTypeValue, MonetizationTypes, type Money, type MoneyValue, type NotificationBridge, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxWriteOptions, PAYMENT_FLOW_STATE_MACHINE, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, type ParseUploadParams, type ParseUploadResult, PaymentGatewayType, PaymentGatewayTypeValue, PaymentIntentCreationError, PaymentIntentInput, PaymentProvider, PaymentStatus, PaymentStatusValue, PaymentVerificationError, PaymentVerifyInput, PayoutMethod, PayoutMethodValue, PlanKeyValue, PlanKeys, type PluginContext, PluginManager, ProviderCapabilityError, ProviderNotFoundError, ProviderRegistry, RELEASE_REASON, RELEASE_REASON_VALUES, REVENUE_EVENTS, RefundInput, RefundNotSupportedError, ReleaseReason, ReleaseReasonValue, type RepositoryPluginBundle, type Result, type RetryConfig, type RevenueBridges, type RevenueConfig, type RevenueContext, type RevenueEngine, RevenueError, type RevenueEventDefinition, type RevenueEventName, type RevenueEventPayloadOf, type RevenueEventSchema, type RevenueModels, type RevenuePluginDefinition, type RevenueRepositories, type RevenueSchemaOptions, SETTLEMENT_STATE_MACHINE, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATE_MACHINE, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATE_MACHINE, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementCreateInput, type SettlementDocument, SettlementListFilter, SettlementNotFoundError, SettlementRepository, SettlementStatus, SettlementStatusValue, SettlementType, SettlementTypeValue, SettlementUpdateInput, type SplitInfo, type SplitRule, SplitRuleInput, SplitStatus, SplitStatusValue, SplitType, SplitTypeValue, type StateChangeEvent, StateMachine, SubscriptionCreateInput, type SubscriptionDocument, SubscriptionListFilter, SubscriptionNotFoundError, SubscriptionRepository, SubscriptionStatus, SubscriptionStatusValue, SubscriptionUpdateInput, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATE_MACHINE, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, type TaxBridge, type TaxCalculation, type TaxConfig, type TaxType, TransactionCreateInput, type TransactionDocument, TransactionFlow, TransactionFlowValue, TransactionKind, TransactionKindValue, TransactionListFilter, TransactionNotFoundError, TransactionRepository, TransactionStatus, TransactionStatusValue, TransactionUpdateInput, ValidationError, WrongTransactionKindError, absMoney, addMoney, appendAuditEvent, calculateCommission, calculateOrganizationPayout, calculateSplits, calculateTax, compareMoney, createBankFeedProviderRegistry, createEvent, createProviderRegistry, createRevenue, equalsMoney, err, escrowHoldSchema, escrowReleaseSchema, fromMajor, fromSmallestUnit, getAuditTrail, getLastStateChange, getTaxType, initialStatusFor, isBankFeedSource, isBankFeedStatus, isCurrencyCode, isErr, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isMoney, isNegativeMoney, isOk, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isPositiveMoney, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, isZeroMoney, minorUnitFactor, money, multiplyMoney, negateMoney, ok, paymentIntentSchema, paymentVerifySchema, refundSchema, revenueEventDefinitions, reverseCommission, reverseTax, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, smFor, splitRuleSchema, statusesForKind, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, subtractMoney, sumMoney, toCurrencyCode, toMajor, toSmallestUnit, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionUpdateSchema, validateTaxCalculation };
|
|
118
|
+
export { AlreadyVerifiedError, type AnalyticsBridge, BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATE_MACHINE, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedImportError, type BankFeedIndexConfig, type BankFeedModuleConfig, BankFeedProvider, type BankFeedProviderCapabilities, BankFeedProviderNotFoundError, BankFeedProviderRegistry, BankFeedSourceValue, BankFeedStatusValue, CURRENCIES, type CommissionConfig, type CommissionInfo, ConfigurationError, type CurrencyBridge, type CurrencyCode, CurrencyMismatchError, type CustomerBridge, type DomainEvent, EscrowHoldInput, EscrowReleaseInput, type EventHandler, type EventTransport, type FetchTransactionsParams, type FetchTransactionsResult, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATE_MACHINE, HOLD_STATUS, HOLD_STATUS_VALUES, HoldReason, HoldReasonValue, HoldStatus, HoldStatusValue, type HookHandler, InProcessRevenueBus, type InProcessRevenueBusOptions, InvalidOutboxEventError, InvalidStateTransitionError, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, type LedgerBridge, LibraryCategories, LibraryCategoryValue, MANUAL_STATE_MACHINE, MINOR_UNIT_FACTOR, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MemoryOutboxStore, MethodKindLockedError, MonetizationTypeValue, MonetizationTypes, type Money, type MoneyValue, type NotificationBridge, type OutboxAcknowledgeOptions, type OutboxClaimOptions, type OutboxErrorInfo, type OutboxFailOptions, type OutboxFailureContext, type OutboxFailureDecision, type OutboxFailurePolicy, OutboxOwnershipError, type OutboxStore, type OutboxWriteOptions, PAYMENT_FLOW_STATE_MACHINE, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, type ParseUploadParams, type ParseUploadResult, PaymentGatewayType, PaymentGatewayTypeValue, PaymentIntentCreationError, PaymentIntentInput, PaymentProvider, PaymentStatus, PaymentStatusValue, PaymentVerificationError, PaymentVerifyInput, PayoutMethod, PayoutMethodValue, PlanKeyValue, PlanKeys, type PluginContext, PluginManager, ProviderCapabilityError, ProviderNotFoundError, ProviderRegistry, RELEASE_REASON, RELEASE_REASON_VALUES, REVENUE_EVENTS, RefundInput, RefundNotSupportedError, ReleaseReason, ReleaseReasonValue, type RepositoryPluginBundle, type Result, type RetryConfig, type RevenueBridges, type RevenueConfig, type RevenueContext, type RevenueEngine, RevenueError, type RevenueEventDefinition, type RevenueEventName, type RevenueEventPayloadOf, type RevenueEventSchema, type RevenueModels, type RevenuePluginDefinition, type RevenueRepositories, type RevenueSchemaOptions, SETTLEMENT_STATE_MACHINE, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATE_MACHINE, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATE_MACHINE, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementCreateInput, type SettlementDocument, SettlementListFilter, SettlementNotFoundError, SettlementRepository, SettlementStatus, SettlementStatusValue, SettlementType, SettlementTypeValue, SettlementUpdateInput, type SplitInfo, type SplitRule, SplitRuleInput, SplitStatus, SplitStatusValue, SplitType, SplitTypeValue, type StateChangeEvent, StateMachine, SubscriptionCreateInput, type SubscriptionDocument, SubscriptionListFilter, SubscriptionNotFoundError, SubscriptionRepository, SubscriptionStatus, SubscriptionStatusValue, SubscriptionUpdateInput, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATE_MACHINE, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, type TaxBridge, type TaxCalculation, type TaxConfig, type TaxType, TransactionCreateInput, type TransactionDocument, TransactionFlow, TransactionFlowValue, TransactionKind, TransactionKindValue, TransactionListFilter, TransactionNotFoundError, TransactionRepository, TransactionStatus, TransactionStatusValue, TransactionUpdateInput, ValidationError, WrongTransactionKindError, absMoney, addMoney, appendAuditEvent, calculateCommission, calculateOrganizationPayout, calculateSplits, calculateTax, compareMoney, createBankFeedProviderRegistry, createEvent, createProviderRegistry, createRevenue, equalsMoney, err, escrowHoldSchema, escrowReleaseSchema, fromMajor, fromSmallestUnit, getAuditTrail, getLastStateChange, getTaxType, initialStatusFor, isBankFeedSource, isBankFeedStatus, isCurrencyCode, isErr, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isMoney, isNegativeMoney, isOk, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isPositiveMoney, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, isZeroMoney, minorUnitFactor, money, multiplyMoney, negateMoney, ok, paymentIntentSchema, paymentVerifySchema, refundSchema, revenueEventDefinitions, reverseCommission, reverseTax, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, smFor, splitRuleSchema, statusesForKind, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, subtractMoney, sumMoney, toCurrencyCode, toMajor, toSmallestUnit, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionUpdateSchema, validateTaxCalculation };
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
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 { n as SubscriptionRepository, r as TransactionRepository, t as SettlementRepository } from "./settlement.repository-
|
|
3
|
-
import { n as createEvent, t as REVENUE_EVENTS } from "./event-constants-
|
|
2
|
+
import { n as SubscriptionRepository, r as TransactionRepository, t as SettlementRepository } from "./settlement.repository-CfvgX3et.mjs";
|
|
3
|
+
import { n as createEvent, t as REVENUE_EVENTS } from "./event-constants-DM_-A57b.mjs";
|
|
4
4
|
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-95othr0i.mjs";
|
|
5
|
-
import { a as InvalidStateTransitionError, c as
|
|
5
|
+
import { _ as WrongTransactionKindError, a as InvalidStateTransitionError, c as PaymentVerificationError, d as RefundNotSupportedError, f as RevenueError, g as ValidationError, h as TransactionNotFoundError, i as ConfigurationError, l as ProviderCapabilityError, m as SubscriptionNotFoundError, n as BankFeedImportError, o as MethodKindLockedError, p as SettlementNotFoundError, r as BankFeedProviderNotFoundError, s as PaymentIntentCreationError, t as AlreadyVerifiedError, u as ProviderNotFoundError } from "./errors-Bt5NRVMq.mjs";
|
|
6
6
|
import { BANK_FEED_STATE_MACHINE, HOLD_STATE_MACHINE, MANUAL_STATE_MACHINE, PAYMENT_FLOW_STATE_MACHINE, SETTLEMENT_STATE_MACHINE, SPLIT_STATE_MACHINE, SUBSCRIPTION_STATE_MACHINE, StateMachine, TRANSACTION_STATE_MACHINE, smFor } from "./core/state-machines.mjs";
|
|
7
7
|
import { a as reverseTax, c as reverseCommission, i as getTaxType, n as calculateSplits, o as validateTaxCalculation, r as calculateTax, s as calculateCommission, t as calculateOrganizationPayout } from "./splits-CNfQj92L.mjs";
|
|
8
8
|
import { createRevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
9
|
-
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "./bank-feed-
|
|
10
|
-
import { M as revenueEventDefinitions, N as InProcessRevenueBus } from "./revenue-event-catalog-
|
|
9
|
+
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "./bank-feed-ClxNob_I.mjs";
|
|
10
|
+
import { M as revenueEventDefinitions, N as InProcessRevenueBus } from "./revenue-event-catalog-B9aZmNpL.mjs";
|
|
11
11
|
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";
|
|
12
|
-
import { _ as transactionListFilterSchema, a as paymentVerifySchema, c as settlementCreateSchema, d as subscriptionBaseSchema, f as subscriptionCreateSchema, g as transactionCreateSchema, h as transactionBaseSchema, i as paymentIntentSchema, l as settlementListFilterSchema, m as subscriptionUpdateSchema, n as escrowReleaseSchema, o as refundSchema, p as subscriptionListFilterSchema, r as splitRuleSchema, s as settlementBaseSchema, t as escrowHoldSchema, u as settlementUpdateSchema, v as transactionUpdateSchema } from "./escrow.schema-
|
|
12
|
+
import { _ as transactionListFilterSchema, a as paymentVerifySchema, c as settlementCreateSchema, d as subscriptionBaseSchema, f as subscriptionCreateSchema, g as transactionCreateSchema, h as transactionBaseSchema, i as paymentIntentSchema, l as settlementListFilterSchema, m as subscriptionUpdateSchema, n as escrowReleaseSchema, o as refundSchema, p as subscriptionListFilterSchema, r as splitRuleSchema, s as settlementBaseSchema, t as escrowHoldSchema, u as settlementUpdateSchema, v as transactionUpdateSchema } from "./escrow.schema-BcKdzrJ7.mjs";
|
|
13
13
|
import { C as sumMoney, E as toSmallestUnit, S as subtractMoney, T as toMajor, _ as isZeroMoney, a as CurrencyMismatchError, b as multiplyMoney, c as addMoney, d as fromMajor, f as fromSmallestUnit, g as isPositiveMoney, h as isNegativeMoney, i as CURRENCIES, l as compareMoney, m as isMoney, n as getAuditTrail, o as MINOR_UNIT_FACTOR, p as isCurrencyCode, r as getLastStateChange, s as absMoney, t as appendAuditEvent, u as equalsMoney, v as minorUnitFactor, w as toCurrencyCode, x as negateMoney, y as money } from "./audit-Ba2XB2C4.mjs";
|
|
14
14
|
import { PluginManager } from "./plugins/plugin.interface.mjs";
|
|
15
15
|
import { batchOperationsPlugin, customIdPlugin, methodRegistryPlugin, multiTenantPlugin, prefixedId, softDeletePlugin } from "@classytic/mongokit";
|
|
16
16
|
import { resolveTenantConfig } from "@classytic/repo-core/tenant";
|
|
17
17
|
import mongoose, { Schema } from "mongoose";
|
|
18
|
+
import { PAYMENT_METHOD_KIND } from "@classytic/primitives/payment-method-kind";
|
|
18
19
|
import { InvalidOutboxEventError, OutboxOwnershipError } from "@classytic/primitives/outbox";
|
|
19
20
|
import { err, isErr, isOk, ok } from "@classytic/primitives/result";
|
|
20
21
|
|
|
21
22
|
//#region src/models/transaction.schema.ts
|
|
23
|
+
const PAYMENT_METHOD_KIND_ENUM = Object.values(PAYMENT_METHOD_KIND);
|
|
22
24
|
const NO_BANK_FEED_INDEXES = {
|
|
23
25
|
idempotentImport: false,
|
|
24
26
|
byAccount: false,
|
|
@@ -76,6 +78,11 @@ function buildTransactionSchema(config) {
|
|
|
76
78
|
type: String,
|
|
77
79
|
required: true
|
|
78
80
|
},
|
|
81
|
+
methodKind: {
|
|
82
|
+
type: String,
|
|
83
|
+
enum: PAYMENT_METHOD_KIND_ENUM,
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
79
86
|
status: {
|
|
80
87
|
type: String,
|
|
81
88
|
default: "pending"
|
|
@@ -594,4 +601,4 @@ var MemoryOutboxStore = class {
|
|
|
594
601
|
};
|
|
595
602
|
|
|
596
603
|
//#endregion
|
|
597
|
-
export { AlreadyVerifiedError, BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATE_MACHINE, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedImportError, BankFeedProvider, BankFeedProviderNotFoundError, BankFeedProviderRegistry, CURRENCIES, ConfigurationError, CurrencyMismatchError, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATE_MACHINE, HOLD_STATUS, HOLD_STATUS_VALUES, InProcessRevenueBus, InvalidOutboxEventError, InvalidStateTransitionError, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, MANUAL_STATE_MACHINE, MINOR_UNIT_FACTOR, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MemoryOutboxStore, OutboxOwnershipError, PAYMENT_FLOW_STATE_MACHINE, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, PaymentIntentCreationError, PaymentProvider, PaymentVerificationError, PluginManager, ProviderCapabilityError, ProviderNotFoundError, ProviderRegistry, RELEASE_REASON, RELEASE_REASON_VALUES, REVENUE_EVENTS, RefundNotSupportedError, RevenueError, SETTLEMENT_STATE_MACHINE, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATE_MACHINE, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATE_MACHINE, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementNotFoundError, SettlementRepository, StateMachine, SubscriptionNotFoundError, SubscriptionRepository, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATE_MACHINE, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, TransactionNotFoundError, TransactionRepository, ValidationError, WrongTransactionKindError, absMoney, addMoney, appendAuditEvent, calculateCommission, calculateOrganizationPayout, calculateSplits, calculateTax, compareMoney, createBankFeedProviderRegistry, createEvent, createProviderRegistry, createRevenue, equalsMoney, err, escrowHoldSchema, escrowReleaseSchema, fromMajor, fromSmallestUnit, getAuditTrail, getLastStateChange, getTaxType, initialStatusFor, isBankFeedSource, isBankFeedStatus, isCurrencyCode, isErr, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isMoney, isNegativeMoney, isOk, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isPositiveMoney, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, isZeroMoney, minorUnitFactor, money, multiplyMoney, negateMoney, ok, paymentIntentSchema, paymentVerifySchema, refundSchema, revenueEventDefinitions, reverseCommission, reverseTax, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, smFor, splitRuleSchema, statusesForKind, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, subtractMoney, sumMoney, toCurrencyCode, toMajor, toSmallestUnit, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionUpdateSchema, validateTaxCalculation };
|
|
604
|
+
export { AlreadyVerifiedError, BANK_FEED_SOURCE, BANK_FEED_SOURCE_VALUES, BANK_FEED_STATE_MACHINE, BANK_FEED_STATUS, BANK_FEED_STATUS_VALUES, BankFeedImportError, BankFeedProvider, BankFeedProviderNotFoundError, BankFeedProviderRegistry, CURRENCIES, ConfigurationError, CurrencyMismatchError, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATE_MACHINE, HOLD_STATUS, HOLD_STATUS_VALUES, InProcessRevenueBus, InvalidOutboxEventError, InvalidStateTransitionError, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, MANUAL_STATE_MACHINE, MINOR_UNIT_FACTOR, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, MemoryOutboxStore, MethodKindLockedError, OutboxOwnershipError, PAYMENT_FLOW_STATE_MACHINE, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES, PaymentIntentCreationError, PaymentProvider, PaymentVerificationError, PluginManager, ProviderCapabilityError, ProviderNotFoundError, ProviderRegistry, RELEASE_REASON, RELEASE_REASON_VALUES, REVENUE_EVENTS, RefundNotSupportedError, RevenueError, SETTLEMENT_STATE_MACHINE, SETTLEMENT_STATUS, SETTLEMENT_STATUS_VALUES, SETTLEMENT_TYPE, SETTLEMENT_TYPE_VALUES, SPLIT_STATE_MACHINE, SPLIT_STATUS, SPLIT_STATUS_VALUES, SPLIT_TYPE, SPLIT_TYPE_VALUES, SUBSCRIPTION_STATE_MACHINE, SUBSCRIPTION_STATUS, SUBSCRIPTION_STATUS_VALUES, SettlementNotFoundError, SettlementRepository, StateMachine, SubscriptionNotFoundError, SubscriptionRepository, TRANSACTION_FLOW, TRANSACTION_FLOW_VALUES, TRANSACTION_KIND, TRANSACTION_KIND_VALUES, TRANSACTION_STATE_MACHINE, TRANSACTION_STATUS, TRANSACTION_STATUS_VALUES, TransactionNotFoundError, TransactionRepository, ValidationError, WrongTransactionKindError, absMoney, addMoney, appendAuditEvent, calculateCommission, calculateOrganizationPayout, calculateSplits, calculateTax, compareMoney, createBankFeedProviderRegistry, createEvent, createProviderRegistry, createRevenue, equalsMoney, err, escrowHoldSchema, escrowReleaseSchema, fromMajor, fromSmallestUnit, getAuditTrail, getLastStateChange, getTaxType, initialStatusFor, isBankFeedSource, isBankFeedStatus, isCurrencyCode, isErr, isHoldReason, isHoldStatus, isLibraryCategory, isMonetizationType, isMoney, isNegativeMoney, isOk, isPaymentGatewayType, isPaymentStatus, isPayoutMethod, isPlanKey, isPositiveMoney, isReleaseReason, isSettlementStatus, isSettlementType, isSplitStatus, isSplitType, isStatusValidForKind, isSubscriptionStatus, isTransactionFlow, isTransactionKind, isTransactionStatus, isZeroMoney, minorUnitFactor, money, multiplyMoney, negateMoney, ok, paymentIntentSchema, paymentVerifySchema, refundSchema, revenueEventDefinitions, reverseCommission, reverseTax, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, smFor, splitRuleSchema, statusesForKind, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, subtractMoney, sumMoney, toCurrencyCode, toMajor, toSmallestUnit, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionUpdateSchema, validateTaxCalculation };
|
package/dist/providers/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "../bank-feed-
|
|
1
|
+
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "../bank-feed-ClxNob_I.mjs";
|
|
2
2
|
|
|
3
3
|
export { BankFeedProvider, BankFeedProviderRegistry, PaymentProvider, ProviderRegistry, createBankFeedProviderRegistry, createProviderRegistry };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as SubscriptionRepository, l as TransactionRepository, s as SettlementRepository, u as RevenueModels } from "../engine-types-
|
|
1
|
+
import { c as SubscriptionRepository, l as TransactionRepository, s as SettlementRepository, u as RevenueModels } from "../engine-types-ChFPg3kw.mjs";
|
|
2
2
|
import { PluginType } from "@classytic/mongokit";
|
|
3
3
|
|
|
4
4
|
//#region src/repositories/create-repositories.d.ts
|