@forklaunch/implementation-billing-base 0.1.13 → 0.1.15

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 (50) hide show
  1. package/lib/__test__/schemaEquality.test.d.ts +1 -1
  2. package/lib/__test__/schemaEquality.test.js +305 -146
  3. package/lib/jest.config.d.ts +1 -1
  4. package/lib/jest.config.js +16 -16
  5. package/lib/schemas/billingPortal.schema.d.ts +103 -34
  6. package/lib/schemas/billingPortal.schema.js +4 -1
  7. package/lib/schemas/checkoutSession.schema.d.ts +169 -54
  8. package/lib/schemas/checkoutSession.schema.js +4 -1
  9. package/lib/schemas/index.d.ts +1 -1
  10. package/lib/schemas/paymentLink.schema.d.ts +220 -64
  11. package/lib/schemas/paymentLink.schema.js +4 -1
  12. package/lib/schemas/plan.schema.d.ts +328 -76
  13. package/lib/schemas/plan.schema.js +4 -1
  14. package/lib/schemas/subscription.schema.d.ts +356 -88
  15. package/lib/schemas/subscription.schema.js +4 -1
  16. package/lib/schemas/typebox/billingPortal.schema.d.ts +152 -38
  17. package/lib/schemas/typebox/billingPortal.schema.js +23 -17
  18. package/lib/schemas/typebox/checkoutSession.schema.d.ts +189 -55
  19. package/lib/schemas/typebox/checkoutSession.schema.js +25 -13
  20. package/lib/schemas/typebox/paymentLink.schema.d.ts +267 -65
  21. package/lib/schemas/typebox/paymentLink.schema.js +27 -15
  22. package/lib/schemas/typebox/plan.schema.d.ts +401 -77
  23. package/lib/schemas/typebox/plan.schema.js +31 -17
  24. package/lib/schemas/typebox/subscription.schema.d.ts +449 -89
  25. package/lib/schemas/typebox/subscription.schema.js +31 -19
  26. package/lib/schemas/zod/billingPortal.schema.d.ts +54 -38
  27. package/lib/schemas/zod/billingPortal.schema.js +23 -17
  28. package/lib/schemas/zod/checkoutSession.schema.d.ts +115 -55
  29. package/lib/schemas/zod/checkoutSession.schema.js +25 -13
  30. package/lib/schemas/zod/paymentLink.schema.d.ts +111 -65
  31. package/lib/schemas/zod/paymentLink.schema.js +27 -15
  32. package/lib/schemas/zod/plan.schema.d.ts +189 -77
  33. package/lib/schemas/zod/plan.schema.js +31 -17
  34. package/lib/schemas/zod/subscription.schema.d.ts +197 -89
  35. package/lib/schemas/zod/subscription.schema.js +31 -19
  36. package/lib/services/billingPortal.service.d.ts +77 -28
  37. package/lib/services/billingPortal.service.js +64 -45
  38. package/lib/services/checkoutSession.service.d.ts +77 -29
  39. package/lib/services/checkoutSession.service.js +54 -43
  40. package/lib/services/index.d.ts +1 -1
  41. package/lib/services/paymentLink.service.d.ts +82 -32
  42. package/lib/services/paymentLink.service.js +84 -66
  43. package/lib/services/plan.service.d.ts +73 -26
  44. package/lib/services/plan.service.js +45 -40
  45. package/lib/services/subscription.service.d.ts +136 -44
  46. package/lib/services/subscription.service.js +111 -88
  47. package/lib/tsconfig.tsbuildinfo +1 -1
  48. package/lib/vitest.config.d.ts +2 -2
  49. package/lib/vitest.config.js +4 -4
  50. package/package.json +8 -8
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=schemaEquality.test.d.ts.map
2
+ //# sourceMappingURL=schemaEquality.test.d.ts.map
@@ -1,135 +1,255 @@
1
1
  import { isTrue } from '@forklaunch/common';
