@classytic/revenue 1.1.2 → 1.1.4

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-rRdOqnWx.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-BhdS7nXh.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-DnNSFpGd.d.mts +344 -0
  41. package/dist/settlement.service-DjzAjezU.d.mts +594 -0
  42. package/dist/settlement.service-DmdKv0Zu.mjs +2511 -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 +39 -37
  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
@@ -1,343 +0,0 @@
1
- import { P as PayoutMethodValue } from './split.enums-DG3TxQf9.js';
2
- import mongoose__default from 'mongoose';
3
-
4
- /**
5
- * Settlement Schema
6
- * Tracks payouts from platform to vendors/affiliates/partners
7
- *
8
- * Use in your Settlement model:
9
- * ```typescript
10
- * import mongoose from 'mongoose';
11
- * import { settlementSchema } from '@classytic/revenue/schemas';
12
- *
13
- * const Settlement = mongoose.model('Settlement', settlementSchema);
14
- * ```
15
- */
16
- declare const settlementSchema: mongoose__default.Schema<any, mongoose__default.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
17
- timestamps: true;
18
- }, {
19
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
20
- organizationId: mongoose__default.Types.ObjectId;
21
- recipientId: mongoose__default.Types.ObjectId;
22
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
23
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
24
- payoutMethod: PayoutMethodValue;
25
- amount: number;
26
- currency: string;
27
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
28
- sourceSplitIds: string[];
29
- retryCount: number;
30
- metadata: any;
31
- bankTransferDetails?: {
32
- accountNumber?: string | null | undefined;
33
- accountName?: string | null | undefined;
34
- bankName?: string | null | undefined;
35
- routingNumber?: string | null | undefined;
36
- swiftCode?: string | null | undefined;
37
- iban?: string | null | undefined;
38
- transferReference?: string | null | undefined;
39
- transferredAt?: NativeDate | null | undefined;
40
- } | null | undefined;
41
- mobileWalletDetails?: {
42
- accountNumber?: string | null | undefined;
43
- transferredAt?: NativeDate | null | undefined;
44
- provider?: string | null | undefined;
45
- phoneNumber?: string | null | undefined;
46
- transactionId?: string | null | undefined;
47
- } | null | undefined;
48
- cryptoDetails?: {
49
- transferredAt?: NativeDate | null | undefined;
50
- network?: string | null | undefined;
51
- walletAddress?: string | null | undefined;
52
- transactionHash?: string | null | undefined;
53
- } | null | undefined;
54
- platformBalanceDetails?: {
55
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
56
- appliedAt?: NativeDate | null | undefined;
57
- } | null | undefined;
58
- scheduledAt?: NativeDate | null | undefined;
59
- processedAt?: NativeDate | null | undefined;
60
- completedAt?: NativeDate | null | undefined;
61
- failedAt?: NativeDate | null | undefined;
62
- cancelledAt?: NativeDate | null | undefined;
63
- failureReason?: string | null | undefined;
64
- failureCode?: string | null | undefined;
65
- notes?: string | null | undefined;
66
- } & mongoose__default.DefaultTimestampProps, mongoose__default.Document<unknown, {}, {
67
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
68
- organizationId: mongoose__default.Types.ObjectId;
69
- recipientId: mongoose__default.Types.ObjectId;
70
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
71
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
72
- payoutMethod: PayoutMethodValue;
73
- amount: number;
74
- currency: string;
75
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
76
- sourceSplitIds: string[];
77
- retryCount: number;
78
- metadata: any;
79
- bankTransferDetails?: {
80
- accountNumber?: string | null | undefined;
81
- accountName?: string | null | undefined;
82
- bankName?: string | null | undefined;
83
- routingNumber?: string | null | undefined;
84
- swiftCode?: string | null | undefined;
85
- iban?: string | null | undefined;
86
- transferReference?: string | null | undefined;
87
- transferredAt?: NativeDate | null | undefined;
88
- } | null | undefined;
89
- mobileWalletDetails?: {
90
- accountNumber?: string | null | undefined;
91
- transferredAt?: NativeDate | null | undefined;
92
- provider?: string | null | undefined;
93
- phoneNumber?: string | null | undefined;
94
- transactionId?: string | null | undefined;
95
- } | null | undefined;
96
- cryptoDetails?: {
97
- transferredAt?: NativeDate | null | undefined;
98
- network?: string | null | undefined;
99
- walletAddress?: string | null | undefined;
100
- transactionHash?: string | null | undefined;
101
- } | null | undefined;
102
- platformBalanceDetails?: {
103
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
104
- appliedAt?: NativeDate | null | undefined;
105
- } | null | undefined;
106
- scheduledAt?: NativeDate | null | undefined;
107
- processedAt?: NativeDate | null | undefined;
108
- completedAt?: NativeDate | null | undefined;
109
- failedAt?: NativeDate | null | undefined;
110
- cancelledAt?: NativeDate | null | undefined;
111
- failureReason?: string | null | undefined;
112
- failureCode?: string | null | undefined;
113
- notes?: string | null | undefined;
114
- } & mongoose__default.DefaultTimestampProps, {
115
- id: string;
116
- }, mongoose__default.ResolveSchemaOptions<{
117
- timestamps: true;
118
- }>> & Omit<{
119
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
120
- organizationId: mongoose__default.Types.ObjectId;
121
- recipientId: mongoose__default.Types.ObjectId;
122
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
123
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
124
- payoutMethod: PayoutMethodValue;
125
- amount: number;
126
- currency: string;
127
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
128
- sourceSplitIds: string[];
129
- retryCount: number;
130
- metadata: any;
131
- bankTransferDetails?: {
132
- accountNumber?: string | null | undefined;
133
- accountName?: string | null | undefined;
134
- bankName?: string | null | undefined;
135
- routingNumber?: string | null | undefined;
136
- swiftCode?: string | null | undefined;
137
- iban?: string | null | undefined;
138
- transferReference?: string | null | undefined;
139
- transferredAt?: NativeDate | null | undefined;
140
- } | null | undefined;
141
- mobileWalletDetails?: {
142
- accountNumber?: string | null | undefined;
143
- transferredAt?: NativeDate | null | undefined;
144
- provider?: string | null | undefined;
145
- phoneNumber?: string | null | undefined;
146
- transactionId?: string | null | undefined;
147
- } | null | undefined;
148
- cryptoDetails?: {
149
- transferredAt?: NativeDate | null | undefined;
150
- network?: string | null | undefined;
151
- walletAddress?: string | null | undefined;
152
- transactionHash?: string | null | undefined;
153
- } | null | undefined;
154
- platformBalanceDetails?: {
155
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
156
- appliedAt?: NativeDate | null | undefined;
157
- } | null | undefined;
158
- scheduledAt?: NativeDate | null | undefined;
159
- processedAt?: NativeDate | null | undefined;
160
- completedAt?: NativeDate | null | undefined;
161
- failedAt?: NativeDate | null | undefined;
162
- cancelledAt?: NativeDate | null | undefined;
163
- failureReason?: string | null | undefined;
164
- failureCode?: string | null | undefined;
165
- notes?: string | null | undefined;
166
- } & mongoose__default.DefaultTimestampProps & {
167
- _id: mongoose__default.Types.ObjectId;
168
- } & {
169
- __v: number;
170
- }, "id"> & {
171
- id: string;
172
- }, {
173
- [path: string]: mongoose__default.SchemaDefinitionProperty<undefined, any, any>;
174
- } | {
175
- [x: string]: mongoose__default.SchemaDefinitionProperty<any, any, mongoose__default.Document<unknown, {}, {
176
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
177
- organizationId: mongoose__default.Types.ObjectId;
178
- recipientId: mongoose__default.Types.ObjectId;
179
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
180
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
181
- payoutMethod: PayoutMethodValue;
182
- amount: number;
183
- currency: string;
184
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
185
- sourceSplitIds: string[];
186
- retryCount: number;
187
- metadata: any;
188
- bankTransferDetails?: {
189
- accountNumber?: string | null | undefined;
190
- accountName?: string | null | undefined;
191
- bankName?: string | null | undefined;
192
- routingNumber?: string | null | undefined;
193
- swiftCode?: string | null | undefined;
194
- iban?: string | null | undefined;
195
- transferReference?: string | null | undefined;
196
- transferredAt?: NativeDate | null | undefined;
197
- } | null | undefined;
198
- mobileWalletDetails?: {
199
- accountNumber?: string | null | undefined;
200
- transferredAt?: NativeDate | null | undefined;
201
- provider?: string | null | undefined;
202
- phoneNumber?: string | null | undefined;
203
- transactionId?: string | null | undefined;
204
- } | null | undefined;
205
- cryptoDetails?: {
206
- transferredAt?: NativeDate | null | undefined;
207
- network?: string | null | undefined;
208
- walletAddress?: string | null | undefined;
209
- transactionHash?: string | null | undefined;
210
- } | null | undefined;
211
- platformBalanceDetails?: {
212
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
213
- appliedAt?: NativeDate | null | undefined;
214
- } | null | undefined;
215
- scheduledAt?: NativeDate | null | undefined;
216
- processedAt?: NativeDate | null | undefined;
217
- completedAt?: NativeDate | null | undefined;
218
- failedAt?: NativeDate | null | undefined;
219
- cancelledAt?: NativeDate | null | undefined;
220
- failureReason?: string | null | undefined;
221
- failureCode?: string | null | undefined;
222
- notes?: string | null | undefined;
223
- } & mongoose__default.DefaultTimestampProps, {
224
- id: string;
225
- }, mongoose__default.ResolveSchemaOptions<{
226
- timestamps: true;
227
- }>> & Omit<{
228
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
229
- organizationId: mongoose__default.Types.ObjectId;
230
- recipientId: mongoose__default.Types.ObjectId;
231
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
232
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
233
- payoutMethod: PayoutMethodValue;
234
- amount: number;
235
- currency: string;
236
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
237
- sourceSplitIds: string[];
238
- retryCount: number;
239
- metadata: any;
240
- bankTransferDetails?: {
241
- accountNumber?: string | null | undefined;
242
- accountName?: string | null | undefined;
243
- bankName?: string | null | undefined;
244
- routingNumber?: string | null | undefined;
245
- swiftCode?: string | null | undefined;
246
- iban?: string | null | undefined;
247
- transferReference?: string | null | undefined;
248
- transferredAt?: NativeDate | null | undefined;
249
- } | null | undefined;
250
- mobileWalletDetails?: {
251
- accountNumber?: string | null | undefined;
252
- transferredAt?: NativeDate | null | undefined;
253
- provider?: string | null | undefined;
254
- phoneNumber?: string | null | undefined;
255
- transactionId?: string | null | undefined;
256
- } | null | undefined;
257
- cryptoDetails?: {
258
- transferredAt?: NativeDate | null | undefined;
259
- network?: string | null | undefined;
260
- walletAddress?: string | null | undefined;
261
- transactionHash?: string | null | undefined;
262
- } | null | undefined;
263
- platformBalanceDetails?: {
264
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
265
- appliedAt?: NativeDate | null | undefined;
266
- } | null | undefined;
267
- scheduledAt?: NativeDate | null | undefined;
268
- processedAt?: NativeDate | null | undefined;
269
- completedAt?: NativeDate | null | undefined;
270
- failedAt?: NativeDate | null | undefined;
271
- cancelledAt?: NativeDate | null | undefined;
272
- failureReason?: string | null | undefined;
273
- failureCode?: string | null | undefined;
274
- notes?: string | null | undefined;
275
- } & mongoose__default.DefaultTimestampProps & {
276
- _id: mongoose__default.Types.ObjectId;
277
- } & {
278
- __v: number;
279
- }, "id"> & {
280
- id: string;
281
- }> | undefined;
282
- }, {
283
- type: "split_payout" | "platform_withdrawal" | "manual_payout" | "escrow_release";
284
- organizationId: mongoose__default.Types.ObjectId;
285
- recipientId: mongoose__default.Types.ObjectId;
286
- recipientType: "platform" | "organization" | "user" | "affiliate" | "partner";
287
- status: "pending" | "processing" | "completed" | "failed" | "cancelled";
288
- payoutMethod: PayoutMethodValue;
289
- amount: number;
290
- currency: string;
291
- sourceTransactionIds: mongoose__default.Types.ObjectId[];
292
- sourceSplitIds: string[];
293
- retryCount: number;
294
- metadata: any;
295
- bankTransferDetails?: {
296
- accountNumber?: string | null | undefined;
297
- accountName?: string | null | undefined;
298
- bankName?: string | null | undefined;
299
- routingNumber?: string | null | undefined;
300
- swiftCode?: string | null | undefined;
301
- iban?: string | null | undefined;
302
- transferReference?: string | null | undefined;
303
- transferredAt?: NativeDate | null | undefined;
304
- } | null | undefined;
305
- mobileWalletDetails?: {
306
- accountNumber?: string | null | undefined;
307
- transferredAt?: NativeDate | null | undefined;
308
- provider?: string | null | undefined;
309
- phoneNumber?: string | null | undefined;
310
- transactionId?: string | null | undefined;
311
- } | null | undefined;
312
- cryptoDetails?: {
313
- transferredAt?: NativeDate | null | undefined;
314
- network?: string | null | undefined;
315
- walletAddress?: string | null | undefined;
316
- transactionHash?: string | null | undefined;
317
- } | null | undefined;
318
- platformBalanceDetails?: {
319
- balanceId?: mongoose__default.Types.ObjectId | null | undefined;
320
- appliedAt?: NativeDate | null | undefined;
321
- } | null | undefined;
322
- scheduledAt?: NativeDate | null | undefined;
323
- processedAt?: NativeDate | null | undefined;
324
- completedAt?: NativeDate | null | undefined;
325
- failedAt?: NativeDate | null | undefined;
326
- cancelledAt?: NativeDate | null | undefined;
327
- failureReason?: string | null | undefined;
328
- failureCode?: string | null | undefined;
329
- notes?: string | null | undefined;
330
- createdAt: NativeDate;
331
- updatedAt: NativeDate;
332
- } & {
333
- _id: mongoose__default.Types.ObjectId;
334
- } & {
335
- __v: number;
336
- }>;
337
- type SettlementDocument = mongoose__default.InferSchemaType<typeof settlementSchema> & mongoose__default.Document & {
338
- _id: mongoose__default.Types.ObjectId;
339
- createdAt: Date;
340
- updatedAt: Date;
341
- };
342
-
343
- export { type SettlementDocument as S, settlementSchema as s };
@@ -1,42 +0,0 @@
1
- /**
2
- * Split Payment Enums
3
- * @classytic/revenue
4
- *
5
- * Enums for multi-party commission splits
6
- */
7
- declare const SPLIT_TYPE: {
8
- readonly PLATFORM_COMMISSION: "platform_commission";
9
- readonly AFFILIATE_COMMISSION: "affiliate_commission";
10
- readonly REFERRAL_COMMISSION: "referral_commission";
11
- readonly PARTNER_COMMISSION: "partner_commission";
12
- readonly CUSTOM: "custom";
13
- };
14
- type SplitType = typeof SPLIT_TYPE;
15
- type SplitTypeValue = SplitType[keyof SplitType];
16
- declare const SPLIT_TYPE_VALUES: SplitTypeValue[];
17
- declare const SPLIT_STATUS: {
18
- readonly PENDING: "pending";
19
- readonly DUE: "due";
20
- readonly PAID: "paid";
21
- readonly WAIVED: "waived";
22
- readonly CANCELLED: "cancelled";
23
- };
24
- type SplitStatus = typeof SPLIT_STATUS;
25
- type SplitStatusValue = SplitStatus[keyof SplitStatus];
26
- declare const SPLIT_STATUS_VALUES: SplitStatusValue[];
27
- declare const PAYOUT_METHOD: {
28
- readonly BANK_TRANSFER: "bank_transfer";
29
- readonly MOBILE_WALLET: "mobile_wallet";
30
- readonly PLATFORM_BALANCE: "platform_balance";
31
- readonly CRYPTO: "crypto";
32
- readonly CHECK: "check";
33
- readonly MANUAL: "manual";
34
- };
35
- type PayoutMethod = typeof PAYOUT_METHOD;
36
- type PayoutMethodValue = PayoutMethod[keyof PayoutMethod];
37
- declare const PAYOUT_METHOD_VALUES: PayoutMethodValue[];
38
- declare function isSplitType(value: unknown): value is SplitTypeValue;
39
- declare function isSplitStatus(value: unknown): value is SplitStatusValue;
40
- declare function isPayoutMethod(value: unknown): value is PayoutMethodValue;
41
-
42
- export { type PayoutMethodValue as P, type SplitTypeValue as S, type SplitStatusValue as a, isSplitStatus as b, isPayoutMethod as c, SPLIT_TYPE as d, type SplitType as e, SPLIT_TYPE_VALUES as f, SPLIT_STATUS as g, type SplitStatus as h, isSplitType as i, SPLIT_STATUS_VALUES as j, PAYOUT_METHOD as k, type PayoutMethod as l, PAYOUT_METHOD_VALUES as m };
@@ -1,60 +0,0 @@
1
- /**
2
- * Tax Types
3
- * @classytic/revenue
4
- *
5
- * Type definitions for tax calculation
6
- */
7
- /**
8
- * Tax Configuration
9
- * Apps provide this configuration based on their jurisdiction
10
- *
11
- * Philosophy: Apps know their tax rules, library does the math
12
- *
13
- * @example
14
- * ```typescript
15
- * // Australia - 10% GST
16
- * const taxConfig: TaxConfig = {
17
- * isRegistered: true,
18
- * defaultRate: 0.10,
19
- * pricesIncludeTax: false,
20
- * exemptCategories: ['education', 'medical'],
21
- * };
22
- * ```
23
- */
24
- interface TaxConfig {
25
- /** Is the organization registered for tax collection? */
26
- isRegistered: boolean;
27
- /** Default tax rate (0-1, e.g., 0.15 = 15%) */
28
- defaultRate: number;
29
- /** Do displayed prices include tax? */
30
- pricesIncludeTax: boolean;
31
- /** Categories exempt from tax (e.g., groceries, education) */
32
- exemptCategories?: string[];
33
- }
34
- /**
35
- * Tax Calculation Result
36
- * Returned by calculateTax() utility
37
- */
38
- interface TaxCalculation {
39
- /** Is tax applicable for this transaction? */
40
- isApplicable: boolean;
41
- /** Tax rate used (0-1) */
42
- rate: number;
43
- /** Base amount (before tax) */
44
- baseAmount: number;
45
- /** Tax amount */
46
- taxAmount: number;
47
- /** Total amount (base + tax) */
48
- totalAmount: number;
49
- /** Were prices tax-inclusive? */
50
- pricesIncludeTax: boolean;
51
- /** Tax type */
52
- type?: TaxType;
53
- }
54
- /**
55
- * Tax Type
56
- * Indicates whether tax is collected or paid
57
- */
58
- type TaxType = 'collected' | 'paid' | 'exempt';
59
-
60
- export type { TaxConfig as T, TaxCalculation as a, TaxType as b };