@classytic/revenue 0.0.24 → 0.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.
Files changed (56) hide show
  1. package/README.md +131 -19
  2. package/core/builder.js +39 -0
  3. package/dist/types/core/builder.d.ts +87 -0
  4. package/dist/types/core/container.d.ts +57 -0
  5. package/dist/types/core/errors.d.ts +122 -0
  6. package/dist/types/enums/escrow.enums.d.ts +24 -0
  7. package/dist/types/enums/index.d.ts +69 -0
  8. package/dist/types/enums/monetization.enums.d.ts +6 -0
  9. package/dist/types/enums/payment.enums.d.ts +16 -0
  10. package/dist/types/enums/split.enums.d.ts +25 -0
  11. package/dist/types/enums/subscription.enums.d.ts +15 -0
  12. package/dist/types/enums/transaction.enums.d.ts +24 -0
  13. package/dist/types/index.d.ts +22 -0
  14. package/dist/types/providers/base.d.ts +126 -0
  15. package/dist/types/schemas/escrow/hold.schema.d.ts +54 -0
  16. package/dist/types/schemas/escrow/index.d.ts +6 -0
  17. package/dist/types/schemas/index.d.ts +506 -0
  18. package/dist/types/schemas/split/index.d.ts +8 -0
  19. package/dist/types/schemas/split/split.schema.d.ts +142 -0
  20. package/dist/types/schemas/subscription/index.d.ts +152 -0
  21. package/dist/types/schemas/subscription/info.schema.d.ts +128 -0
  22. package/dist/types/schemas/subscription/plan.schema.d.ts +39 -0
  23. package/dist/types/schemas/transaction/common.schema.d.ts +12 -0
  24. package/dist/types/schemas/transaction/gateway.schema.d.ts +86 -0
  25. package/dist/types/schemas/transaction/index.d.ts +202 -0
  26. package/dist/types/schemas/transaction/payment.schema.d.ts +145 -0
  27. package/dist/types/services/escrow.service.d.ts +51 -0
  28. package/dist/types/services/payment.service.d.ts +80 -0
  29. package/dist/types/services/subscription.service.d.ts +138 -0
  30. package/dist/types/services/transaction.service.d.ts +40 -0
  31. package/dist/types/utils/category-resolver.d.ts +46 -0
  32. package/dist/types/utils/commission-split.d.ts +56 -0
  33. package/dist/types/utils/commission.d.ts +29 -0
  34. package/dist/types/utils/hooks.d.ts +17 -0
  35. package/dist/types/utils/index.d.ts +6 -0
  36. package/dist/types/utils/logger.d.ts +12 -0
  37. package/dist/types/utils/subscription/actions.d.ts +28 -0
  38. package/dist/types/utils/subscription/index.d.ts +2 -0
  39. package/dist/types/utils/subscription/period.d.ts +47 -0
  40. package/dist/types/utils/transaction-type.d.ts +102 -0
  41. package/enums/escrow.enums.js +36 -0
  42. package/enums/index.js +36 -0
  43. package/enums/split.enums.js +37 -0
  44. package/index.js +6 -0
  45. package/package.json +91 -74
  46. package/schemas/escrow/hold.schema.js +62 -0
  47. package/schemas/escrow/index.js +15 -0
  48. package/schemas/index.js +6 -0
  49. package/schemas/split/index.js +16 -0
  50. package/schemas/split/split.schema.js +86 -0
  51. package/services/escrow.service.js +353 -0
  52. package/services/payment.service.js +54 -3
  53. package/services/subscription.service.js +15 -9
  54. package/utils/commission-split.js +180 -0
  55. package/utils/index.js +6 -0
  56. package/revenue.d.ts +0 -350
package/README.md CHANGED
@@ -9,6 +9,9 @@ Thin, focused, production-ready library with smart defaults. Built for SaaS, mar
9
9
  - **Subscriptions**: Create, renew, pause, cancel with lifecycle management
10
10
  - **Payment Processing**: Multi-gateway support (Stripe, SSLCommerz, manual, etc.)
11
11
  - **Transaction Management**: Income/expense tracking with verification and refunds