2
2
  import { DummyEnum, testSchemaEquality } from '@forklaunch/core/test';
3
- import { BillingPortalSchema as TypeboxBillingPortalSchema, CreateBillingPortalSchema as TypeboxCreateBillingPortalSchema, UpdateBillingPortalSchema as TypeboxUpdateBillingPortalSchema } from '../schemas/typebox/billingPortal.schema';
4
- import { CheckoutSessionSchema as TypeboxCheckoutSessionSchema, CreateCheckoutSessionSchema as TypeboxCreateCheckoutSessionSchema, UpdateCheckoutSessionSchema as TypeboxUpdateCheckoutSessionSchema } from '../schemas/typebox/checkoutSession.schema';
5
- import { CreatePaymentLinkSchema as TypeboxCreatePaymentLinkSchema, PaymentLinkSchema as TypeboxPaymentLinkSchema, UpdatePaymentLinkSchema as TypeboxUpdatePaymentLinkSchema } from '../schemas/typebox/paymentLink.schema';
6
- import { CreatePlanSchema as TypeboxCreatePlanSchema, PlanSchema as TypeboxPlanSchema, UpdatePlanSchema as TypeboxUpdatePlanSchema } from '../schemas/typebox/plan.schema';
7
- import { CreateSubscriptionSchema as TypeboxCreateSubscriptionSchema, SubscriptionSchema as TypeboxSubscriptionSchema, UpdateSubscriptionSchema as TypeboxUpdateSubscriptionSchema } from '../schemas/typebox/subscription.schema';
8
- import { BillingPortalSchema as ZodBillingPortalSchema, CreateBillingPortalSchema as ZodCreateBillingPortalSchema, UpdateBillingPortalSchema as ZodUpdateBillingPortalSchema } from '../schemas/zod/billingPortal.schema';
9
- import { CheckoutSessionSchema as ZodCheckoutSessionSchema, CreateCheckoutSessionSchema as ZodCreateCheckoutSessionSchema, UpdateCheckoutSessionSchema as ZodUpdateCheckoutSessionSchema } from '../schemas/zod/checkoutSession.schema';
10
- import { CreatePaymentLinkSchema as ZodCreatePaymentLinkSchema, PaymentLinkSchema as ZodPaymentLinkSchema, UpdatePaymentLinkSchema as ZodUpdatePaymentLinkSchema } from '../schemas/zod/paymentLink.schema';
11
- import { CreatePlanSchema as ZodCreatePlanSchema, PlanSchema as ZodPlanSchema, UpdatePlanSchema as ZodUpdatePlanSchema } from '../schemas/zod/plan.schema';
12
- import { CreateSubscriptionSchema as ZodCreateSubscriptionSchema, SubscriptionSchema as ZodSubscriptionSchema, UpdateSubscriptionSchema as ZodUpdateSubscriptionSchema } from '../schemas/zod/subscription.schema';
3
+ import {
4
+ BillingPortalSchema as TypeboxBillingPortalSchema,
5
+ CreateBillingPortalSchema as TypeboxCreateBillingPortalSchema,
6
+ UpdateBillingPortalSchema as TypeboxUpdateBillingPortalSchema
7
+ } from '../schemas/typebox/billingPortal.schema';
8
+ import {
9
+ CheckoutSessionSchema as TypeboxCheckoutSessionSchema,
10
+ CreateCheckoutSessionSchema as TypeboxCreateCheckoutSessionSchema,
11
+ UpdateCheckoutSessionSchema as TypeboxUpdateCheckoutSessionSchema
12
+ } from '../schemas/typebox/checkoutSession.schema';
13
+ import {
14
+ CreatePaymentLinkSchema as TypeboxCreatePaymentLinkSchema,
15
+ PaymentLinkSchema as TypeboxPaymentLinkSchema,
16
+ UpdatePaymentLinkSchema as TypeboxUpdatePaymentLinkSchema
17
+ } from '../schemas/typebox/paymentLink.schema';
18
+ import {
19
+ CreatePlanSchema as TypeboxCreatePlanSchema,
20
+ PlanSchema as TypeboxPlanSchema,
21
+ UpdatePlanSchema as TypeboxUpdatePlanSchema
22
+ } from '../schemas/typebox/plan.schema';
23
+ import {
24
+ CreateSubscriptionSchema as TypeboxCreateSubscriptionSchema,
25
+ SubscriptionSchema as TypeboxSubscriptionSchema,
26
+ UpdateSubscriptionSchema as TypeboxUpdateSubscriptionSchema
27
+ } from '../schemas/typebox/subscription.schema';
28
+ import {
29
+ BillingPortalSchema as ZodBillingPortalSchema,
30
+ CreateBillingPortalSchema as ZodCreateBillingPortalSchema,
31
+ UpdateBillingPortalSchema as ZodUpdateBillingPortalSchema
32
+ } from '../schemas/zod/billingPortal.schema';
33
+ import {
34
+ CheckoutSessionSchema as ZodCheckoutSessionSchema,
35
+ CreateCheckoutSessionSchema as ZodCreateCheckoutSessionSchema,
36
+ UpdateCheckoutSessionSchema as ZodUpdateCheckoutSessionSchema
37
+ } from '../schemas/zod/checkoutSession.schema';
38
+ import {
39
+ CreatePaymentLinkSchema as ZodCreatePaymentLinkSchema,
40
+ PaymentLinkSchema as ZodPaymentLinkSchema,
41
+ UpdatePaymentLinkSchema as ZodUpdatePaymentLinkSchema
42
+ } from '../schemas/zod/paymentLink.schema';
43
+ import {
44
+ CreatePlanSchema as ZodCreatePlanSchema,
45
+ PlanSchema as ZodPlanSchema,
46
+ UpdatePlanSchema as ZodUpdatePlanSchema
47
+ } from '../schemas/zod/plan.schema';
48
+ import {
49
+ CreateSubscriptionSchema as ZodCreateSubscriptionSchema,
50
+ SubscriptionSchema as ZodSubscriptionSchema,
51
+ UpdateSubscriptionSchema as ZodUpdateSubscriptionSchema
52
+ } from '../schemas/zod/subscription.schema';
13
53
  const zodUpdateBillingPortalSchema = ZodUpdateBillingPortalSchema({
14
- uuidId: false
54
+ uuidId: false
15
55
  });
