@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
|
@@ -116,39 +116,4 @@ declare const PLAN_KEY_VALUES: PlanKeyValue[];
|
|
|
116
116
|
declare function isSubscriptionStatus(value: unknown): value is SubscriptionStatusValue;
|
|
117
117
|
declare function isPlanKey(value: unknown): value is PlanKeyValue;
|
|
118
118
|
//#endregion
|
|
119
|
-
|
|
120
|
-
declare const TRANSACTION_FLOW: {
|
|
121
|
-
readonly INFLOW: "inflow";
|
|
122
|
-
readonly OUTFLOW: "outflow";
|
|
123
|
-
};
|
|
124
|
-
type TransactionFlow = typeof TRANSACTION_FLOW;
|
|
125
|
-
type TransactionFlowValue = TransactionFlow[keyof TransactionFlow];
|
|
126
|
-
declare const TRANSACTION_FLOW_VALUES: TransactionFlowValue[];
|
|
127
|
-
declare const TRANSACTION_STATUS: {
|
|
128
|
-
readonly PENDING: "pending";
|
|
129
|
-
readonly PAYMENT_INITIATED: "payment_initiated";
|
|
130
|
-
readonly PROCESSING: "processing";
|
|
131
|
-
readonly REQUIRES_ACTION: "requires_action";
|
|
132
|
-
readonly VERIFIED: "verified";
|
|
133
|
-
readonly COMPLETED: "completed";
|
|
134
|
-
readonly FAILED: "failed";
|
|
135
|
-
readonly CANCELLED: "cancelled";
|
|
136
|
-
readonly EXPIRED: "expired";
|
|
137
|
-
readonly REFUNDED: "refunded";
|
|
138
|
-
readonly PARTIALLY_REFUNDED: "partially_refunded";
|
|
139
|
-
};
|
|
140
|
-
type TransactionStatus = typeof TRANSACTION_STATUS;
|
|
141
|
-
type TransactionStatusValue = TransactionStatus[keyof TransactionStatus];
|
|
142
|
-
declare const TRANSACTION_STATUS_VALUES: TransactionStatusValue[];
|
|
143
|
-
declare const LIBRARY_CATEGORIES: {
|
|
144
|
-
readonly SUBSCRIPTION: "subscription";
|
|
145
|
-
readonly PURCHASE: "purchase";
|
|
146
|
-
};
|
|
147
|
-
type LibraryCategories = typeof LIBRARY_CATEGORIES;
|
|
148
|
-
type LibraryCategoryValue = LibraryCategories[keyof LibraryCategories];
|
|
149
|
-
declare const LIBRARY_CATEGORY_VALUES: LibraryCategoryValue[];
|
|
150
|
-
declare function isLibraryCategory(value: unknown): value is LibraryCategoryValue;
|
|
151
|
-
declare function isTransactionFlow(value: unknown): value is TransactionFlowValue;
|
|
152
|
-
declare function isTransactionStatus(value: unknown): value is TransactionStatusValue;
|
|
153
|
-
//#endregion
|
|
154
|
-
export { HOLD_STATUS as $, SPLIT_STATUS as A, isSplitType as B, SubscriptionStatusValue as C, PAYOUT_METHOD_VALUES as D, PAYOUT_METHOD as E, SplitStatusValue as F, SettlementStatus as G, SETTLEMENT_STATUS_VALUES as H, SplitType as I, SettlementTypeValue as J, SettlementStatusValue as K, SplitTypeValue as L, SPLIT_TYPE as M, SPLIT_TYPE_VALUES as N, PayoutMethod as O, SplitStatus as P, HOLD_REASON_VALUES as Q, isPayoutMethod as R, SubscriptionStatus as S, isSubscriptionStatus as T, SETTLEMENT_TYPE as U, SETTLEMENT_STATUS as V, SETTLEMENT_TYPE_VALUES as W, isSettlementType as X, isSettlementStatus as Y, HOLD_REASON as Z, PLAN_KEY_VALUES as _, TRANSACTION_FLOW as a, RELEASE_REASON as at, SUBSCRIPTION_STATUS as b, TRANSACTION_STATUS_VALUES as c, ReleaseReasonValue as ct, TransactionStatus as d, isReleaseReason as dt, HOLD_STATUS_VALUES as et, TransactionStatusValue as f, PLAN_KEYS as g, isTransactionStatus as h, LibraryCategoryValue as i, HoldStatusValue as it, SPLIT_STATUS_VALUES as j, PayoutMethodValue as k, TransactionFlow as l, isHoldReason as lt, isTransactionFlow as m, LIBRARY_CATEGORY_VALUES as n, HoldReasonValue as nt, TRANSACTION_FLOW_VALUES as o, RELEASE_REASON_VALUES as ot, isLibraryCategory as p, SettlementType as q, LibraryCategories as r, HoldStatus as rt, TRANSACTION_STATUS as s, ReleaseReason as st, LIBRARY_CATEGORIES as t, HoldReason as tt, TransactionFlowValue as u, isHoldStatus as ut, PlanKeyValue as v, isPlanKey as w, SUBSCRIPTION_STATUS_VALUES as x, PlanKeys as y, isSplitStatus as z };
|
|
119
|
+
export { SettlementStatus as A, HoldReason as B, isPayoutMethod as C, SETTLEMENT_STATUS_VALUES as D, SETTLEMENT_STATUS as E, isSettlementType as F, RELEASE_REASON_VALUES as G, HoldStatus as H, HOLD_REASON as I, isHoldReason as J, ReleaseReason as K, HOLD_REASON_VALUES as L, SettlementType as M, SettlementTypeValue as N, SETTLEMENT_TYPE as O, isSettlementStatus as P, HOLD_STATUS as R, SplitTypeValue as S, isSplitType as T, HoldStatusValue as U, HoldReasonValue as V, RELEASE_REASON as W, isReleaseReason as X, isHoldStatus as Y, SPLIT_TYPE as _, SUBSCRIPTION_STATUS as a, SplitStatusValue as b, SubscriptionStatusValue as c, PAYOUT_METHOD as d, PAYOUT_METHOD_VALUES as f, SPLIT_STATUS_VALUES as g, SPLIT_STATUS as h, PlanKeys as i, SettlementStatusValue as j, SETTLEMENT_TYPE_VALUES as k, isPlanKey as l, PayoutMethodValue as m, PLAN_KEY_VALUES as n, SUBSCRIPTION_STATUS_VALUES as o, PayoutMethod as p, ReleaseReasonValue as q, PlanKeyValue as r, SubscriptionStatus as s, PLAN_KEYS as t, isSubscriptionStatus as u, SPLIT_TYPE_VALUES as v, isSplitStatus as w, SplitType as x, SplitStatus as y, HOLD_STATUS_VALUES as z };
|
|
@@ -1,2 +1,158 @@
|
|
|
1
|
-
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-
|
|
2
|
-
|
|
1
|
+
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-9yh4Q-aQ.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/validators/bank-feed.schema.d.ts
|
|
5
|
+
declare const moneySchema: z.ZodObject<{
|
|
6
|
+
amount: z.ZodNumber;
|
|
7
|
+
currency: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
declare const counterpartySchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
12
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
13
|
+
accountNumber: z.ZodOptional<z.ZodString>;
|
|
14
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
15
|
+
routingNumber: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const bankTransactionSchema: z.ZodObject<{
|
|
18
|
+
externalId: z.ZodString;
|
|
19
|
+
postedDate: z.ZodCoercedDate<unknown>;
|
|
20
|
+
valueDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
21
|
+
amount: z.ZodObject<{
|
|
22
|
+
amount: z.ZodNumber;
|
|
23
|
+
currency: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
description: z.ZodString;
|
|
26
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
29
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
30
|
+
accountNumber: z.ZodOptional<z.ZodString>;
|
|
31
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
32
|
+
routingNumber: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
35
|
+
category: z.ZodOptional<z.ZodString>;
|
|
36
|
+
balanceAfter: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
amount: z.ZodNumber;
|
|
38
|
+
currency: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
type: z.ZodOptional<z.ZodString>;
|
|
41
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
declare const journalEntryRefSchema: z.ZodObject<{
|
|
44
|
+
type: z.ZodString;
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
declare const matchingMappingSchema: z.ZodObject<{
|
|
48
|
+
debitAccount: z.ZodOptional<z.ZodString>;
|
|
49
|
+
creditAccount: z.ZodOptional<z.ZodString>;
|
|
50
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
declare const importBodySchema: z.ZodObject<{
|
|
53
|
+
bankAccountId: z.ZodString;
|
|
54
|
+
source: z.ZodEnum<{
|
|
55
|
+
[x: string]: string;
|
|
56
|
+
}>;
|
|
57
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
58
|
+
externalId: z.ZodString;
|
|
59
|
+
postedDate: z.ZodCoercedDate<unknown>;
|
|
60
|
+
valueDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
61
|
+
amount: z.ZodObject<{
|
|
62
|
+
amount: z.ZodNumber;
|
|
63
|
+
currency: z.ZodString;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
description: z.ZodString;
|
|
66
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
name: z.ZodOptional<z.ZodString>;
|
|
68
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
69
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
70
|
+
accountNumber: z.ZodOptional<z.ZodString>;
|
|
71
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
72
|
+
routingNumber: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
75
|
+
category: z.ZodOptional<z.ZodString>;
|
|
76
|
+
balanceAfter: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
amount: z.ZodNumber;
|
|
78
|
+
currency: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
type: z.ZodOptional<z.ZodString>;
|
|
81
|
+
raw: z.ZodOptional<z.ZodUnknown>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
declare const matchBodySchema: z.ZodObject<{
|
|
85
|
+
mapping: z.ZodObject<{
|
|
86
|
+
debitAccount: z.ZodOptional<z.ZodString>;
|
|
87
|
+
creditAccount: z.ZodOptional<z.ZodString>;
|
|
88
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
91
|
+
matchedBy: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
declare const journalizeBodySchema: z.ZodObject<{
|
|
94
|
+
journalEntryRef: z.ZodObject<{
|
|
95
|
+
type: z.ZodString;
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
journalizedBy: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
declare const rejectBodySchema: z.ZodObject<{
|
|
101
|
+
reason: z.ZodString;
|
|
102
|
+
rejectedBy: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
declare const unmatchBodySchema: z.ZodObject<{
|
|
105
|
+
unmatchedBy: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
declare const manualEntrySchema: z.ZodObject<{
|
|
108
|
+
kind: z.ZodDefault<z.ZodLiteral<"manual">>;
|
|
109
|
+
amount: z.ZodNumber;
|
|
110
|
+
currency: z.ZodString;
|
|
111
|
+
flow: z.ZodEnum<{
|
|
112
|
+
inflow: "inflow";
|
|
113
|
+
outflow: "outflow";
|
|
114
|
+
}>;
|
|
115
|
+
type: z.ZodString;
|
|
116
|
+
description: z.ZodOptional<z.ZodString>;
|
|
117
|
+
counterparty: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
name: z.ZodOptional<z.ZodString>;
|
|
119
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
120
|
+
iban: z.ZodOptional<z.ZodString>;
|
|
121
|
+
accountNumber: z.ZodOptional<z.ZodString>;
|
|
122
|
+
bic: z.ZodOptional<z.ZodString>;
|
|
123
|
+
routingNumber: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
126
|
+
postedDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
127
|
+
valueDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
128
|
+
bankAccountId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
declare const findMatchCandidatesQuerySchema: z.ZodObject<{
|
|
132
|
+
amount: z.ZodCoercedNumber<unknown>;
|
|
133
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
134
|
+
postedDate: z.ZodCoercedDate<unknown>;
|
|
135
|
+
toleranceDays: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
136
|
+
amountTolerancePct: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
137
|
+
counterpartyName: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
declare const transactionListQuerySchema: z.ZodObject<{
|
|
140
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
[x: string]: string;
|
|
142
|
+
}>>;
|
|
143
|
+
status: z.ZodOptional<z.ZodString>;
|
|
144
|
+
bankAccountId: z.ZodOptional<z.ZodString>;
|
|
145
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
146
|
+
[x: string]: string;
|
|
147
|
+
}>>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
type ImportBody = z.infer<typeof importBodySchema>;
|
|
150
|
+
type MatchBody = z.infer<typeof matchBodySchema>;
|
|
151
|
+
type JournalizeBody = z.infer<typeof journalizeBodySchema>;
|
|
152
|
+
type RejectBody = z.infer<typeof rejectBodySchema>;
|
|
153
|
+
type UnmatchBody = z.infer<typeof unmatchBodySchema>;
|
|
154
|
+
type ManualEntryBody = z.infer<typeof manualEntrySchema>;
|
|
155
|
+
type FindMatchCandidatesQuery = z.infer<typeof findMatchCandidatesQuerySchema>;
|
|
156
|
+
type TransactionListQuery = z.infer<typeof transactionListQuerySchema>;
|
|
157
|
+
//#endregion
|
|
158
|
+
export { EscrowHoldInput, EscrowReleaseInput, FindMatchCandidatesQuery, ImportBody, JournalizeBody, ManualEntryBody, MatchBody, PaymentIntentInput, PaymentVerifyInput, RefundInput, RejectBody, SettlementCreateInput, SettlementListFilter, SettlementUpdateInput, SplitRuleInput, SubscriptionCreateInput, SubscriptionListFilter, SubscriptionUpdateInput, TransactionCreateInput, TransactionListFilter, TransactionListQuery, TransactionUpdateInput, UnmatchBody, bankTransactionSchema, counterpartySchema, escrowHoldSchema, escrowReleaseSchema, findMatchCandidatesQuerySchema, importBodySchema, journalEntryRefSchema, journalizeBodySchema, manualEntrySchema, matchBodySchema, matchingMappingSchema, moneySchema, paymentIntentSchema, paymentVerifySchema, refundSchema, rejectBodySchema, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, splitRuleSchema, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionListQuerySchema, transactionUpdateSchema, unmatchBodySchema };
|
|
@@ -1,3 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as BANK_FEED_SOURCE_VALUES, o as TRANSACTION_KIND_VALUES } from "../bank-feed.enums-kYTLTTbe.mjs";
|
|
2
|
+
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-C-b41z_G.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
//#region src/validators/bank-feed.schema.ts
|
|
6
|
+
/**
|
|
7
|
+
* Zod 4 validators for bank-feed HTTP / RPC payloads.
|
|
8
|
+
*
|
|
9
|
+
* In-process schemas use `z.coerce.date()` (PACKAGE_RULES §25). Shapes
|
|
10
|
+
* that travel over the wire (Plaid webhooks, queued jobs) use
|
|
11
|
+
* `z.iso.datetime()` — see the catalog file for those.
|
|
12
|
+
*/
|
|
13
|
+
const moneySchema = z.object({
|
|
14
|
+
amount: z.number().int(),
|
|
15
|
+
currency: z.string().length(3)
|
|
16
|
+
});
|
|
17
|
+
const counterpartySchema = z.object({
|
|
18
|
+
name: z.string().optional(),
|
|
19
|
+
identifier: z.string().optional(),
|
|
20
|
+
iban: z.string().optional(),
|
|
21
|
+
accountNumber: z.string().optional(),
|
|
22
|
+
bic: z.string().optional(),
|
|
23
|
+
routingNumber: z.string().optional()
|
|
24
|
+
});
|
|
25
|
+
const bankTransactionSchema = z.object({
|
|
26
|
+
externalId: z.string().min(1),
|
|
27
|
+
postedDate: z.coerce.date(),
|
|
28
|
+
valueDate: z.coerce.date().optional(),
|
|
29
|
+
amount: moneySchema,
|
|
30
|
+
description: z.string(),
|
|
31
|
+
counterparty: counterpartySchema.optional(),
|
|
32
|
+
reference: z.string().optional(),
|
|
33
|
+
category: z.string().optional(),
|
|
34
|
+
balanceAfter: moneySchema.optional(),
|
|
35
|
+
type: z.string().optional(),
|
|
36
|
+
raw: z.unknown().optional()
|
|
37
|
+
});
|
|
38
|
+
const journalEntryRefSchema = z.object({
|
|
39
|
+
type: z.string().min(1),
|
|
40
|
+
id: z.string().min(1)
|
|
41
|
+
});
|
|
42
|
+
const matchingMappingSchema = z.object({
|
|
43
|
+
debitAccount: z.string().optional(),
|
|
44
|
+
creditAccount: z.string().optional(),
|
|
45
|
+
notes: z.string().optional()
|
|
46
|
+
});
|
|
47
|
+
const importBodySchema = z.object({
|
|
48
|
+
bankAccountId: z.string().min(1),
|
|
49
|
+
source: z.enum(BANK_FEED_SOURCE_VALUES),
|
|
50
|
+
rows: z.array(bankTransactionSchema).min(1)
|
|
51
|
+
});
|
|
52
|
+
const matchBodySchema = z.object({
|
|
53
|
+
mapping: matchingMappingSchema,
|
|
54
|
+
relatedTransactionId: z.string().optional(),
|
|
55
|
+
matchedBy: z.string().optional()
|
|
56
|
+
});
|
|
57
|
+
const journalizeBodySchema = z.object({
|
|
58
|
+
journalEntryRef: journalEntryRefSchema,
|
|
59
|
+
journalizedBy: z.string().optional()
|
|
60
|
+
});
|
|
61
|
+
const rejectBodySchema = z.object({
|
|
62
|
+
reason: z.string().min(1).max(500),
|
|
63
|
+
rejectedBy: z.string().optional()
|
|
64
|
+
});
|
|
65
|
+
const unmatchBodySchema = z.object({ unmatchedBy: z.string().optional() });
|
|
66
|
+
const manualEntrySchema = z.object({
|
|
67
|
+
kind: z.literal("manual").default("manual"),
|
|
68
|
+
amount: z.number().nonnegative(),
|
|
69
|
+
currency: z.string().length(3),
|
|
70
|
+
flow: z.enum(["inflow", "outflow"]),
|
|
71
|
+
type: z.string().min(1),
|
|
72
|
+
description: z.string().optional(),
|
|
73
|
+
counterparty: counterpartySchema.optional(),
|
|
74
|
+
reference: z.string().optional(),
|
|
75
|
+
postedDate: z.coerce.date().optional(),
|
|
76
|
+
valueDate: z.coerce.date().optional(),
|
|
77
|
+
bankAccountId: z.string().optional(),
|
|
78
|
+
metadata: z.record(z.string(), z.unknown()).optional()
|
|
79
|
+
});
|
|
80
|
+
const findMatchCandidatesQuerySchema = z.object({
|
|
81
|
+
amount: z.coerce.number().nonnegative(),
|
|
82
|
+
currency: z.string().length(3).optional(),
|
|
83
|
+
postedDate: z.coerce.date(),
|
|
84
|
+
toleranceDays: z.coerce.number().int().min(0).max(30).optional(),
|
|
85
|
+
amountTolerancePct: z.coerce.number().min(0).max(.5).optional(),
|
|
86
|
+
counterpartyName: z.string().optional()
|
|
87
|
+
});
|
|
88
|
+
const transactionListQuerySchema = z.object({
|
|
89
|
+
kind: z.enum(TRANSACTION_KIND_VALUES).optional(),
|
|
90
|
+
status: z.string().optional(),
|
|
91
|
+
bankAccountId: z.string().optional(),
|
|
92
|
+
source: z.enum(BANK_FEED_SOURCE_VALUES).optional()
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { bankTransactionSchema, counterpartySchema, escrowHoldSchema, escrowReleaseSchema, findMatchCandidatesQuerySchema, importBodySchema, journalEntryRefSchema, journalizeBodySchema, manualEntrySchema, matchBodySchema, matchingMappingSchema, moneySchema, paymentIntentSchema, paymentVerifySchema, refundSchema, rejectBodySchema, settlementBaseSchema, settlementCreateSchema, settlementListFilterSchema, settlementUpdateSchema, splitRuleSchema, subscriptionBaseSchema, subscriptionCreateSchema, subscriptionListFilterSchema, subscriptionUpdateSchema, transactionBaseSchema, transactionCreateSchema, transactionListFilterSchema, transactionListQuerySchema, transactionUpdateSchema, unmatchBodySchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/revenue",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Payment lifecycle engine — transactions, subscriptions, escrow, settlements, commissions. MongoKit-powered, Arc-compatible, framework-agnostic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
"LICENSE"
|
|
101
101
|
],
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@classytic/mongokit": ">=3.
|
|
104
|
-
"@classytic/repo-core": ">=0.
|
|
105
|
-
"@classytic/primitives": ">=0.
|
|
103
|
+
"@classytic/mongokit": ">=3.13.0",
|
|
104
|
+
"@classytic/repo-core": ">=0.4.0",
|
|
105
|
+
"@classytic/primitives": ">=0.5.0",
|
|
106
106
|
"mongoose": ">=9.4.1",
|
|
107
107
|
"zod": ">=4.0.0"
|
|
108
108
|
},
|
|
@@ -110,9 +110,9 @@
|
|
|
110
110
|
"node": ">=18.0.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@classytic/mongokit": ">=3.
|
|
114
|
-
"@classytic/repo-core": ">=0.
|
|
115
|
-
"@classytic/primitives": ">=0.
|
|
113
|
+
"@classytic/mongokit": ">=3.13.0",
|
|
114
|
+
"@classytic/repo-core": ">=0.4.0",
|
|
115
|
+
"@classytic/primitives": ">=0.5.0",
|
|
116
116
|
"@types/node": "^22.8.7",
|
|
117
117
|
"mongoose": "^9.4.1",
|
|
118
118
|
"tsdown": "^0.20.3",
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { s as ProviderNotFoundError } from "./errors-DHa8JVQ-.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/providers/base.ts
|
|
4
|
-
var PaymentIntent = class {
|
|
5
|
-
id;
|
|
6
|
-
sessionId;
|
|
7
|
-
paymentIntentId;
|
|
8
|
-
provider;
|
|
9
|
-
status;
|
|
10
|
-
amount;
|
|
11
|
-
currency;
|
|
12
|
-
metadata;
|
|
13
|
-
clientSecret;
|
|
14
|
-
paymentUrl;
|
|
15
|
-
instructions;
|
|
16
|
-
raw;
|
|
17
|
-
constructor(data) {
|
|
18
|
-
this.id = data.id;
|
|
19
|
-
this.sessionId = data.sessionId ?? null;
|
|
20
|
-
this.paymentIntentId = data.paymentIntentId ?? null;
|
|
21
|
-
this.provider = data.provider;
|
|
22
|
-
this.status = data.status;
|
|
23
|
-
this.amount = data.amount;
|
|
24
|
-
this.currency = data.currency;
|
|
25
|
-
this.metadata = data.metadata ?? {};
|
|
26
|
-
this.clientSecret = data.clientSecret;
|
|
27
|
-
this.paymentUrl = data.paymentUrl;
|
|
28
|
-
this.instructions = data.instructions;
|
|
29
|
-
this.raw = data.raw;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var PaymentResult = class {
|
|
33
|
-
id;
|
|
34
|
-
provider;
|
|
35
|
-
status;
|
|
36
|
-
amount;
|
|
37
|
-
currency;
|
|
38
|
-
paidAt;
|
|
39
|
-
metadata;
|
|
40
|
-
raw;
|
|
41
|
-
constructor(data) {
|
|
42
|
-
this.id = data.id;
|
|
43
|
-
this.provider = data.provider;
|
|
44
|
-
this.status = data.status;
|
|
45
|
-
this.amount = data.amount;
|
|
46
|
-
this.currency = data.currency;
|
|
47
|
-
this.paidAt = data.paidAt;
|
|
48
|
-
this.metadata = data.metadata ?? {};
|
|
49
|
-
this.raw = data.raw;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
var RefundResult = class {
|
|
53
|
-
id;
|
|
54
|
-
provider;
|
|
55
|
-
status;
|
|
56
|
-
amount;
|
|
57
|
-
currency;
|
|
58
|
-
refundedAt;
|
|
59
|
-
reason;
|
|
60
|
-
metadata;
|
|
61
|
-
raw;
|
|
62
|
-
constructor(data) {
|
|
63
|
-
this.id = data.id;
|
|
64
|
-
this.provider = data.provider;
|
|
65
|
-
this.status = data.status;
|
|
66
|
-
this.amount = data.amount;
|
|
67
|
-
this.currency = data.currency;
|
|
68
|
-
this.refundedAt = data.refundedAt;
|
|
69
|
-
this.reason = data.reason;
|
|
70
|
-
this.metadata = data.metadata ?? {};
|
|
71
|
-
this.raw = data.raw;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
var WebhookEvent = class {
|
|
75
|
-
id;
|
|
76
|
-
provider;
|
|
77
|
-
type;
|
|
78
|
-
data;
|
|
79
|
-
createdAt;
|
|
80
|
-
raw;
|
|
81
|
-
constructor(data) {
|
|
82
|
-
this.id = data.id;
|
|
83
|
-
this.provider = data.provider;
|
|
84
|
-
this.type = data.type;
|
|
85
|
-
this.data = data.data;
|
|
86
|
-
this.createdAt = data.createdAt;
|
|
87
|
-
this.raw = data.raw;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
var PaymentProvider = class {
|
|
91
|
-
config;
|
|
92
|
-
name;
|
|
93
|
-
_defaultCurrency = "USD";
|
|
94
|
-
constructor(config = {}) {
|
|
95
|
-
this.config = config;
|
|
96
|
-
this.name = "base";
|
|
97
|
-
if (config.defaultCurrency && typeof config.defaultCurrency === "string") this._defaultCurrency = config.defaultCurrency;
|
|
98
|
-
}
|
|
99
|
-
get defaultCurrency() {
|
|
100
|
-
return this._defaultCurrency;
|
|
101
|
-
}
|
|
102
|
-
setDefaultCurrency(currency) {
|
|
103
|
-
this._defaultCurrency = currency;
|
|
104
|
-
}
|
|
105
|
-
verifyWebhookSignature(_payload, _signature) {
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
getCapabilities() {
|
|
109
|
-
return {
|
|
110
|
-
supportsWebhooks: false,
|
|
111
|
-
supportsRefunds: false,
|
|
112
|
-
supportsPartialRefunds: false,
|
|
113
|
-
requiresManualVerification: true
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/providers/registry.ts
|
|
120
|
-
var ProviderRegistry = class {
|
|
121
|
-
providers = /* @__PURE__ */ new Map();
|
|
122
|
-
register(name, provider) {
|
|
123
|
-
this.providers.set(name, provider);
|
|
124
|
-
}
|
|
125
|
-
get(name) {
|
|
126
|
-
const provider = this.providers.get(name);
|
|
127
|
-
if (!provider) throw new ProviderNotFoundError(name);
|
|
128
|
-
return provider;
|
|
129
|
-
}
|
|
130
|
-
has(name) {
|
|
131
|
-
return this.providers.has(name);
|
|
132
|
-
}
|
|
133
|
-
list() {
|
|
134
|
-
return Array.from(this.providers.keys());
|
|
135
|
-
}
|
|
136
|
-
setDefaultCurrency(currency) {
|
|
137
|
-
for (const provider of this.providers.values()) provider.setDefaultCurrency(currency);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
function createProviderRegistry(providers = {}, defaultCurrency) {
|
|
141
|
-
const registry = new ProviderRegistry();
|
|
142
|
-
for (const [name, provider] of Object.entries(providers)) {
|
|
143
|
-
if (defaultCurrency) provider.setDefaultCurrency(defaultCurrency);
|
|
144
|
-
registry.register(name, provider);
|
|
145
|
-
}
|
|
146
|
-
return registry;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
//#endregion
|
|
150
|
-
export { PaymentResult as a, PaymentProvider as i, createProviderRegistry as n, RefundResult as o, PaymentIntent as r, WebhookEvent as s, ProviderRegistry as t };
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
//#region src/providers/base.d.ts
|
|
2
|
-
interface CreateIntentParams {
|
|
3
|
-
amount: number;
|
|
4
|
-
currency: string;
|
|
5
|
-
metadata?: Record<string, unknown>;
|
|
6
|
-
customerId?: string;
|
|
7
|
-
returnUrl?: string;
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
}
|
|
10
|
-
interface PaymentIntentData {
|
|
11
|
-
id: string;
|
|
12
|
-
sessionId?: string | null;
|
|
13
|
-
paymentIntentId?: string | null;
|
|
14
|
-
provider: string;
|
|
15
|
-
status: string;
|
|
16
|
-
amount: number;
|
|
17
|
-
currency?: string;
|
|
18
|
-
metadata?: Record<string, unknown>;
|
|
19
|
-
clientSecret?: string;
|
|
20
|
-
paymentUrl?: string;
|
|
21
|
-
instructions?: string;
|
|
22
|
-
raw?: unknown;
|
|
23
|
-
}
|
|
24
|
-
interface PaymentResultData {
|
|
25
|
-
id: string;
|
|
26
|
-
provider: string;
|
|
27
|
-
status: 'succeeded' | 'failed' | 'processing' | 'requires_action';
|
|
28
|
-
amount?: number;
|
|
29
|
-
currency?: string;
|
|
30
|
-
paidAt?: Date;
|
|
31
|
-
metadata?: Record<string, unknown>;
|
|
32
|
-
raw?: unknown;
|
|
33
|
-
}
|
|
34
|
-
interface RefundResultData {
|
|
35
|
-
id: string;
|
|
36
|
-
provider: string;
|
|
37
|
-
status: 'succeeded' | 'failed' | 'processing';
|
|
38
|
-
amount?: number;
|
|
39
|
-
currency?: string;
|
|
40
|
-
refundedAt?: Date;
|
|
41
|
-
reason?: string;
|
|
42
|
-
metadata?: Record<string, unknown>;
|
|
43
|
-
raw?: unknown;
|
|
44
|
-
}
|
|
45
|
-
interface WebhookEventData {
|
|
46
|
-
id: string;
|
|
47
|
-
provider: string;
|
|
48
|
-
type: string;
|
|
49
|
-
data: {
|
|
50
|
-
sessionId?: string;
|
|
51
|
-
paymentIntentId?: string;
|
|
52
|
-
[key: string]: unknown;
|
|
53
|
-
};
|
|
54
|
-
createdAt?: Date;
|
|
55
|
-
raw?: unknown;
|
|
56
|
-
}
|
|
57
|
-
interface ProviderCapabilities {
|
|
58
|
-
supportsWebhooks: boolean;
|
|
59
|
-
supportsRefunds: boolean;
|
|
60
|
-
supportsPartialRefunds: boolean;
|
|
61
|
-
requiresManualVerification: boolean;
|
|
62
|
-
}
|
|
63
|
-
declare class PaymentIntent implements PaymentIntentData {
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly sessionId: string | null;
|
|
66
|
-
readonly paymentIntentId: string | null;
|
|
67
|
-
readonly provider: string;
|
|
68
|
-
readonly status: string;
|
|
69
|
-
readonly amount: number;
|
|
70
|
-
readonly currency?: string;
|
|
71
|
-
readonly metadata: Record<string, unknown>;
|
|
72
|
-
readonly clientSecret?: string;
|
|
73
|
-
readonly paymentUrl?: string;
|
|
74
|
-
readonly instructions?: string;
|
|
75
|
-
readonly raw?: unknown;
|
|
76
|
-
constructor(data: PaymentIntentData);
|
|
77
|
-
}
|
|
78
|
-
declare class PaymentResult implements PaymentResultData {
|
|
79
|
-
readonly id: string;
|
|
80
|
-
readonly provider: string;
|
|
81
|
-
readonly status: 'succeeded' | 'failed' | 'processing' | 'requires_action';
|
|
82
|
-
readonly amount?: number;
|
|
83
|
-
readonly currency?: string;
|
|
84
|
-
readonly paidAt?: Date;
|
|
85
|
-
readonly metadata: Record<string, unknown>;
|
|
86
|
-
readonly raw?: unknown;
|
|
87
|
-
constructor(data: PaymentResultData);
|
|
88
|
-
}
|
|
89
|
-
declare class RefundResult implements RefundResultData {
|
|
90
|
-
readonly id: string;
|
|
91
|
-
readonly provider: string;
|
|
92
|
-
readonly status: 'succeeded' | 'failed' | 'processing';
|
|
93
|
-
readonly amount?: number;
|
|
94
|
-
readonly currency?: string;
|
|
95
|
-
readonly refundedAt?: Date;
|
|
96
|
-
readonly reason?: string;
|
|
97
|
-
readonly metadata: Record<string, unknown>;
|
|
98
|
-
readonly raw?: unknown;
|
|
99
|
-
constructor(data: RefundResultData);
|
|
100
|
-
}
|
|
101
|
-
declare class WebhookEvent implements WebhookEventData {
|
|
102
|
-
readonly id: string;
|
|
103
|
-
readonly provider: string;
|
|
104
|
-
readonly type: string;
|
|
105
|
-
readonly data: {
|
|
106
|
-
sessionId?: string;
|
|
107
|
-
paymentIntentId?: string;
|
|
108
|
-
[key: string]: unknown;
|
|
109
|
-
};
|
|
110
|
-
readonly createdAt?: Date;
|
|
111
|
-
readonly raw?: unknown;
|
|
112
|
-
constructor(data: WebhookEventData);
|
|
113
|
-
}
|
|
114
|
-
declare abstract class PaymentProvider {
|
|
115
|
-
readonly config: Record<string, unknown>;
|
|
116
|
-
readonly name: string;
|
|
117
|
-
private _defaultCurrency;
|
|
118
|
-
constructor(config?: Record<string, unknown>);
|
|
119
|
-
get defaultCurrency(): string;
|
|
120
|
-
setDefaultCurrency(currency: string): void;
|
|
121
|
-
abstract createIntent(params: CreateIntentParams): Promise<PaymentIntent>;
|
|
122
|
-
abstract verifyPayment(intentId: string): Promise<PaymentResult>;
|
|
123
|
-
abstract getStatus(intentId: string): Promise<PaymentResult>;
|
|
124
|
-
abstract refund(paymentId: string, amount?: number | null, options?: {
|
|
125
|
-
reason?: string;
|
|
126
|
-
}): Promise<RefundResult>;
|
|
127
|
-
abstract handleWebhook(payload: unknown, headers?: Record<string, string>): Promise<WebhookEvent>;
|
|
128
|
-
verifyWebhookSignature(_payload: unknown, _signature: string): boolean;
|
|
129
|
-
getCapabilities(): ProviderCapabilities;
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/providers/registry.d.ts
|
|
133
|
-
declare class ProviderRegistry {
|
|
134
|
-
private providers;
|
|
135
|
-
register(name: string, provider: PaymentProvider): void;
|
|
136
|
-
get(name: string): PaymentProvider;
|
|
137
|
-
has(name: string): boolean;
|
|
138
|
-
list(): string[];
|
|
139
|
-
setDefaultCurrency(currency: string): void;
|
|
140
|
-
}
|
|
141
|
-
declare function createProviderRegistry(providers?: Record<string, PaymentProvider>, defaultCurrency?: string): ProviderRegistry;
|
|
142
|
-
//#endregion
|
|
143
|
-
export { PaymentIntentData as a, PaymentResultData as c, RefundResultData as d, WebhookEvent as f, PaymentIntent as i, ProviderCapabilities as l, createProviderRegistry as n, PaymentProvider as o, WebhookEventData as p, CreateIntentParams as r, PaymentResult as s, ProviderRegistry as t, RefundResult as u };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|