@classytic/revenue 1.1.2 → 1.1.3

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.
Files changed (89) hide show
  1. package/README.md +8 -7
  2. package/dist/application/services/index.d.mts +4 -0
  3. package/dist/application/services/index.mjs +3 -0
  4. package/dist/base-CsTlVQJe.d.mts +136 -0
  5. package/dist/base-DCoyIUj6.mjs +152 -0
  6. package/dist/category-resolver-DV83N8ok.mjs +284 -0
  7. package/dist/commission-split-BzB8cd39.mjs +485 -0
  8. package/dist/core/events.d.mts +294 -0
  9. package/dist/core/events.mjs +100 -0
  10. package/dist/core/index.d.mts +9 -0
  11. package/dist/core/index.mjs +8 -0
  12. package/dist/enums/index.d.mts +157 -0
  13. package/dist/enums/index.mjs +56 -0
  14. package/dist/errors-CorrWz7A.d.mts +787 -0
  15. package/dist/escrow.enums-CZGrrdg7.mjs +101 -0
  16. package/dist/{escrow.enums-CE0VQsfe.d.ts → escrow.enums-DwdLuuve.d.mts} +30 -28
  17. package/dist/idempotency-DaYcUGY1.mjs +172 -0
  18. package/dist/index-Dsp7H5Wb.d.mts +471 -0
  19. package/dist/index.d.mts +9 -0
  20. package/dist/index.mjs +38 -0
  21. package/dist/infrastructure/plugins/{index.d.ts → index.d.mts} +81 -109
  22. package/dist/infrastructure/plugins/index.mjs +345 -0
  23. package/dist/money-CvrDOijQ.mjs +271 -0
  24. package/dist/money-DPG8AtJ8.d.mts +112 -0
  25. package/dist/{payment.enums-C1BiGlRa.d.ts → payment.enums-HAuAS9Pp.d.mts} +14 -13
  26. package/dist/payment.enums-tEFVa-Xp.mjs +69 -0
  27. package/dist/plugin-BbK0OVHy.d.mts +327 -0
  28. package/dist/plugin-Cd_V04Em.mjs +210 -0
  29. package/dist/providers/index.d.mts +3 -0
  30. package/dist/providers/index.mjs +3 -0
  31. package/dist/reconciliation/{index.d.ts → index.d.mts} +90 -112
  32. package/dist/reconciliation/index.mjs +192 -0
  33. package/dist/retry-HHCOXYdn.d.mts +186 -0
  34. package/dist/revenue-9scqKSef.mjs +553 -0
  35. package/dist/schemas/index.d.mts +2665 -0
  36. package/dist/schemas/index.mjs +717 -0
  37. package/dist/schemas/validation.d.mts +375 -0
  38. package/dist/schemas/validation.mjs +325 -0
  39. package/dist/{settlement.enums-ByC1x0ye.d.ts → settlement.enums-DFhkqZEY.d.mts} +31 -29
  40. package/dist/settlement.schema-D5uWB5tP.d.mts +344 -0
  41. package/dist/settlement.service-BxuiHpNC.d.mts +594 -0
  42. package/dist/settlement.service-CUxbUTzT.mjs +2510 -0
  43. package/dist/split.enums-BrjabxIX.mjs +86 -0
  44. package/dist/split.enums-DmskfLOM.d.mts +43 -0
  45. package/dist/tax-BoCt5cEd.d.mts +61 -0
  46. package/dist/tax-EQ15DO81.mjs +162 -0
  47. package/dist/transaction.enums-pCyMFT4Z.mjs +96 -0
  48. package/dist/utils/{index.d.ts → index.d.mts} +91 -161
  49. package/dist/utils/index.mjs +346 -0
  50. package/package.json +38 -36
  51. package/dist/application/services/index.d.ts +0 -6
  52. package/dist/application/services/index.js +0 -3288
  53. package/dist/application/services/index.js.map +0 -1
  54. package/dist/core/events.d.ts +0 -455
  55. package/dist/core/events.js +0 -122
  56. package/dist/core/events.js.map +0 -1
  57. package/dist/core/index.d.ts +0 -13
  58. package/dist/core/index.js +0 -4591
  59. package/dist/core/index.js.map +0 -1
  60. package/dist/enums/index.d.ts +0 -159
  61. package/dist/enums/index.js +0 -296
  62. package/dist/enums/index.js.map +0 -1
  63. package/dist/index-DxIK0UmZ.d.ts +0 -633
  64. package/dist/index-EnfKzDbs.d.ts +0 -806
  65. package/dist/index-cLJBLUvx.d.ts +0 -478
  66. package/dist/index.d.ts +0 -43
  67. package/dist/index.js +0 -4864
  68. package/dist/index.js.map +0 -1
  69. package/dist/infrastructure/plugins/index.js +0 -292
  70. package/dist/infrastructure/plugins/index.js.map +0 -1
  71. package/dist/money-widWVD7r.d.ts +0 -111
  72. package/dist/plugin-Bb9HOE10.d.ts +0 -336
  73. package/dist/providers/index.d.ts +0 -145
  74. package/dist/providers/index.js +0 -141
  75. package/dist/providers/index.js.map +0 -1
  76. package/dist/reconciliation/index.js +0 -140
  77. package/dist/reconciliation/index.js.map +0 -1
  78. package/dist/retry-D4hFUwVk.d.ts +0 -194
  79. package/dist/schemas/index.d.ts +0 -2655
  80. package/dist/schemas/index.js +0 -841
  81. package/dist/schemas/index.js.map +0 -1
  82. package/dist/schemas/validation.d.ts +0 -384
  83. package/dist/schemas/validation.js +0 -303
  84. package/dist/schemas/validation.js.map +0 -1
  85. package/dist/settlement.schema-CpamV7ZY.d.ts +0 -343
  86. package/dist/split.enums-DG3TxQf9.d.ts +0 -42
  87. package/dist/tax-CV8A0sxl.d.ts +0 -60
  88. package/dist/utils/index.js +0 -1202
  89. package/dist/utils/index.js.map +0 -1