16
56
  const typeboxUpdateBillingPortalSchema = TypeboxUpdateBillingPortalSchema({
17
- uuidId: false
57
+ uuidId: false
18
58
  });
19
59
  const zodBillingPortalSchema = ZodBillingPortalSchema({ uuidId: false });
20
60
  const typeboxBillingPortalSchema = TypeboxBillingPortalSchema({
21
- uuidId: false
61
+ uuidId: false
22
62
  });
23
- const zodCreateCheckoutSessionSchema = ZodCreateCheckoutSessionSchema(DummyEnum);
24
- const typeboxCreateCheckoutSessionSchema = TypeboxCreateCheckoutSessionSchema(DummyEnum);
63
+ const zodCreateCheckoutSessionSchema =
64
+ ZodCreateCheckoutSessionSchema(DummyEnum);
65
+ const typeboxCreateCheckoutSessionSchema =
66
+ TypeboxCreateCheckoutSessionSchema(DummyEnum);
25
67
  const zodUpdateCheckoutSessionSchema = ZodUpdateCheckoutSessionSchema({
26
- uuidId: false
68
+ uuidId: false
27
69
  })(DummyEnum);
28
70
  const typeboxUpdateCheckoutSessionSchema = TypeboxUpdateCheckoutSessionSchema({
29
- uuidId: false
71
+ uuidId: false
30
72
  })(DummyEnum);