12
+ - **Escrow & Hold/Release**: Platform-as-intermediary payment flow (NEW in v0.1.0)
13
+ - **Multi-Party Splits**: Distribute revenue to platform, affiliates, partners (NEW)
14
+ - **Affiliate Commissions**: Built-in support for referral/affiliate programs (NEW)
12
15
  - **Commission Tracking**: Automatic platform commission calculation with gateway fee deduction
13
16
  - **Provider Pattern**: Pluggable payment providers (like LangChain/Vercel AI SDK)
14
17
  - **Framework Agnostic**: Works with Express, Fastify, Next.js, or standalone
@@ -21,41 +24,51 @@ npm install @classytic/revenue
21
24
  npm install @classytic/revenue-manual # For manual payments
22
25
  ```
23
26
 
24
- ## Quick Start (30 seconds)
27
+ ## Quick Start
28
+
29
+ ### Single-Tenant (Simple SaaS)
25
30
 
26
31
  ```javascript
27
32
  import { createRevenue } from '@classytic/revenue';
28
33
  import { ManualProvider } from '@classytic/revenue-manual';
29
- import Transaction from './models/Transaction.js';
30
34
 
31
- // 1. Configure
32
35
  const revenue = createRevenue({
33
36
  models: { Transaction },
34
37
  providers: { manual: new ManualProvider() },
35
38
  });
36
39
 