@@ -0,0 +1,471 @@
1
+ import { Types } from "mongoose";
2
+ import { HoldInfo, ITransaction, ITransactionCreateInput } from "@classytic/shared-types";
3
+
4
+ //#region src/shared/types/index.d.ts
5
+ /** ObjectId type from Mongoose */
6
+ type ObjectId = Types.ObjectId;
7
+ /** Generic Mongoose model interface - simplified for compatibility */
8
+ interface MongooseModel<T = unknown> {
9
+ findById(id: string | ObjectId): Promise<T | null>;
10
+ find(filter?: object): unknown;
11
+ findOne(filter?: object): Promise<T | null>;
12
+ create(data: Partial<T> | Record<string, unknown>): Promise<T>;
13
+ countDocuments?(filter?: object): Promise<number>;
14
+ count?(filter?: object): Promise<number>;
15
+ findByIdAndUpdate(id: string | ObjectId, update: object, options?: object): Promise<T | null>;
16
+ update?(id: string, data: object): Promise<T | null>;
17
+ }
18
+ /** Transaction status values */
19
+ type TransactionStatusValue = 'pending' | 'payment_initiated' | 'processing' | 'requires_action' | 'verified' | 'completed' | 'failed' | 'cancelled' | 'expired' | 'refunded' | 'partially_refunded';
20
+ /** Transaction flow values - directional money movement */
21
+ type TransactionFlowValue = 'inflow' | 'outflow';
22
+ /** Gateway information stored on transaction */
23
+ interface TransactionGateway {
24
+ type: string;
25
+ sessionId?: string | null;
26
+ paymentIntentId?: string | null;
27
+ provider?: string;
28
+ metadata?: Record<string, unknown>;
29
+ verificationData?: Record<string, unknown>;
30
+ }
31
+ /** Commission information */
32
+ interface CommissionInfo {
33
+ rate: number;
34
+ grossAmount: number;
35
+ gatewayFeeRate: number;
36
+ gatewayFeeAmount: number;
37
+ netAmount: number;
38
+ status: 'pending' | 'paid' | 'waived';
39
+ splits?: SplitInfo[];
40
+ affiliate?: {
41
+ recipientId: string;
42
+ recipientType: string;
43
+ rate: number;
44
+ grossAmount: number;
45
+ netAmount: number;
46
+ };
47
+ }
48
+ /** Webhook information */
49
+ interface WebhookInfo {
50
+ eventId: string;
51
+ eventType: string;
52
+ receivedAt: Date;
53
+ processedAt?: Date;
54
+ data: Record<string, unknown>;
55
+ }
56
+ /**
57
+ * Base transaction document interface
58
+ * Note: Implements unified transaction model (compatible with ITransaction but doesn't extend it)
59
+ */
60
+ interface TransactionDocument {
61
+ _id: ObjectId;
62
+ organizationId: string | ObjectId;
63
+ customerId?: string | ObjectId | null;
64
+ type: string;
65
+ flow: TransactionFlowValue;
66
+ tags?: string[];
67
+ status: TransactionStatusValue;
68
+ amount: number;
69
+ currency: string;
70
+ fee?: number;
71
+ tax?: number;
72
+ net: number;
73
+ taxDetails?: {
74
+ type?: 'sales_tax' | 'vat' | 'gst' | 'income_tax' | 'withholding_tax' | 'none';
75
+ rate?: number;
76
+ isInclusive?: boolean;
77
+ jurisdiction?: string;
78
+ };
79
+ method: string;
80
+ gateway?: TransactionGateway;
81
+ paymentDetails?: Record<string, unknown>;
82
+ commission?: CommissionInfo | null;
83
+ splits?: SplitInfo[];
84
+ hold?: HoldInfo;
85
+ escrow?: HoldInfo;
86
+ sourceId?: string | ObjectId;
87
+ sourceModel?: string;
88
+ relatedTransactionId?: ObjectId;
89
+ category?: string;
90
+ date?: Date;
91
+ verifiedAt?: Date;
92
+ verifiedBy?: string | ObjectId | null;
93
+ failedAt?: Date;
94
+ failureReason?: string;
95
+ refundedAmount?: number;
96
+ refundedAt?: Date;
97
+ createdAt: Date;
98
+ updatedAt: Date;
99
+ webhook?: WebhookInfo;
100
+ metadata?: Record<string, unknown>;
101
+ idempotencyKey?: string;
102
+ save(options?: {
103
+ session?: any;
104
+ }): Promise<this>;
105
+ }
106
+ /** Subscription status values */
107
+ type SubscriptionStatusValue = 'active' | 'paused' | 'cancelled' | 'expired' | 'pending' | 'inactive' | 'pending_renewal';
108
+ /** Plan key values */
109
+ type PlanKeyValue = 'monthly' | 'quarterly' | 'yearly' | string;
110
+ /** Base subscription document interface */
111
+ interface SubscriptionDocument {
112
+ _id: ObjectId;
113
+ organizationId?: string | ObjectId;
114
+ customerId?: string | ObjectId | null;
115
+ planKey: PlanKeyValue;
116
+ amount: number;
117
+ currency: string;
118
+ status: SubscriptionStatusValue;
119
+ isActive: boolean;
120
+ gateway?: string;
121
+ transactionId?: ObjectId | null;
122
+ paymentIntentId?: string | null;
123
+ startDate?: Date;
124
+ endDate?: Date;
125
+ activatedAt?: Date;
126
+ canceledAt?: Date;
127
+ cancelAt?: Date;
128
+ cancellationReason?: string | null;
129
+ pausedAt?: Date | null;
130
+ pauseReason?: string | null;
131
+ renewalCount?: number;
132
+ renewalTransactionId?: ObjectId;
133
+ metadata?: Record<string, unknown>;
134
+ createdAt: Date;
135
+ updatedAt: Date;
136
+ save(): Promise<this>;
137
+ }
138
+ /** Monetization type values */
139
+ type MonetizationTypeValue = 'free' | 'purchase' | 'subscription';
140
+ /** Hold reason values */
141
+ type HoldReasonValue = 'payment_verification' | 'fraud_check' | 'manual_review' | 'dispute' | 'compliance';
142
+ /** Release reason values */
143
+ type ReleaseReasonValue = 'payment_verified' | 'manual_release' | 'auto_release' | 'dispute_resolved';
144
+ /** Split type values */
145
+ type SplitTypeValue = 'platform_commission' | 'affiliate_commission' | 'referral_commission' | 'partner_commission' | 'custom';
146
+ /** Split status values */
147
+ type SplitStatusValue = 'pending' | 'due' | 'paid' | 'waived' | 'cancelled';
148
+ /** Split rule configuration */
149
+ interface SplitRule {
150
+ type?: SplitTypeValue;
151
+ recipientId: string;
152
+ recipientType: string;
153
+ rate: number;
154
+ dueDate?: Date | null;
155
+ metadata?: Record<string, unknown>;
156
+ }
157
+ /** Calculated split info */
158
+ interface SplitInfo {
159
+ _id?: ObjectId;
160
+ type: SplitTypeValue;
161
+ recipientId: string;
162
+ recipientType: string;
163
+ rate: number;
164
+ grossAmount: number;
165
+ gatewayFeeRate: number;
166
+ gatewayFeeAmount: number;
167
+ netAmount: number;
168
+ status: SplitStatusValue;
169
+ dueDate?: Date | null;
170
+ paidDate?: Date;
171
+ payoutTransactionId?: string;
172
+ metadata: Record<string, unknown>;
173
+ }
174
+ /** Payment intent parameters */
175
+ interface CreateIntentParams {
176
+ amount: number;
177
+ currency?: string;
178
+ metadata?: Record<string, unknown>;
179
+ }
180
+ /** Payment intent data */
181
+ interface PaymentIntentData {
182
+ id: string;
183
+ sessionId?: string | null;
184
+ paymentIntentId?: string | null;
185
+ provider: string;
186
+ status: string;
187
+ amount: number;
188
+ currency?: string;
189
+ metadata?: Record<string, unknown>;
190
+ clientSecret?: string;
191
+ paymentUrl?: string;
192
+ instructions?: string;
193
+ raw?: unknown;
194
+ }
195
+ /** Payment result data */
196
+ interface PaymentResultData {
197
+ id: string;
198
+ provider: string;
199
+ status: 'succeeded' | 'failed' | 'processing' | 'requires_action';
200
+ amount?: number;
201
+ currency?: string;
202
+ paidAt?: Date;
203
+ metadata?: Record<string, unknown>;
204
+ raw?: unknown;
205
+ }
206
+ /** Refund result data */
207
+ interface RefundResultData {
208
+ id: string;
209
+ provider: string;
210
+ status: 'succeeded' | 'failed' | 'processing';
211
+ amount?: number;
212
+ currency?: string;
213
+ refundedAt?: Date;
214
+ reason?: string;
215
+ metadata?: Record<string, unknown>;
216
+ raw?: unknown;
217
+ }
218
+ /** Webhook event data */
219
+ interface WebhookEventData {
220
+ id: string;
221
+ provider: string;
222
+ type: string;
223
+ data: {
224
+ sessionId?: string;
225
+ paymentIntentId?: string;
226
+ [key: string]: unknown;
227
+ };
228
+ createdAt?: Date;
229
+ raw?: unknown;
230
+ }
231
+ /** Provider capabilities */
232
+ interface ProviderCapabilities {
233
+ supportsWebhooks: boolean;
234
+ supportsRefunds: boolean;
235
+ supportsPartialRefunds: boolean;
236
+ requiresManualVerification: boolean;
237
+ }
238
+ /** Logger interface */
239
+ interface Logger {
240
+ info(...args: unknown[]): void;
241
+ warn(...args: unknown[]): void;
242
+ error(...args: unknown[]): void;
243
+ debug(...args: unknown[]): void;
244
+ log?(...args: unknown[]): void;
245
+ }
246
+ /** Revenue configuration */
247
+ interface RevenueConfig {
248
+ targetModels: string[];
249
+ categoryMappings: Record<string, string>;
250
+ commissionRates?: Record<string, number>;
251
+ gatewayFeeRates?: Record<string, number>;
252
+ /** Maps transaction categories to flow direction (inflow/outflow) */
253
+ transactionTypeMapping?: Record<string, TransactionFlowValue>;
254
+ }
255
+ /** Payment provider interface */
256
+ interface PaymentProviderInterface {
257
+ name: string;
258
+ config: Record<string, unknown>;
259
+ createIntent(params: CreateIntentParams): Promise<PaymentIntentData>;
260
+ verifyPayment(intentId: string): Promise<PaymentResultData>;
261
+ getStatus(intentId: string): Promise<PaymentResultData>;
262
+ refund(paymentId: string, amount?: number | null, options?: {
263
+ reason?: string;
264
+ }): Promise<RefundResultData>;
265
+ handleWebhook(payload: unknown, headers?: Record<string, string>): Promise<WebhookEventData>;
266
+ verifyWebhookSignature(payload: unknown, signature: string): boolean;
267
+ getCapabilities(): ProviderCapabilities;
268
+ }
269
+ /** Monetization create data */
270
+ interface MonetizationData {
271
+ organizationId?: string | ObjectId;
272
+ customerId?: string | ObjectId;
273
+ sourceId?: string | ObjectId;
274
+ sourceModel?: string;
275
+ }
276
+ /** Monetization create params */
277
+ interface MonetizationCreateParams {
278
+ data: MonetizationData;
279
+ planKey: string;
280
+ amount: number;
281
+ currency?: string;
282
+ gateway?: string;
283
+ entity?: string | null;
284
+ monetizationType?: MonetizationTypeValue;
285
+ paymentData?: Record<string, unknown>;
286
+ metadata?: Record<string, unknown>;
287
+ idempotencyKey?: string | null;
288
+ /** Tax data injected by tax plugin (optional) */
289
+ tax?: {
290
+ isApplicable: boolean;
291
+ rate: number;
292
+ baseAmount: number;
293
+ taxAmount: number;
294
+ totalAmount: number;
295
+ pricesIncludeTax: boolean;
296
+ type: 'collected' | 'paid' | 'exempt';
297
+ };
298
+ }
299
+ /** Monetization create result */
300
+ interface MonetizationCreateResult {
301
+ subscription: SubscriptionDocument | null;
302
+ transaction: TransactionDocument | null;
303
+ paymentIntent: PaymentIntentData | null;
304
+ }
305
+ /** Activation options */
306
+ interface ActivateOptions {
307
+ timestamp?: Date;
308
+ }
309
+ /** Renewal params */
310
+ interface RenewalParams {
311
+ gateway?: string;
312
+ entity?: string | null;
313
+ paymentData?: Record<string, unknown>;
314
+ metadata?: Record<string, unknown>;
315
+ idempotencyKey?: string | null;
316
+ }
317
+ /** Cancellation options */
318
+ interface CancelOptions {
319
+ immediate?: boolean;
320
+ reason?: string | null;
321
+ }
322
+ /** Pause options */
323
+ interface PauseOptions {
324
+ reason?: string | null;
325
+ }
326
+ /** Resume options */
327
+ interface ResumeOptions {
328
+ extendPeriod?: boolean;
329
+ }
330
+ /** List options */
331
+ interface ListOptions {
332
+ limit?: number;
333
+ skip?: number;
334
+ page?: number | null;
335
+ sort?: Record<string, 1 | -1>;
336
+ populate?: string[];
337
+ }
338
+ /** Payment verify options */
339
+ interface PaymentVerifyOptions {
340
+ verifiedBy?: string | null;
341
+ }
342
+ /** Payment verify result */
343
+ interface PaymentVerifyResult {
344
+ transaction: TransactionDocument;
345
+ paymentResult: PaymentResultData | null;
346
+ status: TransactionStatusValue;
347
+ }
348
+ /** Payment status result */
349
+ interface PaymentStatusResult {
350
+ transaction: TransactionDocument;
351
+ paymentResult?: PaymentResultData | null;
352
+ status: TransactionStatusValue | string;
353
+ provider?: string;
354
+ }
355
+ /** Refund options */
356
+ interface RefundOptions {
357
+ reason?: string | null;
358
+ }
359
+ /** Payment refund result */
360
+ interface PaymentRefundResult {
361
+ transaction: TransactionDocument;
362
+ refundTransaction: TransactionDocument;
363
+ refundResult: RefundResultData;
364
+ status: TransactionStatusValue;
365
+ }
366
+ /** Webhook result */
367
+ interface WebhookResult {
368
+ event: WebhookEventData;
369
+ transaction: TransactionDocument;
370
+ status: 'processed' | 'already_processed';
371
+ }
372
+ /** Transaction list result */
373
+ interface TransactionListResult {
374
+ transactions: TransactionDocument[];
375
+ total: number;
376
+ page: number;
377
+ limit: number;
378
+ pages: number;
379
+ }
380
+ /** Hold options */
381
+ interface HoldOptions {
382
+ reason?: HoldReasonValue;
383
+ holdUntil?: Date | null;
384
+ metadata?: Record<string, unknown>;
385
+ }
386
+ /** Release options */
387
+ interface ReleaseOptions {
388
+ amount?: number | null;
389
+ recipientId: string;
390
+ recipientType?: string;
391
+ reason?: ReleaseReasonValue;
392
+ releasedBy?: string | null;
393
+ createTransaction?: boolean;
394
+ metadata?: Record<string, unknown>;
395
+ }
396
+ /** Release result */
397
+ interface ReleaseResult {
398
+ transaction: TransactionDocument;
399
+ releaseTransaction: TransactionDocument | null;
400
+ releaseAmount: number;
401
+ isFullRelease: boolean;
402
+ isPartialRelease: boolean;
403
+ }
404
+ /** Cancel hold options */
405
+ interface CancelHoldOptions {
406
+ reason?: string;
407
+ metadata?: Record<string, unknown>;
408
+ }
409
+ /** Split result */
410
+ interface SplitResult {
411
+ transaction: TransactionDocument;
412
+ splits: SplitInfo[];
413
+ splitTransactions: TransactionDocument[];
414
+ organizationTransaction: TransactionDocument | null;
415
+ organizationPayout: number;
416
+ }
417
+ /** Escrow status result */
418
+ interface EscrowStatusResult {
419
+ transaction: TransactionDocument;
420
+ hold: HoldInfo | null;
421
+ splits: SplitInfo[];
422
+ hasHold: boolean;
423
+ hasSplits: boolean;
424
+ }
425
+ /** Period range params */
426
+ interface PeriodRangeParams {
427
+ currentEndDate?: Date | null;
428
+ startDate?: Date | null;
429
+ duration: number;
430
+ unit?: 'days' | 'weeks' | 'months' | 'years';
431
+ now?: Date;
432
+ }
433
+ /** Period range result */
434
+ interface PeriodRangeResult {
435
+ startDate: Date;
436
+ endDate: Date;
437
+ }
438
+ /** Prorated amount params */
439
+ interface ProratedAmountParams {
440
+ amountPaid: number;
441
+ startDate: Date;
442
+ endDate: Date;
443
+ asOfDate?: Date;
444
+ precision?: number;
445
+ }
446
+ /** Duration result */
447
+ interface DurationResult {
448
+ duration: number;
449
+ unit: 'days' | 'weeks' | 'months' | 'years';
450
+ }
451
+ /** Subscription entity for action checks */
452
+ interface SubscriptionEntity {
453
+ subscription?: {
454
+ isActive?: boolean;
455
+ endDate?: Date;
456
+ canceledAt?: Date;
457
+ };
458
+ status?: SubscriptionStatusValue;
459
+ }
460
+ /** Transaction type detection options */
461
+ interface TransactionTypeOptions {
462
+ targetModels?: string[];
463
+ additionalCategories?: string[];
464
+ }
465
+ /** Field update validation result */
466
+ interface FieldUpdateValidationResult {
467
+ allowed: boolean;
468
+ reason?: string;
469
+ }
470
+ //#endregion
471
+ export { ReleaseOptions as A, TransactionDocument as B, PaymentVerifyResult as C, ProviderCapabilities as D, ProratedAmountParams as E, SplitInfo as F, WebhookResult as G, TransactionListResult as H, SplitResult as I, ITransaction as K, SplitRule as L, RenewalParams as M, ResumeOptions as N, RefundOptions as O, RevenueConfig as P, SubscriptionDocument as R, PaymentVerifyOptions as S, PeriodRangeResult as T, TransactionTypeOptions as U, TransactionFlowValue as V, WebhookEventData as W, PaymentIntentData as _, CreateIntentParams as a, PaymentResultData as b, FieldUpdateValidationResult as c, Logger as d, MonetizationCreateParams as f, PauseOptions as g, MongooseModel as h, CommissionInfo as i, ReleaseResult as j, RefundResultData as k, HoldOptions as l, MonetizationTypeValue as m, CancelHoldOptions as n, DurationResult as o, MonetizationCreateResult as p, ITransactionCreateInput as q, CancelOptions as r, EscrowStatusResult as s, ActivateOptions as t, ListOptions as u, PaymentProviderInterface as v, PeriodRangeParams as w, PaymentStatusResult as x, PaymentRefundResult as y, SubscriptionEntity as z };
@@ -0,0 +1,9 @@
1
+ import "./settlement.service-BxuiHpNC.mjs";
2
+ import { K as ITransaction, q as ITransactionCreateInput } from "./index-Dsp7H5Wb.mjs";
3
+ import "./settlement.schema-D5uWB5tP.mjs";
4
+ import { a as WebhookEvent, i as RefundResult, n as PaymentProvider, r as PaymentResult, t as PaymentIntent } from "./base-CsTlVQJe.mjs";
5
+ import "./plugin-BbK0OVHy.mjs";
6
+ import { S as unwrapOr, c as Ok, d as err, l as Result, m as isOk, p as isErr, s as Err, v as ok, x as unwrap } from "./retry-HHCOXYdn.mjs";
7
+ import { A as SUBSCRIPTION_STATE_MACHINE, B as Revenue, C as TransactionNotFoundError, D as HOLD_STATE_MACHINE, E as isRevenueError, F as filterAuditTrail, H as RevenueOptions, I as getAuditTrail, L as getLastStateChange, M as StateMachine, N as StateChangeEvent, O as SETTLEMENT_STATE_MACHINE, P as appendAuditEvent, R as ModelsConfig, S as SubscriptionNotFoundError, T as isRetryable, U as createRevenue, V as RevenueBuilder, _ as RefundNotSupportedError, a as InvalidAmountError, b as StateError, c as ModelNotRegisteredError, d as PaymentIntentCreationError, f as PaymentVerificationError, g as RefundError, h as ProviderNotFoundError, i as ErrorCode, j as TRANSACTION_STATE_MACHINE, k as SPLIT_STATE_MACHINE, l as NotFoundError, m as ProviderError, n as ConfigurationError, o as InvalidStateTransitionError, p as ProviderCapabilityError, r as ERROR_CODES, s as MissingRequiredFieldError, t as AlreadyVerifiedError, u as OperationError, v as RevenueError, w as ValidationError, x as SubscriptionNotActiveError, y as RevenueErrorOptions, z as ProvidersConfig } from "./errors-CorrWz7A.mjs";
8
+ import { i as toSmallestUnit, n as MoneyValue, r as fromSmallestUnit, t as Money } from "./money-DPG8AtJ8.mjs";
9
+ export { AlreadyVerifiedError, ConfigurationError, ERROR_CODES, type Err, ErrorCode, HOLD_STATE_MACHINE, type ITransaction, type ITransactionCreateInput, InvalidAmountError, InvalidStateTransitionError, MissingRequiredFieldError, ModelNotRegisteredError, type ModelsConfig, Money, type MoneyValue, NotFoundError, type Ok, OperationError, PaymentIntent, PaymentIntentCreationError, PaymentProvider, PaymentResult, PaymentVerificationError, ProviderCapabilityError, ProviderError, ProviderNotFoundError, type ProvidersConfig, RefundError, RefundNotSupportedError, RefundResult, Result, Revenue, RevenueBuilder, RevenueError, RevenueErrorOptions, type RevenueOptions, SETTLEMENT_STATE_MACHINE, SPLIT_STATE_MACHINE, SUBSCRIPTION_STATE_MACHINE, type StateChangeEvent, StateError, StateMachine, SubscriptionNotActiveError, SubscriptionNotFoundError, TRANSACTION_STATE_MACHINE, TransactionNotFoundError, ValidationError, WebhookEvent, appendAuditEvent, createRevenue, err, filterAuditTrail, fromSmallestUnit, getAuditTrail, getLastStateChange, isErr, isOk, isRetryable, isRevenueError, ok, toSmallestUnit, unwrap, unwrapOr };
package/dist/index.mjs ADDED
@@ -0,0 +1,38 @@
1
+ import { n as RevenueBuilder, r as createRevenue, t as Revenue } from "./revenue-9scqKSef.mjs";
2
+ import { S as unwrapOr, d as err, l as Result, m as isOk, p as isErr, v as ok, x as unwrap } from "./commission-split-BzB8cd39.mjs";
3
+ import { C as ValidationError, S as TransactionNotFoundError, T as isRevenueError, _ as RefundNotSupportedError, a as InvalidAmountError, b as SubscriptionNotActiveError, c as ModelNotRegisteredError, d as PaymentIntentCreationError, f as PaymentVerificationError, g as RefundError, h as ProviderNotFoundError, i as ERROR_CODES, l as NotFoundError, m as ProviderError, n as AlreadyVerifiedError, o as InvalidStateTransitionError, p as ProviderCapabilityError, r as ConfigurationError, s as MissingRequiredFieldError, u as OperationError, v as RevenueError, w as isRetryable, x as SubscriptionNotFoundError, y as StateError } from "./category-resolver-DV83N8ok.mjs";
4
+ import { c as getAuditTrail, d as SETTLEMENT_STATE_MACHINE, f as SPLIT_STATE_MACHINE, h as StateMachine, l as getLastStateChange, m as TRANSACTION_STATE_MACHINE, o as appendAuditEvent, p as SUBSCRIPTION_STATE_MACHINE, s as filterAuditTrail, u as HOLD_STATE_MACHINE } from "./settlement.service-CUxbUTzT.mjs";
5
+ import { a as WebhookEvent, i as RefundResult, n as PaymentProvider, r as PaymentResult, t as PaymentIntent } from "./base-DCoyIUj6.mjs";
6
+ import { n as fromSmallestUnit, r as toSmallestUnit, t as Money } from "./money-CvrDOijQ.mjs";
7
+
8
+ //#region src/index.ts
9
+ /**
10
+ * For advanced features, import from submodules:
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // Plugins
15
+ * import { loggingPlugin, auditPlugin, createTaxPlugin } from '@classytic/revenue/plugins';
16
+ *
17
+ * // Enums
18
+ * import { TRANSACTION_STATUS, PAYMENT_STATUS } from '@classytic/revenue/enums';
19
+ *
20
+ * // Events
21
+ * import { EventBus, type RevenueEvents } from '@classytic/revenue/events';
22
+ *
23
+ * // Schemas
24
+ * import { CreatePaymentSchema, transactionSchema } from '@classytic/revenue/schemas';
25
+ *
26
+ * // Utilities
27
+ * import { retry, calculateCommission } from '@classytic/revenue/utils';
28
+ *
29
+ * // Services (advanced)
30
+ * import { MonetizationService } from '@classytic/revenue/services';
31
+ *
32
+ * // Reconciliation
33
+ * import { reconcileSettlement } from '@classytic/revenue/reconciliation';
34
+ * ```
35
+ */
36
+
37
+ //#endregion
38
+ export { AlreadyVerifiedError, ConfigurationError, ERROR_CODES, HOLD_STATE_MACHINE, InvalidAmountError, InvalidStateTransitionError, MissingRequiredFieldError, ModelNotRegisteredError, Money, NotFoundError, OperationError, PaymentIntent, PaymentIntentCreationError, PaymentProvider, PaymentResult, PaymentVerificationError, ProviderCapabilityError, ProviderError, ProviderNotFoundError, RefundError, RefundNotSupportedError, RefundResult, Result, Revenue, RevenueBuilder, RevenueError, SETTLEMENT_STATE_MACHINE, SPLIT_STATE_MACHINE, SUBSCRIPTION_STATE_MACHINE, StateError, StateMachine, SubscriptionNotActiveError, SubscriptionNotFoundError, TRANSACTION_STATE_MACHINE, TransactionNotFoundError, ValidationError, WebhookEvent, appendAuditEvent, createRevenue, err, filterAuditTrail, fromSmallestUnit, getAuditTrail, getLastStateChange, isErr, isOk, isRetryable, isRevenueError, ok, toSmallestUnit, unwrap, unwrapOr };