31
- const zodCheckoutSessionSchema = ZodCheckoutSessionSchema({ uuidId: true })(DummyEnum);
73
+ const zodCheckoutSessionSchema = ZodCheckoutSessionSchema({ uuidId: true })(
74
+ DummyEnum
75
+ );
32
76
  const typeboxCheckoutSessionSchema = TypeboxCheckoutSessionSchema({
33
- uuidId: true
77
+ uuidId: true
34
78
  })(DummyEnum);
35
79
  const zodCreatePaymentLinkSchema = ZodCreatePaymentLinkSchema(DummyEnum);
36
- const typeboxCreatePaymentLinkSchema = TypeboxCreatePaymentLinkSchema(DummyEnum);
80
+ const typeboxCreatePaymentLinkSchema =
81
+ TypeboxCreatePaymentLinkSchema(DummyEnum);
37
82
  const zodUpdatePaymentLinkSchema = ZodUpdatePaymentLinkSchema({
38
- uuidId: false
83
+ uuidId: false
39
84
  })(DummyEnum);
40
85
  const typeboxUpdatePaymentLinkSchema = TypeboxUpdatePaymentLinkSchema({
41
- uuidId: false
86
+ uuidId: false
42
87
  })(DummyEnum);
43
88
  const zodPaymentLinkSchema = ZodPaymentLinkSchema({ uuidId: true })(DummyEnum);
44
89
  const typeboxPaymentLinkSchema = TypeboxPaymentLinkSchema({
45
- uuidId: false
90
+ uuidId: false
46
91
  })(DummyEnum);
47
92
  const zodCreatePlanSchema = ZodCreatePlanSchema(DummyEnum, DummyEnum);
48
93
  const typeboxCreatePlanSchema = TypeboxCreatePlanSchema(DummyEnum, DummyEnum);
49
- const zodUpdatePlanSchema = ZodUpdatePlanSchema({ uuidId: false })(DummyEnum, DummyEnum);
50
- const typeboxUpdatePlanSchema = TypeboxUpdatePlanSchema({ uuidId: false })(DummyEnum, DummyEnum);
94
+ const zodUpdatePlanSchema = ZodUpdatePlanSchema({ uuidId: false })(
95
+ DummyEnum,
96
+ DummyEnum
97
+ );
98
+ const typeboxUpdatePlanSchema = TypeboxUpdatePlanSchema({ uuidId: false })(
99
+ DummyEnum,
100
+ DummyEnum
101
+ );
51
102
  const zodPlanSchema = ZodPlanSchema({ uuidId: true })(DummyEnum, DummyEnum);
52
- const typeboxPlanSchema = TypeboxPlanSchema({ uuidId: true })(DummyEnum, DummyEnum);
53
- const zodCreateSubscriptionSchema = ZodCreateSubscriptionSchema(DummyEnum, DummyEnum);
54
- const typeboxCreateSubscriptionSchema = TypeboxCreateSubscriptionSchema(DummyEnum, DummyEnum);
103
+ const typeboxPlanSchema = TypeboxPlanSchema({ uuidId: true })(
104
+ DummyEnum,
105
+ DummyEnum
106
+ );
107
+ const zodCreateSubscriptionSchema = ZodCreateSubscriptionSchema(
108
+ DummyEnum,
109
+ DummyEnum
110
+ );
111
+ const typeboxCreateSubscriptionSchema = TypeboxCreateSubscriptionSchema(
112
+ DummyEnum,
113
+ DummyEnum
114
+ );
55
115
  const zodUpdateSubscriptionSchema = ZodUpdateSubscriptionSchema({
56
- uuidId: false
116
+ uuidId: false
57
117
  })(DummyEnum, DummyEnum);
58
118
  const typeboxUpdateSubscriptionSchema = TypeboxUpdateSubscriptionSchema({
59
- uuidId: false
119
+ uuidId: false
60
120
  })(DummyEnum, DummyEnum);