37
- // 2. Create subscription
38
- const { subscription, transaction } = await revenue.subscriptions.create({
39
- data: {
40
- organizationId,
41
- customerId,
42
- referenceId: orderId, // Optional: Link to Order, Subscription, etc.
43
- referenceModel: 'Order', // Optional: Model name for polymorphic ref
44
- },
40
+ // Create subscription (no organizationId needed)
41
+ const { transaction } = await revenue.subscriptions.create({
42
+ data: { customerId: user._id },
45
43
  planKey: 'monthly',
46
- amount: 1500,
44
+ amount: 2999, // $29.99
47
45
  gateway: 'manual',
48
- paymentData: { method: 'bkash', walletNumber: '01712345678' },
46
+ paymentData: { method: 'card' },
49
47
  });
50
48
 
51
- // 3. Verify payment
49
+ // Verify → Refund
52
50
  await revenue.payments.verify(transaction.gateway.paymentIntentId);
51
+ ```
52
+
53
+ ### Multi-Tenant (Marketplace/Platform)
53
54
 
54
- // 4. Refund if needed
55
- await revenue.payments.refund(transaction._id, 500, { reason: 'Partial refund' });
55
+ ```javascript
56
+ // Same API, just pass organizationId
57
+ const { transaction } = await revenue.subscriptions.create({
58
+ data: {
59
+ organizationId: vendor._id, // ← Multi-tenant
60
+ customerId: customer._id,
61
+ referenceId: order._id,
62
+ referenceModel: 'Order',
63
+ },
64
+ planKey: 'monthly',
65
+ amount: 1500,
66
+ gateway: 'manual',
67
+ paymentData: { method: 'bkash' },
68
+ });
56
69
  ```
57
70
 
58
- **That's it!** Working revenue system in 3 steps.
71
+ **Works for both!** Same API, different use cases.
59
72
 
60
73
  ## Transaction Model Setup
61
74
 
@@ -74,12 +87,14 @@ import {
74
87
 
75
88
  const transactionSchema = new mongoose.Schema({
76
89
  // ============ REQUIRED BY LIBRARY ============
77
- organizationId: { type: String, required: true, index: true },
78
90
  amount: { type: Number, required: true, min: 0 },
79
91
  type: { type: String, enum: TRANSACTION_TYPE_VALUES, required: true }, // 'income' | 'expense'
80
92
  method: { type: String, required: true }, // 'manual' | 'bkash' | 'card' | etc.
81
93
  status: { type: String, enum: TRANSACTION_STATUS_VALUES, required: true },
82
94
  category: { type: String, required: true }, // Your custom categories
95
+
96
+ // ============ MULTI-TENANT (optional) ============
97
+ organizationId: { type: String, index: true }, // For multi-tenant platforms
83
98
 
84
99
  // ============ LIBRARY SCHEMAS (nested) ============
85
100
  gateway: gatewaySchema, // Payment gateway details
@@ -346,6 +361,103 @@ if (canRenewSubscription(membership)) {
346
361
  }
347
362
  ```
348
363
 
364
+ ## Escrow & Multi-Party Splits (v0.1.0+)
365
+
366
+ **NEW:** Platform-as-intermediary payment flow for marketplaces, group buy, and affiliate systems.
367
+
368
+ ### Basic Escrow Flow
369
+
370
+ ```javascript
371
+ // 1. Customer makes purchase
372
+ const { transaction } = await revenue.subscriptions.create({
373
+ amount: 1000,
374
+ gateway: 'stripe',
375
+ // ...
376
+ });
377
+
378
+ // 2. Verify payment
379
+ await revenue.payments.verify(transaction._id);
380
+
381
+ // 3. Hold in escrow
382
+ await revenue.escrow.hold(transaction._id);
383
+
384
+ // 4. Split to multiple recipients
385
+ await revenue.escrow.split(transaction._id, [
386
+ { type: 'platform_commission', recipientId: 'platform', rate: 0.10 },
387
+ { type: 'affiliate_commission', recipientId: 'affiliate-123', rate: 0.05 },
388
+ ]);
389
+ // Auto-releases remainder to organization (85%)
390
+
391
+ // Or manually release
392
+ await revenue.escrow.release(transaction._id, {
393
+ recipientId: 'org-123',
394
+ recipientType: 'organization',
395
+ });
396
+ ```
397
+
398
+ ### Affiliate Commission (Simplified API)
399
+
400
+ ```javascript
401
+ import { calculateCommissionWithSplits } from '@classytic/revenue';
402
+
403
+ const commission = calculateCommissionWithSplits(
404
+ 5000, // amount
405
+ 0.10, // platform rate
406
+ 0.029, // gateway fee
407
+ {
408
+ affiliateRate: 0.05,
409
+ affiliateId: 'affiliate-123',
410
+ }
411
+ );
412
+
413
+ // Returns:
414
+ // {
415
+ // grossAmount: 500, // Platform: 10%
416
+ // netAmount: 355, // After gateway fee (2.9%)
417
+ // affiliate: {
418
+ // grossAmount: 250, // Affiliate: 5%
419
+ // netAmount: 250,
420
+ // },
421
+ // splits: [...]
422
+ // }
423
+ ```
424
+
425
+ ### Multi-Party Splits
426
+
427
+ ```javascript
428
+ import { calculateSplits } from '@classytic/revenue';
429
+
430
+ const splits = calculateSplits(10000, [
431
+ { type: 'platform_commission', recipientId: 'platform', rate: 0.10 },
432
+ { type: 'affiliate_commission', recipientId: 'level1', rate: 0.05 },
433
+ { type: 'affiliate_commission', recipientId: 'level2', rate: 0.02 },
434
+ { type: 'partner_commission', recipientId: 'partner', rate: 0.03 },
435
+ ], 0.029); // Gateway fee
436
+
437
+ // Returns splits array with calculated amounts
438
+ // Organization receives: 8000 (80%)
439
+ ```
440
+
441
+ ### Schemas for Escrow
442
+
443
+ Add to your transaction model when using escrow:
444
+
445
+ ```javascript
446
+ import { holdSchema, splitsSchema } from '@classytic/revenue';
447
+
448
+ TransactionSchema.add(holdSchema); // Adds hold/release tracking
449
+ TransactionSchema.add(splitsSchema); // Adds multi-party splits
450
+ ```
451
+
452
+ **Use Cases:**
453
+ - E-commerce marketplaces (hold until delivery confirmed)
454
+ - Course platforms with affiliates
455
+ - Group buy / crowdfunding
456
+ - Multi-level marketing
457
+ - SaaS reseller programs
458
+
459
+ **See:** [`ESCROW_FEATURES.md`](../../ESCROW_FEATURES.md) and [`examples/escrow-flow.js`](examples/escrow-flow.js)
460
+
349
461
  ## Polymorphic References
350
462
 
351
463
  Link transactions to any entity (Order, Subscription, Enrollment):
@@ -483,7 +595,7 @@ const subscription = await revenue.subscriptions.create({ ... });
483
595
 
484
596
  ## Examples
485
597
 
486
- - [`examples/basic-usage.js`](examples/basic-usage.js) - Quick start guide
598
+ - [`examples/single-tenant.js`](examples/single-tenant.js) - Simple SaaS (no organizations)
487
599
  - [`examples/transaction.model.js`](examples/transaction.model.js) - Complete model setup
488
600
  - [`examples/complete-flow.js`](examples/complete-flow.js) - Full lifecycle (types, refs, state)
489
601
  - [`examples/commission-tracking.js`](examples/commission-tracking.js) - Commission calculation
package/core/builder.js CHANGED
@@ -10,6 +10,8 @@ import { Container } from './container.js';
10
10
  import { SubscriptionService } from '../services/subscription.service.js';
11
11
  import { PaymentService } from '../services/payment.service.js';
12
12
  import { TransactionService } from '../services/transaction.service.js';
13
+ import { EscrowService } from '../services/escrow.service.js';
14
+ import { ConfigurationError } from './errors.js';
13
15
 
14
16
  /**
15
17
  * Create revenue instance with dependency injection
@@ -62,6 +64,14 @@ export function createRevenue(options = {}) {
62
64
 
63
65
  // Register providers
64
66
  const providers = options.providers || {};
67
+
68
+ // Validate provider interface in non-production
69
+ if (process.env.NODE_ENV !== 'production') {
70
+ for (const [name, provider] of Object.entries(providers)) {
71
+ validateProvider(name, provider);
72
+ }
73
+ }
74
+
65
75
  container.singleton('providers', providers);
66
76
 
67
77
  // Register hooks
@@ -83,6 +93,7 @@ export function createRevenue(options = {}) {
83
93
  subscriptions: null,
84
94
  payments: null,
85
95
  transactions: null,
96
+ escrow: null,
86
97
  };
87
98
 
88
99
  // Create revenue instance
@@ -135,6 +146,17 @@ export function createRevenue(options = {}) {
135
146
  return services.transactions;
136
147
  },
137
148
 
149
+ /**
150
+ * Escrow service
151
+ * Lazy-loaded on first access
152
+ */
153
+ get escrow() {
154
+ if (!services.escrow) {
155
+ services.escrow = new EscrowService(container);
156
+ }
157
+ return services.escrow;
158
+ },
159
+
138
160
  /**
139
161
  * Get a specific provider
140
162
  */
@@ -155,6 +177,22 @@ export function createRevenue(options = {}) {
155
177
  return revenue;
156
178
  }
157
179
 
180
+ /**
181
+ * Validate provider implements required interface
182
+ * @private
183
+ */
184
+ function validateProvider(name, provider) {
185
+ const required = ['createIntent', 'verifyPayment', 'getStatus', 'getCapabilities'];
186
+ const missing = required.filter(method => typeof provider[method] !== 'function');
187
+
188
+ if (missing.length > 0) {
189
+ throw new ConfigurationError(
190
+ `Provider "${name}" is missing required methods: ${missing.join(', ')}`,
191
+ { provider: name, missing }
192
+ );
193
+ }
194
+ }
195
+
158
196
  /**
159
197
  * Revenue instance type (for documentation)
160
198
  * @typedef {Object} Revenue
@@ -164,6 +202,7 @@ export function createRevenue(options = {}) {
164
202
  * @property {SubscriptionService} subscriptions - Subscription service
165
203
  * @property {PaymentService} payments - Payment service
166
204
  * @property {TransactionService} transactions - Transaction service
205
+ * @property {EscrowService} escrow - Escrow service
167
206
  * @property {Function} getProvider - Get payment provider
168
207
  */
169
208
 
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Create revenue instance with dependency injection
3
+ *
4
+ * @param {Object} options - Configuration options
5
+ * @param {Object} options.models - Mongoose models { Transaction, Subscription, etc. }
6
+ * @param {Object} options.providers - Payment providers { manual, stripe, etc. }
7
+ * @param {Object} options.hooks - Event hooks
8
+ * @param {Object} options.config - Additional configuration
9
+ * @param {Object} options.logger - Logger instance
10
+ * @returns {Revenue} Revenue instance
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * import { createRevenue, ManualProvider } from '@classytic/revenue';
15
+ *
16
+ * const revenue = createRevenue({
17
+ * models: {
18
+ * Transaction: TransactionModel,
19
+ * Subscription: SubscriptionModel,
20
+ * },
21
+ * providers: {
22
+ * manual: new ManualProvider(),
23
+ * },
24
+ * config: {
25
+ * targetModels: ['Subscription', 'Membership'],
26
+ * categoryMappings: {
27
+ * Subscription: 'platform_subscription',
28
+ * Membership: 'gym_membership',
29
+ * },
30
+ * },
31
+ * });
32
+ *
33
+ * // Use anywhere
34
+ * const subscription = await revenue.subscriptions.create({ ... });
35
+ * await revenue.payments.verify(txnId);
36
+ * ```
37
+ */
38
+ export function createRevenue(options?: {
39
+ models: any;
40
+ providers: any;
41
+ hooks: any;
42
+ config: any;
43
+ logger: any;
44
+ }): Revenue;
45
+ export default createRevenue;
46
+ /**
47
+ * Revenue instance type (for documentation)
48
+ */
49
+ export type Revenue = {
50
+ /**
51
+ * - DI container (readonly)
52
+ */
53
+ container: Container;
54
+ /**
55
+ * - Payment providers (readonly, frozen)
56
+ */
57
+ providers: any;
58
+ /**
59
+ * - Configuration (readonly, frozen)
60
+ */
61
+ config: any;
62
+ /**
63
+ * - Subscription service
64
+ */
65
+ subscriptions: SubscriptionService;
66
+ /**
67
+ * - Payment service
68
+ */
69
+ payments: PaymentService;
70
+ /**
71
+ * - Transaction service
72
+ */
73
+ transactions: TransactionService;
74
+ /**
75
+ * - Escrow service
76
+ */
77
+ escrow: EscrowService;
78
+ /**
79
+ * - Get payment provider
80
+ */
81
+ getProvider: Function;
82
+ };
83
+ import { Container } from './container.js';
84
+ import { SubscriptionService } from '../services/subscription.service.js';
85
+ import { PaymentService } from '../services/payment.service.js';
86
+ import { TransactionService } from '../services/transaction.service.js';
87
+ import { EscrowService } from '../services/escrow.service.js';
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Dependency Injection Container
3
+ * @classytic/revenue
4
+ *
5
+ * Lightweight DI container for managing dependencies
6
+ * Inspired by: Awilix, InversifyJS but much simpler
7
+ */
8
+ export class Container {
9
+ _services: Map<any, any>;
10
+ _singletons: Map<any, any>;
11
+ /**
12
+ * Register a service
13
+ * @param {string} name - Service name
14
+ * @param {any} implementation - Service implementation or factory
15
+ * @param {Object} options - Registration options
16
+ */
17
+ register(name: string, implementation: any, options?: any): this;
18
+ /**
19
+ * Register a singleton service
20
+ * @param {string} name - Service name
21
+ * @param {any} implementation - Service implementation
22
+ */
23
+ singleton(name: string, implementation: any): this;
24
+ /**
25
+ * Register a transient service (new instance each time)
26
+ * @param {string} name - Service name
27
+ * @param {Function} factory - Factory function
28
+ */
29
+ transient(name: string, factory: Function): this;
30
+ /**
31
+ * Get a service from the container
32
+ * @param {string} name - Service name
33
+ * @returns {any} Service instance
34
+ */
35
+ get(name: string): any;
36
+ /**
37
+ * Check if service is registered
38
+ * @param {string} name - Service name
39
+ * @returns {boolean}
40
+ */
41
+ has(name: string): boolean;
42
+ /**
43
+ * Get all registered service names
44
+ * @returns {string[]}
45
+ */
46
+ keys(): string[];
47
+ /**
48
+ * Clear all services (useful for testing)
49
+ */
50
+ clear(): void;
51
+ /**
52
+ * Create a child container (for scoped dependencies)
53
+ * @returns {Container}
54
+ */
55
+ createScope(): Container;
56
+ }
57
+ export default Container;
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Check if error is retryable
3
+ */
4
+ export function isRetryable(error: any): any;
5
+ /**
6
+ * Check if error is from revenue package
7
+ */
8
+ export function isRevenueError(error: any): error is RevenueError;
9
+ /**
10
+ * Revenue Error Classes
11
+ * @classytic/revenue
12
+ *
13
+ * Typed errors with codes for better error handling
14
+ */
15
+ /**
16
+ * Base Revenue Error
17
+ */
18
+ export class RevenueError extends Error {
19
+ constructor(message: any, code: any, options?: {});
20
+ code: any;
21
+ retryable: any;
22
+ metadata: any;
23
+ toJSON(): {
24
+ name: string;
25
+ message: string;
26
+ code: any;
27
+ retryable: any;
28
+ metadata: any;
29
+ };
30
+ }
31
+ /**
32
+ * Configuration Errors
33
+ */
34
+ export class ConfigurationError extends RevenueError {
35
+ constructor(message: any, metadata?: {});
36
+ }
37
+ export class ModelNotRegisteredError extends ConfigurationError {
38
+ constructor(modelName: any);
39
+ }
40
+ /**
41
+ * Provider Errors
42
+ */
43
+ export class ProviderError extends RevenueError {
44
+ }
45
+ export class ProviderNotFoundError extends ProviderError {
46
+ constructor(providerName: any, availableProviders?: any[]);
47
+ }
48
+ export class ProviderCapabilityError extends ProviderError {
49
+ constructor(providerName: any, capability: any);
50
+ }
51
+ export class PaymentIntentCreationError extends ProviderError {
52
+ constructor(providerName: any, originalError: any);
53
+ }
54
+ export class PaymentVerificationError extends ProviderError {
55
+ constructor(paymentIntentId: any, reason: any);
56
+ }
57
+ /**
58
+ * Resource Not Found Errors
59
+ */
60
+ export class NotFoundError extends RevenueError {
61
+ }
62
+ export class SubscriptionNotFoundError extends NotFoundError {
63
+ constructor(subscriptionId: any);
64
+ }
65
+ export class TransactionNotFoundError extends NotFoundError {
66
+ constructor(transactionId: any);
67
+ }
68
+ /**
69
+ * Validation Errors
70
+ */
71
+ export class ValidationError extends RevenueError {
72
+ constructor(message: any, metadata?: {});
73
+ }
74
+ export class InvalidAmountError extends ValidationError {
75
+ constructor(amount: any);
76
+ }
77
+ export class MissingRequiredFieldError extends ValidationError {
78
+ constructor(fieldName: any);
79
+ }
80
+ /**
81
+ * State Errors
82
+ */
83
+ export class StateError extends RevenueError {
84
+ }
85
+ export class AlreadyVerifiedError extends StateError {
86
+ constructor(transactionId: any);
87
+ }
88
+ export class InvalidStateTransitionError extends StateError {
89
+ constructor(resourceType: any, resourceId: any, fromState: any, toState: any);
90
+ }
91
+ export class SubscriptionNotActiveError extends StateError {
92
+ constructor(subscriptionId: any);
93
+ }
94
+ /**
95
+ * Operation Errors
96
+ */
97
+ export class OperationError extends RevenueError {
98
+ }
99
+ export class RefundNotSupportedError extends OperationError {
100
+ constructor(providerName: any);
101
+ }
102
+ export class RefundError extends OperationError {
103
+ constructor(transactionId: any, reason: any);
104
+ }
105
+ export namespace ERROR_CODES {
106
+ let CONFIGURATION_ERROR: string;
107
+ let MODEL_NOT_REGISTERED: string;
108
+ let PROVIDER_NOT_FOUND: string;
109
+ let PROVIDER_CAPABILITY_NOT_SUPPORTED: string;
110
+ let PAYMENT_INTENT_CREATION_FAILED: string;
111
+ let PAYMENT_VERIFICATION_FAILED: string;
112
+ let SUBSCRIPTION_NOT_FOUND: string;
113
+ let TRANSACTION_NOT_FOUND: string;
114
+ let VALIDATION_ERROR: string;
115
+ let INVALID_AMOUNT: string;
116
+ let MISSING_REQUIRED_FIELD: string;
117
+ let ALREADY_VERIFIED: string;
118
+ let INVALID_STATE_TRANSITION: string;
119
+ let SUBSCRIPTION_NOT_ACTIVE: string;
120
+ let REFUND_NOT_SUPPORTED: string;
121
+ let REFUND_FAILED: string;
122
+ }
@@ -0,0 +1,24 @@
1
+ export namespace HOLD_STATUS {
2
+ let PENDING: string;
3
+ let HELD: string;
4
+ let RELEASED: string;
5
+ let CANCELLED: string;
6
+ let EXPIRED: string;
7
+ let PARTIALLY_RELEASED: string;
8
+ }
9
+ export const HOLD_STATUS_VALUES: string[];
10
+ export namespace RELEASE_REASON {
11
+ let PAYMENT_VERIFIED: string;
12
+ let MANUAL_RELEASE: string;
13
+ let AUTO_RELEASE: string;
14
+ let DISPUTE_RESOLVED: string;
15
+ }
16
+ export const RELEASE_REASON_VALUES: string[];
17
+ export namespace HOLD_REASON {
18
+ let PAYMENT_VERIFICATION: string;
19
+ let FRAUD_CHECK: string;
20
+ let MANUAL_REVIEW: string;
21
+ let DISPUTE: string;
22
+ let COMPLIANCE: string;
23
+ }
24
+ export const HOLD_REASON_VALUES: string[];
@@ -0,0 +1,69 @@
1
+ export * from "./transaction.enums.js";
2
+ export * from "./payment.enums.js";
3
+ export * from "./subscription.enums.js";
4
+ export * from "./monetization.enums.js";
5
+ export * from "./escrow.enums.js";
6
+ export * from "./split.enums.js";
7
+ declare namespace _default {
8
+ export { TRANSACTION_TYPE };
9
+ export { TRANSACTION_TYPE_VALUES };
10
+ export { TRANSACTION_STATUS };
11
+ export { TRANSACTION_STATUS_VALUES };
12
+ export { LIBRARY_CATEGORIES };
13
+ export { LIBRARY_CATEGORY_VALUES };
14
+ export { PAYMENT_STATUS };
15
+ export { PAYMENT_STATUS_VALUES };
16
+ export { PAYMENT_GATEWAY_TYPE };
17
+ export { PAYMENT_GATEWAY_TYPE_VALUES };
18
+ export { GATEWAY_TYPES };
19
+ export { GATEWAY_TYPE_VALUES };
20
+ export { SUBSCRIPTION_STATUS };
21
+ export { SUBSCRIPTION_STATUS_VALUES };
22
+ export { PLAN_KEYS };
23
+ export { PLAN_KEY_VALUES };
24
+ export { MONETIZATION_TYPES };
25
+ export { MONETIZATION_TYPE_VALUES };
26
+ export { HOLD_STATUS };
27
+ export { HOLD_STATUS_VALUES };
28
+ export { RELEASE_REASON };
29
+ export { RELEASE_REASON_VALUES };
30
+ export { HOLD_REASON };
31
+ export { HOLD_REASON_VALUES };
32
+ export { SPLIT_TYPE };
33
+ export { SPLIT_TYPE_VALUES };
34
+ export { SPLIT_STATUS };
35
+ export { SPLIT_STATUS_VALUES };
36
+ export { PAYOUT_METHOD };
37
+ export { PAYOUT_METHOD_VALUES };
38
+ }
39
+ export default _default;
40
+ import { TRANSACTION_TYPE } from './transaction.enums.js';
41
+ import { TRANSACTION_TYPE_VALUES } from './transaction.enums.js';
42
+ import { TRANSACTION_STATUS } from './transaction.enums.js';
43
+ import { TRANSACTION_STATUS_VALUES } from './transaction.enums.js';
44
+ import { LIBRARY_CATEGORIES } from './transaction.enums.js';
45
+ import { LIBRARY_CATEGORY_VALUES } from './transaction.enums.js';
46
+ import { PAYMENT_STATUS } from './payment.enums.js';
47
+ import { PAYMENT_STATUS_VALUES } from './payment.enums.js';
48
+ import { PAYMENT_GATEWAY_TYPE } from './payment.enums.js';
49
+ import { PAYMENT_GATEWAY_TYPE_VALUES } from './payment.enums.js';
50
+ import { GATEWAY_TYPES } from './payment.enums.js';
51
+ import { GATEWAY_TYPE_VALUES } from './payment.enums.js';
52
+ import { SUBSCRIPTION_STATUS } from './subscription.enums.js';
53
+ import { SUBSCRIPTION_STATUS_VALUES } from './subscription.enums.js';
54
+ import { PLAN_KEYS } from './subscription.enums.js';
55
+ import { PLAN_KEY_VALUES } from './subscription.enums.js';
56
+ import { MONETIZATION_TYPES } from './monetization.enums.js';
57
+ import { MONETIZATION_TYPE_VALUES } from './monetization.enums.js';
58
+ import { HOLD_STATUS } from './escrow.enums.js';
59
+ import { HOLD_STATUS_VALUES } from './escrow.enums.js';
60
+ import { RELEASE_REASON } from './escrow.enums.js';
61
+ import { RELEASE_REASON_VALUES } from './escrow.enums.js';
62
+ import { HOLD_REASON } from './escrow.enums.js';
63
+ import { HOLD_REASON_VALUES } from './escrow.enums.js';
64
+ import { SPLIT_TYPE } from './split.enums.js';
65
+ import { SPLIT_TYPE_VALUES } from './split.enums.js';
66
+ import { SPLIT_STATUS } from './split.enums.js';
67
+ import { SPLIT_STATUS_VALUES } from './split.enums.js';
68
+ import { PAYOUT_METHOD } from './split.enums.js';
69
+ import { PAYOUT_METHOD_VALUES } from './split.enums.js';
@@ -0,0 +1,6 @@
1
+ export namespace MONETIZATION_TYPES {
2
+ let FREE: string;
3
+ let PURCHASE: string;
4
+ let SUBSCRIPTION: string;
5
+ }
6
+ export const MONETIZATION_TYPE_VALUES: string[];
@@ -0,0 +1,16 @@
1
+ export namespace PAYMENT_STATUS {
2
+ let PENDING: string;
3
+ let VERIFIED: string;
4
+ let FAILED: string;
5
+ let REFUNDED: string;
6
+ let CANCELLED: string;
7
+ }
8
+ export const PAYMENT_STATUS_VALUES: string[];
9
+ export namespace PAYMENT_GATEWAY_TYPE {
10
+ let MANUAL: string;
11
+ let STRIPE: string;
12
+ let SSLCOMMERZ: string;
13
+ }
14
+ export const PAYMENT_GATEWAY_TYPE_VALUES: string[];
15
+ export namespace GATEWAY_TYPES { }
16
+ export const GATEWAY_TYPE_VALUES: string[];
@@ -0,0 +1,25 @@
1
+ export namespace SPLIT_TYPE {
2
+ let PLATFORM_COMMISSION: string;
3
+ let AFFILIATE_COMMISSION: string;
4
+ let REFERRAL_COMMISSION: string;
5
+ let PARTNER_COMMISSION: string;
6
+ let CUSTOM: string;
7
+ }
8
+ export const SPLIT_TYPE_VALUES: string[];
9
+ export namespace SPLIT_STATUS {
10
+ let PENDING: string;
11
+ let DUE: string;
12
+ let PAID: string;
13
+ let WAIVED: string;
14
+ let CANCELLED: string;
15
+ }
16
+ export const SPLIT_STATUS_VALUES: string[];
17
+ export namespace PAYOUT_METHOD {
18
+ let BANK_TRANSFER: string;
19
+ let MOBILE_WALLET: string;
20
+ let PLATFORM_BALANCE: string;
21
+ let CRYPTO: string;
22
+ let CHECK: string;
23
+ let MANUAL: string;
24
+ }
25
+ export const PAYOUT_METHOD_VALUES: string[];