@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
|
@@ -98,13 +98,27 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
98
98
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
99
99
|
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
100
|
type: z.ZodString;
|
|
101
|
+
amount: z.ZodNumber;
|
|
102
|
+
currency: z.ZodString;
|
|
103
|
+
status: z.ZodDefault<z.ZodString>;
|
|
104
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
105
|
+
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
101
106
|
flow: z.ZodEnum<{
|
|
102
107
|
inflow: "inflow";
|
|
103
108
|
outflow: "outflow";
|
|
104
109
|
}>;
|
|
110
|
+
gateway: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
type: z.ZodString;
|
|
112
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
113
|
+
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
chargeId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
|
+
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
sourceId: z.ZodOptional<z.ZodString>;
|
|
119
|
+
sourceModel: z.ZodOptional<z.ZodString>;
|
|
120
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
105
121
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
106
|
-
amount: z.ZodNumber;
|
|
107
|
-
currency: z.ZodString;
|
|
108
122
|
fee: z.ZodDefault<z.ZodNumber>;
|
|
109
123
|
tax: z.ZodDefault<z.ZodNumber>;
|
|
110
124
|
net: z.ZodDefault<z.ZodNumber>;
|
|
@@ -118,16 +132,6 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
118
132
|
isInclusive: z.ZodOptional<z.ZodBoolean>;
|
|
119
133
|
}, z.core.$strip>>;
|
|
120
134
|
method: z.ZodString;
|
|
121
|
-
status: z.ZodDefault<z.ZodString>;
|
|
122
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
123
|
-
gateway: z.ZodOptional<z.ZodObject<{
|
|
124
|
-
type: z.ZodString;
|
|
125
|
-
sessionId: z.ZodOptional<z.ZodString>;
|
|
126
|
-
paymentIntentId: z.ZodOptional<z.ZodString>;
|
|
127
|
-
chargeId: z.ZodOptional<z.ZodString>;
|
|
128
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
129
|
-
verificationData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
130
|
-
}, z.core.$strip>>;
|
|
131
135
|
paymentDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
136
|
commission: z.ZodOptional<z.ZodObject<{
|
|
133
137
|
rate: z.ZodNumber;
|
|
@@ -168,10 +172,6 @@ declare const transactionCreateSchema: z.ZodObject<{
|
|
|
168
172
|
}, z.core.$strip>>>;
|
|
169
173
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
170
174
|
}, z.core.$strip>>;
|
|
171
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
172
|
-
sourceModel: z.ZodOptional<z.ZodString>;
|
|
173
|
-
relatedTransactionId: z.ZodOptional<z.ZodString>;
|
|
174
|
-
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
175
175
|
}, z.core.$strip>;
|
|
176
176
|
declare const transactionUpdateSchema: z.ZodObject<{
|
|
177
177
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -317,18 +317,18 @@ declare const subscriptionBaseSchema: z.ZodObject<{
|
|
|
317
317
|
declare const subscriptionCreateSchema: z.ZodObject<{
|
|
318
318
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
319
319
|
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
+
planKey: z.ZodString;
|
|
320
321
|
amount: z.ZodNumber;
|
|
321
322
|
currency: z.ZodOptional<z.ZodString>;
|
|
322
|
-
paymentIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
323
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
324
323
|
transactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
325
|
-
|
|
324
|
+
paymentIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
326
325
|
startDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
327
326
|
endDate: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
328
327
|
pauseReason: z.ZodOptional<z.ZodString>;
|
|
329
328
|
cancelAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
330
329
|
cancellationReason: z.ZodOptional<z.ZodString>;
|
|
331
330
|
renewalTransactionId: z.ZodOptional<z.ZodString>;
|
|
331
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
332
332
|
}, z.core.$strip>;
|
|
333
333
|
declare const subscriptionUpdateSchema: z.ZodObject<{
|
|
334
334
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -387,12 +387,12 @@ declare const settlementBaseSchema: z.ZodObject<{
|
|
|
387
387
|
}>;
|
|
388
388
|
status: z.ZodDefault<z.ZodString>;
|
|
389
389
|
payoutMethod: z.ZodEnum<{
|
|
390
|
+
manual: "manual";
|
|
390
391
|
bank_transfer: "bank_transfer";
|
|
391
392
|
mobile_wallet: "mobile_wallet";
|
|
392
393
|
platform_balance: "platform_balance";
|
|
393
394
|
crypto: "crypto";
|
|
394
395
|
check: "check";
|
|
395
|
-
manual: "manual";
|
|
396
396
|
}>;
|
|
397
397
|
amount: z.ZodNumber;
|
|
398
398
|
currency: z.ZodString;
|
|
@@ -443,6 +443,7 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
443
443
|
amount: z.ZodNumber;
|
|
444
444
|
currency: z.ZodString;
|
|
445
445
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
446
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
446
447
|
recipientId: z.ZodString;
|
|
447
448
|
recipientType: z.ZodEnum<{
|
|
448
449
|
platform: "platform";
|
|
@@ -452,12 +453,12 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
452
453
|
partner: "partner";
|
|
453
454
|
}>;
|
|
454
455
|
payoutMethod: z.ZodEnum<{
|
|
456
|
+
manual: "manual";
|
|
455
457
|
bank_transfer: "bank_transfer";
|
|
456
458
|
mobile_wallet: "mobile_wallet";
|
|
457
459
|
platform_balance: "platform_balance";
|
|
458
460
|
crypto: "crypto";
|
|
459
461
|
check: "check";
|
|
460
|
-
manual: "manual";
|
|
461
462
|
}>;
|
|
462
463
|
sourceTransactionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
463
464
|
sourceSplitIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -485,7 +486,6 @@ declare const settlementCreateSchema: z.ZodObject<{
|
|
|
485
486
|
transferredAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
486
487
|
}, z.core.$strip>>;
|
|
487
488
|
scheduledAt: z.ZodDefault<z.ZodCoercedDate<unknown>>;
|
|
488
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
489
489
|
}, z.core.$strip>;
|
|
490
490
|
declare const settlementUpdateSchema: z.ZodObject<{
|
|
491
491
|
publicId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
@@ -506,12 +506,12 @@ declare const settlementUpdateSchema: z.ZodObject<{
|
|
|
506
506
|
}>>;
|
|
507
507
|
status: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
508
508
|
payoutMethod: z.ZodOptional<z.ZodEnum<{
|
|
509
|
+
manual: "manual";
|
|
509
510
|
bank_transfer: "bank_transfer";
|
|
510
511
|
mobile_wallet: "mobile_wallet";
|
|
511
512
|
platform_balance: "platform_balance";
|
|
512
513
|
crypto: "crypto";
|
|
513
514
|
check: "check";
|
|
514
|
-
manual: "manual";
|
|
515
515
|
}>>;
|
|
516
516
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
517
517
|
currency: z.ZodOptional<z.ZodString>;
|
|
@@ -37,6 +37,12 @@ const REVENUE_EVENTS = {
|
|
|
37
37
|
SUBSCRIPTION_PAUSED: "revenue:subscription.paused",
|
|
38
38
|
SUBSCRIPTION_RESUMED: "revenue:subscription.resumed",
|
|
39
39
|
TRANSACTION_UPDATED: "revenue:transaction.updated",
|
|
40
|
+
TRANSACTION_IMPORTED: "revenue:transaction.imported",
|
|
41
|
+
TRANSACTION_MATCHED: "revenue:transaction.matched",
|
|
42
|
+
TRANSACTION_UNMATCHED: "revenue:transaction.unmatched",
|
|
43
|
+
TRANSACTION_JOURNALIZED: "revenue:transaction.journalized",
|
|
44
|
+
TRANSACTION_REJECTED: "revenue:transaction.rejected",
|
|
45
|
+
TRANSACTION_REMOVED_BY_FEED: "revenue:transaction.removed_by_feed",
|
|
40
46
|
ESCROW_HELD: "revenue:escrow.held",
|
|
41
47
|
ESCROW_RELEASED: "revenue:escrow.released",
|
|
42
48
|
ESCROW_CANCELLED: "revenue:escrow.cancelled",
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
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-JpJcyK1E.mjs";
|
|
2
2
|
import { DomainEvent, EventHandler, EventTransport } from "@classytic/primitives/events";
|
|
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, TransactionUpdated, type TransactionUpdatedPayload, WebhookProcessed, type WebhookProcessedPayload, createEvent, revenueEventDefinitions };
|
|
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 { C as SubscriptionResumed, D as
|
|
1
|
+
import { n as createEvent, t as REVENUE_EVENTS } from "../event-constants-CTiDNWzc.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-CgZ57M-f.mjs";
|
|
3
3
|
|
|
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, TransactionUpdated, WebhookProcessed, createEvent, revenueEventDefinitions };
|
|
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
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { t as RevenueContext } from "./context-
|
|
2
|
-
import { a as CurrencyBridge, c as LedgerBridge, i as CustomerBridge, o as NotificationBridge, r as AnalyticsBridge, s as TaxBridge, t as RevenueBridges } from "./revenue-bridges-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
1
|
+
import { t as RevenueContext } from "./context-pjP1QeE3.mjs";
|
|
2
|
+
import { a as CurrencyBridge, c as LedgerBridge, i as CustomerBridge, o as NotificationBridge, r as AnalyticsBridge, s as TaxBridge, t as RevenueBridges } from "./revenue-bridges-BtkWFsJu.mjs";
|
|
3
|
+
import { A as SettlementStatus, B as HoldReason, C as isPayoutMethod, D as SETTLEMENT_STATUS_VALUES, E as SETTLEMENT_STATUS, F as isSettlementType, G as RELEASE_REASON_VALUES, H as HoldStatus, I as HOLD_REASON, J as isHoldReason, K as ReleaseReason, L as HOLD_REASON_VALUES, M as SettlementType, N as SettlementTypeValue, O as SETTLEMENT_TYPE, P as isSettlementStatus, R as HOLD_STATUS, S as SplitTypeValue, T as isSplitType, U as HoldStatusValue, V as HoldReasonValue, W as RELEASE_REASON, X as isReleaseReason, Y as isHoldStatus, _ as SPLIT_TYPE, a as SUBSCRIPTION_STATUS, b as SplitStatusValue, c as SubscriptionStatusValue, d as PAYOUT_METHOD, f as PAYOUT_METHOD_VALUES, g as SPLIT_STATUS_VALUES, h as SPLIT_STATUS, i as PlanKeys, j as SettlementStatusValue, k as SETTLEMENT_TYPE_VALUES, l as isPlanKey, m as PayoutMethodValue, n as PLAN_KEY_VALUES, o as SUBSCRIPTION_STATUS_VALUES, p as PayoutMethod, q as ReleaseReasonValue, r as PlanKeyValue, s as SubscriptionStatus, t as PLAN_KEYS, u as isSubscriptionStatus, v as SPLIT_TYPE_VALUES, w as isSplitStatus, x as SplitType, y as SplitStatus, z as HOLD_STATUS_VALUES } from "./subscription.enums-k24kLpF7.mjs";
|
|
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
|
+
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
|
+
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-JpJcyK1E.mjs";
|
|
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-txFXOiQS.mjs";
|
|
9
10
|
import { RepositoryPluginBundle, RevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
10
|
-
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 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-
|
|
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-9yh4Q-aQ.mjs";
|
|
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";
|
|
12
13
|
import { HookHandler, PluginContext, PluginManager, RevenuePluginDefinition } from "./plugins/plugin.interface.mjs";
|
|
13
14
|
import { DomainEvent, EventHandler, EventTransport } from "@classytic/primitives/events";
|
|
14
15
|
import { InvalidOutboxEventError, OutboxAcknowledgeOptions, OutboxClaimOptions, OutboxErrorInfo, OutboxFailOptions, OutboxFailureContext, OutboxFailureDecision, OutboxFailurePolicy, OutboxOwnershipError, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
|
|
@@ -73,5 +74,14 @@ declare class RefundNotSupportedError extends RevenueError {
|
|
|
73
74
|
declare class PaymentVerificationError extends RevenueError {
|
|
74
75
|
constructor(message: string, details?: Record<string, unknown>);
|
|
75
76
|
}
|
|
77
|
+
declare class BankFeedImportError extends RevenueError {
|
|
78
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
79
|
+
}
|
|
80
|
+
declare class WrongTransactionKindError extends RevenueError {
|
|
81
|
+
constructor(transactionId: string, expected: string, actual: string);
|
|
82
|
+
}
|
|
83
|
+
declare class BankFeedProviderNotFoundError extends RevenueError {
|
|
84
|
+
constructor(providerName: string);
|
|
85
|
+
}
|
|
76
86
|
//#endregion
|
|
77
|
-
export { AlreadyVerifiedError, type AnalyticsBridge, CURRENCIES, type CommissionConfig, type CommissionInfo, ConfigurationError, type
|
|
87
|
+
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, 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,23 +1,29 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
1
|
+
import { _ as TRANSACTION_STATUS, a as TRANSACTION_KIND, b as isTransactionFlow, c as isBankFeedSource, d as isTransactionKind, f as statusesForKind, g as TRANSACTION_FLOW_VALUES, h as TRANSACTION_FLOW, i as BANK_FEED_STATUS_VALUES, l as isBankFeedStatus, m as LIBRARY_CATEGORY_VALUES, n as BANK_FEED_SOURCE_VALUES, o as TRANSACTION_KIND_VALUES, p as LIBRARY_CATEGORIES, r as BANK_FEED_STATUS, s as initialStatusFor, t as BANK_FEED_SOURCE, u as isStatusValidForKind, v as TRANSACTION_STATUS_VALUES, x as isTransactionStatus, y as isLibraryCategory } from "./bank-feed.enums-kYTLTTbe.mjs";
|
|
2
|
+
import { n as createEvent, t as REVENUE_EVENTS } from "./event-constants-CTiDNWzc.mjs";
|
|
3
|
+
import { A as isReleaseReason, C as HOLD_REASON_VALUES, D as RELEASE_REASON_VALUES, E as RELEASE_REASON, O as isHoldReason, S as HOLD_REASON, T as HOLD_STATUS_VALUES, _ as SETTLEMENT_STATUS_VALUES, a as isPlanKey, b as isSettlementStatus, c as PAYOUT_METHOD_VALUES, d as SPLIT_TYPE, f as SPLIT_TYPE_VALUES, g as SETTLEMENT_STATUS, h as isSplitType, i as SUBSCRIPTION_STATUS_VALUES, k as isHoldStatus, l as SPLIT_STATUS, m as isSplitStatus, n as PLAN_KEY_VALUES, o as isSubscriptionStatus, p as isPayoutMethod, r as SUBSCRIPTION_STATUS, s as PAYOUT_METHOD, t as PLAN_KEYS, u as SPLIT_STATUS_VALUES, v as SETTLEMENT_TYPE, w as HOLD_STATUS, x as isSettlementType, y as SETTLEMENT_TYPE_VALUES } from "./subscription.enums-DoIr56O6.mjs";
|
|
4
|
+
import { a as InvalidStateTransitionError, c as ProviderCapabilityError, d as RevenueError, f as SettlementNotFoundError, g as WrongTransactionKindError, h as ValidationError, i as ConfigurationError, l as ProviderNotFoundError, m as TransactionNotFoundError, n as BankFeedImportError, o as PaymentIntentCreationError, p as SubscriptionNotFoundError, r as BankFeedProviderNotFoundError, s as PaymentVerificationError, t as AlreadyVerifiedError, u as RefundNotSupportedError } from "./errors-Dt46UZL_.mjs";
|
|
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, StateMachine, TRANSACTION_STATE_MACHINE, smFor } from "./core/state-machines.mjs";
|
|
6
|
+
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-D8XkNWgX.mjs";
|
|
7
|
+
import { n as SubscriptionRepository, r as TransactionRepository, t as SettlementRepository } from "./settlement.repository-Ba2U17zY.mjs";
|
|
7
8
|
import { createRevenueRepositories } from "./repositories/create-repositories.mjs";
|
|
8
|
-
import { a as
|
|
9
|
-
import {
|
|
10
|
-
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-
|
|
11
|
-
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 { 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-
|
|
9
|
+
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "./bank-feed-DJtLvz_7.mjs";
|
|
10
|
+
import { M as revenueEventDefinitions, N as InProcessRevenueBus } from "./revenue-event-catalog-CgZ57M-f.mjs";
|
|
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-C-b41z_G.mjs";
|
|
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";
|
|
13
14
|
import { PluginManager } from "./plugins/plugin.interface.mjs";
|
|
14
|
-
import { customIdPlugin, multiTenantPlugin, prefixedId, softDeletePlugin } from "@classytic/mongokit";
|
|
15
|
-
import { resolveTenantConfig } from "@classytic/
|
|
15
|
+
import { batchOperationsPlugin, customIdPlugin, methodRegistryPlugin, multiTenantPlugin, prefixedId, softDeletePlugin } from "@classytic/mongokit";
|
|
16
|
+
import { resolveTenantConfig } from "@classytic/repo-core/tenant";
|
|
16
17
|
import mongoose, { Schema } from "mongoose";
|
|
17
18
|
import { InvalidOutboxEventError, OutboxOwnershipError } from "@classytic/primitives/outbox";
|
|
18
19
|
import { err, isErr, isOk, ok } from "@classytic/primitives/result";
|
|
19
20
|
|
|
20
21
|
//#region src/models/transaction.schema.ts
|
|
22
|
+
const NO_BANK_FEED_INDEXES = {
|
|
23
|
+
idempotentImport: false,
|
|
24
|
+
byAccount: false,
|
|
25
|
+
matchCandidates: false
|
|
26
|
+
};
|
|
21
27
|
function buildTransactionSchema(config) {
|
|
22
28
|
const fields = {
|
|
23
29
|
publicId: { type: String },
|
|
@@ -25,6 +31,13 @@ function buildTransactionSchema(config) {
|
|
|
25
31
|
type: String,
|
|
26
32
|
default: null
|
|
27
33
|
},
|
|
34
|
+
kind: {
|
|
35
|
+
type: String,
|
|
36
|
+
enum: TRANSACTION_KIND_VALUES,
|
|
37
|
+
default: TRANSACTION_KIND.PAYMENT_FLOW,
|
|
38
|
+
required: true,
|
|
39
|
+
index: true
|
|
40
|
+
},
|
|
28
41
|
type: {
|
|
29
42
|
type: String,
|
|
30
43
|
required: true
|
|
@@ -56,6 +69,9 @@ function buildTransactionSchema(config) {
|
|
|
56
69
|
default: 0
|
|
57
70
|
},
|
|
58
71
|
taxDetails: { type: Schema.Types.Mixed },
|
|
72
|
+
fxRate: { type: Number },
|
|
73
|
+
originalAmount: { type: Number },
|
|
74
|
+
originalCurrency: { type: String },
|
|
59
75
|
method: {
|
|
60
76
|
type: String,
|
|
61
77
|
required: true
|
|
@@ -64,11 +80,27 @@ function buildTransactionSchema(config) {
|
|
|
64
80
|
type: String,
|
|
65
81
|
default: "pending"
|
|
66
82
|
},
|
|
83
|
+
approvals: {
|
|
84
|
+
type: Schema.Types.Mixed,
|
|
85
|
+
default: null
|
|
86
|
+
},
|
|
67
87
|
gateway: { type: Schema.Types.Mixed },
|
|
68
88
|
paymentDetails: { type: Schema.Types.Mixed },
|
|
69
89
|
commission: { type: Schema.Types.Mixed },
|
|
70
90
|
splits: [{ type: Schema.Types.Mixed }],
|
|
71
91
|
hold: { type: Schema.Types.Mixed },
|
|
92
|
+
externalId: { type: String },
|
|
93
|
+
postedDate: { type: Date },
|
|
94
|
+
valueDate: { type: Date },
|
|
95
|
+
description: { type: String },
|
|
96
|
+
counterparty: { type: Schema.Types.Mixed },
|
|
97
|
+
reference: { type: String },
|
|
98
|
+
balanceAfter: { type: Number },
|
|
99
|
+
vendorCategory: { type: String },
|
|
100
|
+
bankAccountId: { type: String },
|
|
101
|
+
source: { type: String },
|
|
102
|
+
journalEntryRef: { type: Schema.Types.Mixed },
|
|
103
|
+
matching: { type: Schema.Types.Mixed },
|
|
72
104
|
sourceId: { type: String },
|
|
73
105
|
sourceModel: { type: String },
|
|
74
106
|
relatedTransactionId: {
|
|
@@ -103,6 +135,32 @@ function buildTransactionSchema(config) {
|
|
|
103
135
|
sourceId: 1,
|
|
104
136
|
sourceModel: 1
|
|
105
137
|
});
|
|
138
|
+
schema.index({
|
|
139
|
+
kind: 1,
|
|
140
|
+
status: 1,
|
|
141
|
+
createdAt: -1
|
|
142
|
+
});
|
|
143
|
+
schema.index({ relatedTransactionId: 1 }, { sparse: true });
|
|
144
|
+
const bfi = config.bankFeedIndexes ?? NO_BANK_FEED_INDEXES;
|
|
145
|
+
if (bfi.byAccount) schema.index({
|
|
146
|
+
bankAccountId: 1,
|
|
147
|
+
postedDate: -1
|
|
148
|
+
}, {
|
|
149
|
+
partialFilterExpression: { bankAccountId: { $type: "string" } },
|
|
150
|
+
name: "bank_feed_by_account"
|
|
151
|
+
});
|
|
152
|
+
if (bfi.matchCandidates) {
|
|
153
|
+
schema.index({
|
|
154
|
+
kind: 1,
|
|
155
|
+
amount: 1,
|
|
156
|
+
postedDate: -1
|
|
157
|
+
}, { name: "match_candidates_by_amount_date" });
|
|
158
|
+
schema.index({
|
|
159
|
+
kind: 1,
|
|
160
|
+
amount: 1,
|
|
161
|
+
createdAt: -1
|
|
162
|
+
}, { name: "match_candidates_by_amount_createdat" });
|
|
163
|
+
}
|
|
106
164
|
if (config.extraIndexes) for (const idx of config.extraIndexes) schema.index(idx.fields, idx.options);
|
|
107
165
|
return schema;
|
|
108
166
|
}
|
|
@@ -151,6 +209,10 @@ function buildSubscriptionSchema(config) {
|
|
|
151
209
|
canceledAt: { type: Date },
|
|
152
210
|
cancelAt: { type: Date },
|
|
153
211
|
cancellationReason: { type: String },
|
|
212
|
+
approvals: {
|
|
213
|
+
type: Schema.Types.Mixed,
|
|
214
|
+
default: null
|
|
215
|
+
},
|
|
154
216
|
renewalTransactionId: {
|
|
155
217
|
type: Schema.Types.ObjectId,
|
|
156
218
|
ref: txnRef
|
|
@@ -207,6 +269,10 @@ function buildSettlementSchema(config) {
|
|
|
207
269
|
type: String,
|
|
208
270
|
default: "pending"
|
|
209
271
|
},
|
|
272
|
+
approvals: {
|
|
273
|
+
type: Schema.Types.Mixed,
|
|
274
|
+
default: null
|
|
275
|
+
},
|
|
210
276
|
payoutMethod: {
|
|
211
277
|
type: String,
|
|
212
278
|
required: true
|
|
@@ -282,7 +348,7 @@ function buildSettlementSchema(config) {
|
|
|
282
348
|
* The field storage type follows `scope.fieldType` (`'objectId'` →
|
|
283
349
|
* `Schema.Types.ObjectId` + `ref`, `'string'` → `String`). No hardcoding
|
|
284
350
|
* here — callers must pass a `ResolvedTenantConfig` from
|
|
285
|
-
* `@classytic/
|
|
351
|
+
* `@classytic/repo-core/tenant` via `resolveTenantConfig(...)`.
|
|
286
352
|
*/
|
|
287
353
|
function injectTenantField(schema, scope) {
|
|
288
354
|
schema.add({ [scope.tenantField]: {
|
|
@@ -325,7 +391,7 @@ var RevenueModelCollisionError = class extends Error {
|
|
|
325
391
|
}
|
|
326
392
|
};
|
|
327
393
|
function createRevenueModels(options) {
|
|
328
|
-
const { connection, scope, schemaOptions = {}, modules = {}, collectionPrefix, forceRecreate } = options;
|
|
394
|
+
const { connection, scope, schemaOptions = {}, modules = {}, collectionPrefix, forceRecreate, bankFeedIndexes } = options;
|
|
329
395
|
const prefix = collectionPrefix ?? "";
|
|
330
396
|
if (forceRecreate) {
|
|
331
397
|
for (const name of REVENUE_MODEL_NAMES) if (connection.models[name]) connection.deleteModel(name);
|
|
@@ -333,7 +399,8 @@ function createRevenueModels(options) {
|
|
|
333
399
|
const txnSchema = buildTransactionSchema({
|
|
334
400
|
scoped: scope.enabled,
|
|
335
401
|
extraFields: schemaOptions.transaction?.extraFields,
|
|
336
|
-
extraIndexes: schemaOptions.transaction?.extraIndexes
|
|
402
|
+
extraIndexes: schemaOptions.transaction?.extraIndexes,
|
|
403
|
+
...bankFeedIndexes ? { bankFeedIndexes } : {}
|
|
337
404
|
});
|
|
338
405
|
injectTenantField(txnSchema, scope);
|
|
339
406
|
txnSchema.index({ "gateway.sessionId": 1 }, { sparse: true });
|
|
@@ -349,6 +416,23 @@ function createRevenueModels(options) {
|
|
|
349
416
|
publicId: { $type: "string" }
|
|
350
417
|
}
|
|
351
418
|
});
|
|
419
|
+
if (bankFeedIndexes?.idempotentImport) if (scope.enabled && scope.strategy === "field") txnSchema.index({
|
|
420
|
+
[scope.tenantField]: 1,
|
|
421
|
+
bankAccountId: 1,
|
|
422
|
+
externalId: 1
|
|
423
|
+
}, {
|
|
424
|
+
unique: true,
|
|
425
|
+
partialFilterExpression: { externalId: { $type: "string" } },
|
|
426
|
+
name: "bank_feed_idempotent_import"
|
|
427
|
+
});
|
|
428
|
+
else txnSchema.index({
|
|
429
|
+
bankAccountId: 1,
|
|
430
|
+
externalId: 1
|
|
431
|
+
}, {
|
|
432
|
+
unique: true,
|
|
433
|
+
partialFilterExpression: { externalId: { $type: "string" } },
|
|
434
|
+
name: "bank_feed_idempotent_import"
|
|
435
|
+
});
|
|
352
436
|
const models = { Transaction: connection.model("Transaction", txnSchema, prefix + DEFAULT_COLLECTIONS.Transaction) };
|
|
353
437
|
if (modules.subscription !== false) {
|
|
354
438
|
const subSchema = buildSubscriptionSchema({
|
|
@@ -388,10 +472,23 @@ function createRevenueModels(options) {
|
|
|
388
472
|
* See PACKAGE_RULES §13–§14.
|
|
389
473
|
*/
|
|
390
474
|
async function createRevenue(config) {
|
|
475
|
+
const bankFeedRaw = config.modules?.bankFeed;
|
|
476
|
+
const bankFeedEnabled = bankFeedRaw === false ? false : typeof bankFeedRaw === "object" && bankFeedRaw !== null ? bankFeedRaw.enabled !== false : true;
|
|
477
|
+
const userIndexCfg = typeof bankFeedRaw === "object" && bankFeedRaw !== null ? bankFeedRaw.indexes : void 0;
|
|
478
|
+
const bankFeedIndexes = bankFeedEnabled ? {
|
|
479
|
+
idempotentImport: userIndexCfg?.idempotentImport ?? true,
|
|
480
|
+
byAccount: userIndexCfg?.byAccount ?? true,
|
|
481
|
+
matchCandidates: userIndexCfg?.matchCandidates ?? false
|
|
482
|
+
} : {
|
|
483
|
+
idempotentImport: false,
|
|
484
|
+
byAccount: false,
|
|
485
|
+
matchCandidates: false
|
|
486
|
+
};
|
|
391
487
|
const modules = {
|
|
392
488
|
subscription: config.modules?.subscription !== false,
|
|
393
489
|
escrow: config.modules?.escrow ?? false,
|
|
394
|
-
settlement: config.modules?.settlement ?? false
|
|
490
|
+
settlement: config.modules?.settlement ?? false,
|
|
491
|
+
bankFeed: bankFeedEnabled
|
|
395
492
|
};
|
|
396
493
|
const scope = resolveTenantConfig(config.scope);
|
|
397
494
|
const events = config.eventTransport ?? new InProcessRevenueBus({ logger: config.logger });
|
|
@@ -400,6 +497,7 @@ async function createRevenue(config) {
|
|
|
400
497
|
scope,
|
|
401
498
|
schemaOptions: config.schemaOptions,
|
|
402
499
|
modules,
|
|
500
|
+
bankFeedIndexes,
|
|
403
501
|
...config.collectionPrefix !== void 0 ? { collectionPrefix: config.collectionPrefix } : {},
|
|
404
502
|
...config.forceRecreate !== void 0 ? { forceRecreate: config.forceRecreate } : {}
|
|
405
503
|
});
|
|
@@ -424,16 +522,18 @@ async function createRevenue(config) {
|
|
|
424
522
|
return plugins;
|
|
425
523
|
};
|
|
426
524
|
const repositories = createRevenueRepositories(models, {
|
|
427
|
-
transaction: buildPlugins("txn"),
|
|
525
|
+
transaction: buildPlugins("txn", modules.bankFeed ? [methodRegistryPlugin(), batchOperationsPlugin()] : []),
|
|
428
526
|
subscription: buildPlugins("sub"),
|
|
429
527
|
settlement: buildPlugins("stl")
|
|
430
528
|
}, config.repositoryPlugins);
|
|
431
529
|
const providers = createProviderRegistry(config.providers ?? {}, config.defaultCurrency);
|
|
530
|
+
const bankFeedProviders = createBankFeedProviderRegistry(config.bankFeedProviders ?? {});
|
|
432
531
|
const commission = typeof config.modules?.commission === "object" ? config.modules.commission : config.commission;
|
|
433
532
|
repositories.transaction.inject({
|
|
434
533
|
events,
|
|
435
534
|
outbox: config.outbox,
|
|
436
535
|
providers,
|
|
536
|
+
bankFeedProviders,
|
|
437
537
|
bridges: config.bridges ?? {},
|
|
438
538
|
commission,
|
|
439
539
|
defaultCurrency: config.defaultCurrency,
|
|
@@ -460,6 +560,7 @@ async function createRevenue(config) {
|
|
|
460
560
|
models,
|
|
461
561
|
repositories,
|
|
462
562
|
providers,
|
|
563
|
+
bankFeedProviders,
|
|
463
564
|
events,
|
|
464
565
|
async syncIndexes() {
|
|
465
566
|
await Promise.all(Object.values(models).filter(Boolean).map((m) => m.createIndexes()));
|
|
@@ -471,4 +572,4 @@ async function createRevenue(config) {
|
|
|
471
572
|
}
|
|
472
573
|
|
|
473
574
|
//#endregion
|
|
474
|
-
export { AlreadyVerifiedError, CURRENCIES, ConfigurationError, CurrencyMismatchError, HOLD_REASON, HOLD_REASON_VALUES, HOLD_STATE_MACHINE, HOLD_STATUS, HOLD_STATUS_VALUES, InProcessRevenueBus, InvalidOutboxEventError, InvalidStateTransitionError, LIBRARY_CATEGORIES, LIBRARY_CATEGORY_VALUES, MINOR_UNIT_FACTOR, MONETIZATION_TYPES, MONETIZATION_TYPE_VALUES, OutboxOwnershipError, PAYMENT_GATEWAY_TYPE, PAYMENT_GATEWAY_TYPE_VALUES, PAYMENT_STATUS, PAYMENT_STATUS_VALUES, PAYOUT_METHOD, PAYOUT_METHOD_VALUES, PLAN_KEYS, PLAN_KEY_VALUES,
|
|
575
|
+
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, 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 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
1
|
+
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";
|
|
2
|
+
export { BankFeedProvider, type BankFeedProviderCapabilities, BankFeedProviderRegistry, type FetchTransactionsParams, type FetchTransactionsResult, type ParseUploadParams, type ParseUploadResult, PaymentProvider, ProviderRegistry, createBankFeedProviderRegistry, createProviderRegistry };
|
package/dist/providers/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as createProviderRegistry, i as ProviderRegistry, n as BankFeedProviderRegistry, o as PaymentProvider, r as createBankFeedProviderRegistry, t as BankFeedProvider } from "../bank-feed-DJtLvz_7.mjs";
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { BankFeedProvider, BankFeedProviderRegistry, PaymentProvider, ProviderRegistry, createBankFeedProviderRegistry, createProviderRegistry };
|