61
- const zodSubscriptionSchema = ZodSubscriptionSchema({ uuidId: true })(DummyEnum, DummyEnum);
121
+ const zodSubscriptionSchema = ZodSubscriptionSchema({ uuidId: true })(
122
+ DummyEnum,
123
+ DummyEnum
124
+ );
62
125
  const typeboxSubscriptionSchema = TypeboxSubscriptionSchema({
63
- uuidId: true
126
+ uuidId: true
64
127
  })(DummyEnum, DummyEnum);
65
128
  describe('schema equality', () => {
66
- it('should be equal for billing portal', () => {
67
- expect(isTrue(testSchemaEquality(ZodCreateBillingPortalSchema, TypeboxCreateBillingPortalSchema, {
129
+ it('should be equal for billing portal', () => {
130
+ expect(
131
+ isTrue(
132
+ testSchemaEquality(
133
+ ZodCreateBillingPortalSchema,
134
+ TypeboxCreateBillingPortalSchema,
135
+ {
68
136
  customerId: 'test',
69
137
  uri: 'https://example.com',
70
138
  expiresAt: new Date()
71
- }))).toBeTruthy();
72
- expect(isTrue(testSchemaEquality(zodUpdateBillingPortalSchema, typeboxUpdateBillingPortalSchema, {
139
+ }
140
+ )
141
+ )
142
+ ).toBeTruthy();
143
+ expect(
144
+ isTrue(
145
+ testSchemaEquality(
146
+ zodUpdateBillingPortalSchema,
147
+ typeboxUpdateBillingPortalSchema,
148
+ {
73
149
  id: 'test',
74
150
  uri: 'https://example.com',
75
151
  expiresAt: new Date()
76
- }))).toBeTruthy();
77
- expect(isTrue(testSchemaEquality(zodBillingPortalSchema, typeboxBillingPortalSchema, {
78
- id: 'test',
79
- customerId: 'test',
80
- uri: 'https://example.com',
81
- expiresAt: new Date(),
82
- extraFields: {
83
- test: 'test'
84
- }
85
- }))).toBeTruthy();
86
- });
87
- it('should be equal for checkout session', () => {
88
- expect(isTrue(testSchemaEquality(zodCreateCheckoutSessionSchema, typeboxCreateCheckoutSessionSchema, {
152
+ }
153
+ )
154
+ )
155
+ ).toBeTruthy();
156
+ expect(
157
+ isTrue(
158
+ testSchemaEquality(zodBillingPortalSchema, typeboxBillingPortalSchema, {
159
+ id: 'test',
160
+ customerId: 'test',
161
+ uri: 'https://example.com',
162
+ expiresAt: new Date(),
163
+ extraFields: {
164
+ test: 'test'
165
+ }
166
+ })
167
+ )
168
+ ).toBeTruthy();
169
+ });
170
+ it('should be equal for checkout session', () => {
171
+ expect(
172
+ isTrue(
173
+ testSchemaEquality(
174
+ zodCreateCheckoutSessionSchema,
175
+ typeboxCreateCheckoutSessionSchema,
176
+ {
89
177
  customerId: 'test',
90
178
  paymentMethods: [DummyEnum.A, DummyEnum.B],
91
179
  successRedirectUri: 'https://example.com',
92
180
  cancelRedirectUri: 'https://example.com',
93
181
  extraFields: {
94
- test: 'test'
182
+ test: 'test'
95
183
  }
96
- }))).toBeTruthy();
97
- expect(isTrue(testSchemaEquality(zodUpdateCheckoutSessionSchema, typeboxUpdateCheckoutSessionSchema, {
184
+ }
185
+ )
186
+ )
187
+ ).toBeTruthy();
188
+ expect(
189
+ isTrue(
190
+ testSchemaEquality(
191
+ zodUpdateCheckoutSessionSchema,
192
+ typeboxUpdateCheckoutSessionSchema,
193
+ {
98
194
  id: 'test',
99
195
  customerId: 'test',
100
196
  paymentMethods: [DummyEnum.A, DummyEnum.B],
101
197
  successRedirectUri: 'https://example.com',
102
198
  cancelRedirectUri: 'https://example.com',
103
199
  extraFields: {
104
- test: 'test'
200
+ test: 'test'
105
201
  }
106
- }))).toBeTruthy();
107
- expect(isTrue(testSchemaEquality(zodCheckoutSessionSchema, typeboxCheckoutSessionSchema, {
202
+ }
203
+ )
204
+ )
205
+ ).toBeTruthy();
206
+ expect(
207
+ isTrue(
208
+ testSchemaEquality(
209
+ zodCheckoutSessionSchema,
210
+ typeboxCheckoutSessionSchema,
211
+ {
108
212
  id: 'test',
109
213
  customerId: 'test',
110
214
  paymentMethods: [DummyEnum.A, DummyEnum.B],
111
215
  successRedirectUri: 'https://example.com',
112
216
  cancelRedirectUri: 'https://example.com',
113
217
  extraFields: {
114
- test: 'test'
218
+ test: 'test'
115
219
  }
116
- }))).toBeTruthy();
117
- });
118
- it('should be equal for payment link', () => {
119
- expect(isTrue(testSchemaEquality(zodCreatePaymentLinkSchema, typeboxCreatePaymentLinkSchema, {
220
+ }
221
+ )
222
+ )
223
+ ).toBeTruthy();
224
+ });
225
+ it('should be equal for payment link', () => {
226
+ expect(
227
+ isTrue(
228
+ testSchemaEquality(
229
+ zodCreatePaymentLinkSchema,
230
+ typeboxCreatePaymentLinkSchema,
231
+ {
120
232
  amount: 100,
121
233
  currency: DummyEnum.A,
122
234
  successRedirectUri: 'https://example.com',
123
235
  cancelRedirectUri: 'https://example.com',
124
236
  description: 'test',
125
237
  metadata: {
126
- test: 'test'
238
+ test: 'test'
127
239
  },
128
240
  extraFields: {
129
- test: 'test'
241
+ test: 'test'
130
242
  }
131
- }))).toBeTruthy();
132
- expect(isTrue(testSchemaEquality(zodUpdatePaymentLinkSchema, typeboxUpdatePaymentLinkSchema, {
243
+ }
244
+ )
245
+ )
246
+ ).toBeTruthy();
247
+ expect(
248
+ isTrue(
249
+ testSchemaEquality(
250
+ zodUpdatePaymentLinkSchema,
251
+ typeboxUpdatePaymentLinkSchema,
252
+ {
133
253
  id: 'test',
134
254
  amount: 100,
135
255
  currency: DummyEnum.A,
@@ -137,85 +257,93 @@ describe('schema equality', () => {
137
257
  cancelRedirectUri: 'https://example.com',
138
258
  description: 'test',
139
259
  metadata: {
140
- test: 'test'
260
+ test: 'test'
141
261
  },
142
262
  extraFields: {
143
- test: 'test'
263
+ test: 'test'
144
264
  }
145
- })));
146
- expect(isTrue(testSchemaEquality(zodPaymentLinkSchema, typeboxPaymentLinkSchema, {
147
- id: 'test',
148
- amount: 100,
149
- currency: DummyEnum.A,
150
- successRedirectUri: 'https://example.com',
151
- cancelRedirectUri: 'https://example.com',
152
- description: 'test',
153
- metadata: {
154
- test: 'test'
155
- },
156
- extraFields: {
157
- test: 'test'
158
- }
159
- }))).toBeTruthy();
160
- });
161
- it('should be equal for plan', () => {
162
- expect(isTrue(testSchemaEquality(zodCreatePlanSchema, typeboxCreatePlanSchema, {
163
- name: 'test',
164
- price: 100,
165
- cadence: DummyEnum.A,
166
- features: [DummyEnum.A, DummyEnum.B],
167
- externalId: 'test',
168
- active: true,
169
- description: 'test',
170
- extraFields: {
171
- test: 'test'
172
- }
173
- }))).toBeTruthy();
174
- expect(isTrue(testSchemaEquality(zodUpdatePlanSchema, typeboxUpdatePlanSchema, {
175
- id: 'test',
176
- name: 'test',
177
- price: 100,
178
- cadence: DummyEnum.A,
179
- features: [DummyEnum.A, DummyEnum.B],
180
- externalId: 'test',
181
- active: true,
182
- description: 'test',
183
- extraFields: {
184
- test: 'test'
185
- }
186
- }))).toBeTruthy();
187
- expect(isTrue(testSchemaEquality(zodPlanSchema, typeboxPlanSchema, {
188
- id: 'test',
189
- name: 'test',
190
- price: 100,
191
- cadence: DummyEnum.A,
192
- features: [DummyEnum.A, DummyEnum.B],
193
- externalId: 'test',
194
- active: true,
195
- description: 'test',
196
- extraFields: {
197
- test: 'test'
198
- }
199
- }))).toBeTruthy();
200
- });
201
- it('should be equal for subscription', () => {
202
- expect(isTrue(testSchemaEquality(zodCreateSubscriptionSchema, typeboxCreateSubscriptionSchema, {
203
- partyId: 'test',
204
- partyType: DummyEnum.A,
205
- productId: 'test',
206
- status: DummyEnum.A,
207
- active: true,
208
- externalId: 'test',
209
- startDate: new Date(),
210
- endDate: new Date(),
211
- description: 'test',
212
- extraFields: {
213
- test: 'test'
214
- },
215
- billingProvider: DummyEnum.A
216
- }))).toBeTruthy();
217
- expect(isTrue(testSchemaEquality(zodUpdateSubscriptionSchema, typeboxUpdateSubscriptionSchema, {
218
- id: 'test',
265
+ }
266
+ )
267
+ )
268
+ );
269
+ expect(
270
+ isTrue(
271
+ testSchemaEquality(zodPaymentLinkSchema, typeboxPaymentLinkSchema, {
272
+ id: 'test',
273
+ amount: 100,
274
+ currency: DummyEnum.A,
275
+ successRedirectUri: 'https://example.com',
276
+ cancelRedirectUri: 'https://example.com',
277
+ description: 'test',
278
+ metadata: {
279
+ test: 'test'
280
+ },
281
+ extraFields: {
282
+ test: 'test'
283
+ }
284
+ })
285
+ )
286
+ ).toBeTruthy();
287
+ });
288
+ it('should be equal for plan', () => {
289
+ expect(
290
+ isTrue(
291
+ testSchemaEquality(zodCreatePlanSchema, typeboxCreatePlanSchema, {
292
+ name: 'test',
293
+ price: 100,
294
+ cadence: DummyEnum.A,
295
+ features: [DummyEnum.A, DummyEnum.B],
296
+ externalId: 'test',
297
+ active: true,
298
+ description: 'test',
299
+ extraFields: {
300
+ test: 'test'
301
+ }
302
+ })
303
+ )
304
+ ).toBeTruthy();
305
+ expect(
306
+ isTrue(
307
+ testSchemaEquality(zodUpdatePlanSchema, typeboxUpdatePlanSchema, {
308
+ id: 'test',
309
+ name: 'test',
310
+ price: 100,
311
+ cadence: DummyEnum.A,
312
+ features: [DummyEnum.A, DummyEnum.B],
313
+ externalId: 'test',
314
+ active: true,
315
+ description: 'test',
316
+ extraFields: {
317
+ test: 'test'
318
+ }
319
+ })
320
+ )
321
+ ).toBeTruthy();
322
+ expect(
323
+ isTrue(
324
+ testSchemaEquality(zodPlanSchema, typeboxPlanSchema, {
325
+ id: 'test',
326
+ name: 'test',
327
+ price: 100,
328
+ cadence: DummyEnum.A,
329
+ features: [DummyEnum.A, DummyEnum.B],
330
+ externalId: 'test',
331
+ active: true,
332
+ description: 'test',
333
+ extraFields: {
334
+ test: 'test'
335
+ }
336
+ })
337
+ )
338
+ ).toBeTruthy();
339
+ });
340
+ it('should be equal for subscription', () => {
341
+ expect(
342
+ isTrue(
343
+ testSchemaEquality(
344
+ zodCreateSubscriptionSchema,
345
+ typeboxCreateSubscriptionSchema,
346
+ {
219
347
  partyId: 'test',
220
348
  partyType: DummyEnum.A,
221
349
  productId: 'test',
@@ -226,11 +354,19 @@ describe('schema equality', () => {
226
354
  endDate: new Date(),
227
355
  description: 'test',
228
356
  extraFields: {
229
- test: 'test'
357
+ test: 'test'
230
358
  },
231
359
  billingProvider: DummyEnum.A
232
- }))).toBeTruthy();
233
- expect(isTrue(testSchemaEquality(zodSubscriptionSchema, typeboxSubscriptionSchema, {
360
+ }
361
+ )
362
+ )
363
+ ).toBeTruthy();
364
+ expect(
365
+ isTrue(
366
+ testSchemaEquality(
367
+ zodUpdateSubscriptionSchema,
368
+ typeboxUpdateSubscriptionSchema,
369
+ {
234
370
  id: 'test',
235
371
  partyId: 'test',
236
372
  partyType: DummyEnum.A,
@@ -242,9 +378,32 @@ describe('schema equality', () => {
242
378
  endDate: new Date(),
243
379
  description: 'test',
244
380
  extraFields: {
245
- test: 'test'
381
+ test: 'test'
246
382
  },
247
383
  billingProvider: DummyEnum.A
248
- }))).toBeTruthy();
249
- });
384
+ }
385
+ )
386
+ )
387
+ ).toBeTruthy();
388
+ expect(
389
+ isTrue(
390
+ testSchemaEquality(zodSubscriptionSchema, typeboxSubscriptionSchema, {
391
+ id: 'test',
392
+ partyId: 'test',
393
+ partyType: DummyEnum.A,
394
+ productId: 'test',
395
+ status: DummyEnum.A,
396
+ active: true,
397
+ externalId: 'test',
398
+ startDate: new Date(),
399
+ endDate: new Date(),
400
+ description: 'test',
401
+ extraFields: {
402
+ test: 'test'
403
+ },
404
+ billingProvider: DummyEnum.A
405
+ })
406
+ )
407
+ ).toBeTruthy();
408
+ });
250
409
  });
@@ -1,4 +1,4 @@
1
1
  import type { JestConfigWithTsJest } from 'ts-jest';
2
2
  declare const jestConfig: JestConfigWithTsJest;
3
3
  export default jestConfig;
4
- //# sourceMappingURL=jest.config.d.ts.map
4
+ //# sourceMappingURL=jest.config.d.ts.map
@@ -1,19 +1,19 @@
1
1
  const jestConfig = {
2
- preset: 'ts-jest/presets/default-esm', // or other ESM presets
3
- moduleNameMapper: {
4
- '^(\\.{1,2}/.*)\\.js$': '$1'
5
- },
6
- transform: {
7
- // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
8
- // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
9
- '^.+\\.[tj]sx?$': [
10
- 'ts-jest',
11
- {
12
- useESM: true
13
- }
14
- ],
15
- '^.+\\.js$': 'babel-jest'
16
- },
17
- testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
2
+ preset: 'ts-jest/presets/default-esm', // or other ESM presets
3
+ moduleNameMapper: {
4
+ '^(\\.{1,2}/.*)\\.js$': '$1'
5
+ },
6
+ transform: {
7
+ // '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
8
+ // '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
9
+ '^.+\\.[tj]sx?$': [
10
+ 'ts-jest',
11
+ {
12
+ useESM: true
13
+ }
14
+ ],
15
+ '^.+\\.js$': 'babel-jest'
16
+ },
17
+ testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
18
18
  };
19
19
  export default jestConfig;