@forklaunch/implementation-billing-base 0.1.2 → 0.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.
- package/lib/__test__/schemaEquality.test.d.ts +2 -0
- package/lib/__test__/schemaEquality.test.d.ts.map +1 -0
- package/lib/__test__/schemaEquality.test.js +226 -0
- package/{schemas/typebox → lib/eject/schemas/zod}/billingPortal.schema.ts +1 -1
- package/{schemas/typebox → lib/eject/schemas/zod}/checkoutSession.schema.ts +1 -2
- package/{schemas/typebox → lib/eject/schemas/zod}/paymentLink.schema.ts +1 -1
- package/{schemas/typebox → lib/eject/schemas/zod}/plan.schema.ts +1 -1
- package/{schemas/typebox → lib/eject/schemas/zod}/subscription.schema.ts +1 -1
- package/lib/eject/services/services/billingPortal.service.ts +148 -0
- package/lib/eject/services/services/checkoutSession.service.ts +135 -0
- package/lib/eject/services/services/paymentLink.service.ts +173 -0
- package/lib/eject/services/services/plan.service.ts +135 -0
- package/lib/eject/services/subscription.service.ts +239 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/jest.config.d.ts +4 -0
- package/lib/jest.config.d.ts.map +1 -0
- package/lib/jest.config.js +19 -0
- package/lib/schemas/billingPortal.schema.d.ts +42 -0
- package/lib/schemas/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/billingPortal.schema.js +14 -0
- package/lib/schemas/checkoutSession.schema.d.ts +55 -0
- package/lib/schemas/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/checkoutSession.schema.js +14 -0
- package/lib/schemas/paymentLink.schema.d.ts +66 -0
- package/lib/schemas/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/paymentLink.schema.js +14 -0
- package/lib/schemas/plan.schema.d.ts +78 -0
- package/lib/schemas/plan.schema.d.ts.map +1 -0
- package/lib/schemas/plan.schema.js +14 -0
- package/lib/schemas/subscription.schema.d.ts +90 -0
- package/lib/schemas/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/subscription.schema.js +14 -0
- package/lib/schemas/typebox/billingPortal.schema.d.ts +20 -0
- package/lib/schemas/typebox/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/billingPortal.schema.js +20 -0
- package/lib/schemas/typebox/checkoutSession.schema.d.ts +28 -0
- package/lib/schemas/typebox/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/checkoutSession.schema.js +27 -0
- package/lib/schemas/typebox/paymentLink.schema.d.ts +33 -0
- package/lib/schemas/typebox/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/paymentLink.schema.js +32 -0
- package/lib/schemas/typebox/plan.schema.d.ts +39 -0
- package/lib/schemas/typebox/plan.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/plan.schema.js +38 -0
- package/lib/schemas/typebox/subscription.schema.d.ts +45 -0
- package/lib/schemas/typebox/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/subscription.schema.js +44 -0
- package/lib/schemas/zod/billingPortal.schema.d.ts +20 -0
- package/lib/schemas/zod/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/zod/billingPortal.schema.js +20 -0
- package/lib/schemas/zod/checkoutSession.schema.d.ts +27 -0
- package/lib/schemas/zod/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/zod/checkoutSession.schema.js +26 -0
- package/lib/schemas/zod/paymentLink.schema.d.ts +33 -0
- package/lib/schemas/zod/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/zod/paymentLink.schema.js +32 -0
- package/lib/schemas/zod/plan.schema.d.ts +39 -0
- package/lib/schemas/zod/plan.schema.d.ts.map +1 -0
- package/lib/schemas/zod/plan.schema.js +38 -0
- package/lib/schemas/zod/subscription.schema.d.ts +45 -0
- package/lib/schemas/zod/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/zod/subscription.schema.js +44 -0
- package/lib/services/billingPortal.service.d.ts +44 -0
- package/lib/services/billingPortal.service.d.ts.map +1 -0
- package/lib/services/billingPortal.service.js +51 -0
- package/lib/services/checkoutSession.service.d.ts +45 -0
- package/lib/services/checkoutSession.service.d.ts.map +1 -0
- package/lib/services/checkoutSession.service.js +49 -0
- package/lib/services/paymentLink.service.d.ts +48 -0
- package/lib/services/paymentLink.service.d.ts.map +1 -0
- package/lib/services/paymentLink.service.js +72 -0
- package/lib/services/plan.service.d.ts +42 -0
- package/lib/services/plan.service.d.ts.map +1 -0
- package/lib/services/plan.service.js +43 -0
- package/lib/services/subscription.service.d.ts +52 -0
- package/lib/services/subscription.service.d.ts.map +1 -0
- package/lib/services/subscription.service.js +94 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/vitest.config.d.ts +3 -0
- package/lib/vitest.config.d.ts.map +1 -0
- package/lib/vitest.config.js +7 -0
- package/package.json +6 -4
- package/__test__/schemaEquality.test.ts +0 -411
- package/schemas/billingPortal.schema.ts +0 -28
- package/schemas/checkoutSession.schema.ts +0 -28
- package/schemas/paymentLink.schema.ts +0 -28
- package/schemas/plan.schema.ts +0 -28
- package/schemas/subscription.schema.ts +0 -28
- package/tsconfig.json +0 -7
- /package/{schemas/zod → lib/eject/schemas}/billingPortal.schema.ts +0 -0
- /package/{schemas/zod → lib/eject/schemas}/checkoutSession.schema.ts +0 -0
- /package/{schemas/zod → lib/eject/schemas}/paymentLink.schema.ts +0 -0
- /package/{schemas/zod → lib/eject/schemas}/plan.schema.ts +0 -0
- /package/{schemas/zod → lib/eject/schemas}/subscription.schema.ts +0 -0
- /package/{services → lib/eject/services}/billingPortal.service.ts +0 -0
- /package/{services → lib/eject/services}/checkoutSession.service.ts +0 -0
- /package/{services → lib/eject/services}/paymentLink.service.ts +0 -0
- /package/{services → lib/eject/services}/plan.service.ts +0 -0
- /package/{services → lib/eject/services/services}/subscription.service.ts +0 -0
- /package/{index.ts → lib/index.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-billing-base",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Billing basic implementation for forklaunch",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Forklift Technologies, Inc.",
|
|
15
|
-
"
|
|
15
|
+
"files": [
|
|
16
|
+
"lib/**"
|
|
17
|
+
],
|
|
16
18
|
"dependencies": {
|
|
17
19
|
"@forklaunch/common": "^0.2.5",
|
|
18
20
|
"@forklaunch/core": "^0.6.0",
|
|
@@ -21,7 +23,7 @@
|
|
|
21
23
|
"@sinclair/typebox": "^0.34.33",
|
|
22
24
|
"ajv": "^8.17.1",
|
|
23
25
|
"zod": "^3.24.2",
|
|
24
|
-
"@forklaunch/interfaces-billing": "0.1.
|
|
26
|
+
"@forklaunch/interfaces-billing": "0.1.4"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
29
|
"depcheck": "^1.4.7",
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
},
|
|
31
33
|
"scripts": {
|
|
32
34
|
"build": "tsc && pnpm package:eject",
|
|
33
|
-
"clean": "rm -rf
|
|
35
|
+
"clean": "rm -rf lib pnpm.lock.yaml node_modules",
|
|
34
36
|
"docs": "typedoc --out docs *",
|
|
35
37
|
"format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
|
|
36
38
|
"lint": "eslint . -c eslint.config.mjs",
|
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
import { isTrue } from '@forklaunch/common';
|
|
2
|
-
import { DummyEnum, testSchemaEquality } from '@forklaunch/core/test';
|
|
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';
|
|
53
|
-
|
|
54
|
-
const zodUpdateBillingPortalSchema = ZodUpdateBillingPortalSchema(false);
|
|
55
|
-
const typeboxUpdateBillingPortalSchema =
|
|
56
|
-
TypeboxUpdateBillingPortalSchema(false);
|
|
57
|
-
const zodBillingPortalSchema = ZodBillingPortalSchema(false);
|
|
58
|
-
const typeboxBillingPortalSchema = TypeboxBillingPortalSchema(false);
|
|
59
|
-
|
|
60
|
-
const zodCreateCheckoutSessionSchema =
|
|
61
|
-
ZodCreateCheckoutSessionSchema(DummyEnum);
|
|
62
|
-
const typeboxCreateCheckoutSessionSchema =
|
|
63
|
-
TypeboxCreateCheckoutSessionSchema(DummyEnum);
|
|
64
|
-
const zodUpdateCheckoutSessionSchema =
|
|
65
|
-
ZodUpdateCheckoutSessionSchema(false)(DummyEnum);
|
|
66
|
-
const typeboxUpdateCheckoutSessionSchema =
|
|
67
|
-
TypeboxUpdateCheckoutSessionSchema(false)(DummyEnum);
|
|
68
|
-
const zodCheckoutSessionSchema = ZodCheckoutSessionSchema(false)(DummyEnum);
|
|
69
|
-
const typeboxCheckoutSessionSchema =
|
|
70
|
-
TypeboxCheckoutSessionSchema(false)(DummyEnum);
|
|
71
|
-
|
|
72
|
-
const zodCreatePaymentLinkSchema = ZodCreatePaymentLinkSchema(DummyEnum);
|
|
73
|
-
const typeboxCreatePaymentLinkSchema =
|
|
74
|
-
TypeboxCreatePaymentLinkSchema(DummyEnum);
|
|
75
|
-
const zodUpdatePaymentLinkSchema = ZodUpdatePaymentLinkSchema(false)(DummyEnum);
|
|
76
|
-
const typeboxUpdatePaymentLinkSchema =
|
|
77
|
-
TypeboxUpdatePaymentLinkSchema(false)(DummyEnum);
|
|
78
|
-
const zodPaymentLinkSchema = ZodPaymentLinkSchema(false)(DummyEnum);
|
|
79
|
-
const typeboxPaymentLinkSchema = TypeboxPaymentLinkSchema(false)(DummyEnum);
|
|
80
|
-
|
|
81
|
-
const zodCreatePlanSchema = ZodCreatePlanSchema(DummyEnum, DummyEnum);
|
|
82
|
-
const typeboxCreatePlanSchema = TypeboxCreatePlanSchema(DummyEnum, DummyEnum);
|
|
83
|
-
const zodUpdatePlanSchema = ZodUpdatePlanSchema(false)(DummyEnum, DummyEnum);
|
|
84
|
-
const typeboxUpdatePlanSchema = TypeboxUpdatePlanSchema(false)(
|
|
85
|
-
DummyEnum,
|
|
86
|
-
DummyEnum
|
|
87
|
-
);
|
|
88
|
-
const zodPlanSchema = ZodPlanSchema(false)(DummyEnum, DummyEnum);
|
|
89
|
-
const typeboxPlanSchema = TypeboxPlanSchema(false)(DummyEnum, DummyEnum);
|
|
90
|
-
|
|
91
|
-
const zodCreateSubscriptionSchema = ZodCreateSubscriptionSchema(
|
|
92
|
-
DummyEnum,
|
|
93
|
-
DummyEnum
|
|
94
|
-
);
|
|
95
|
-
const typeboxCreateSubscriptionSchema = TypeboxCreateSubscriptionSchema(
|
|
96
|
-
DummyEnum,
|
|
97
|
-
DummyEnum
|
|
98
|
-
);
|
|
99
|
-
const zodUpdateSubscriptionSchema = ZodUpdateSubscriptionSchema(false)(
|
|
100
|
-
DummyEnum,
|
|
101
|
-
DummyEnum
|
|
102
|
-
);
|
|
103
|
-
const typeboxUpdateSubscriptionSchema = TypeboxUpdateSubscriptionSchema(false)(
|
|
104
|
-
DummyEnum,
|
|
105
|
-
DummyEnum
|
|
106
|
-
);
|
|
107
|
-
const zodSubscriptionSchema = ZodSubscriptionSchema(false)(
|
|
108
|
-
DummyEnum,
|
|
109
|
-
DummyEnum
|
|
110
|
-
);
|
|
111
|
-
const typeboxSubscriptionSchema = TypeboxSubscriptionSchema(false)(
|
|
112
|
-
DummyEnum,
|
|
113
|
-
DummyEnum
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
describe('schema equality', () => {
|
|
117
|
-
it('should be equal for billing portal', () => {
|
|
118
|
-
expect(
|
|
119
|
-
isTrue(
|
|
120
|
-
testSchemaEquality(
|
|
121
|
-
ZodCreateBillingPortalSchema,
|
|
122
|
-
TypeboxCreateBillingPortalSchema,
|
|
123
|
-
{
|
|
124
|
-
customerId: 'test',
|
|
125
|
-
uri: 'https://example.com',
|
|
126
|
-
expiresAt: new Date()
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
)
|
|
130
|
-
).toBeTruthy();
|
|
131
|
-
|
|
132
|
-
expect(
|
|
133
|
-
isTrue(
|
|
134
|
-
testSchemaEquality(
|
|
135
|
-
zodUpdateBillingPortalSchema,
|
|
136
|
-
typeboxUpdateBillingPortalSchema,
|
|
137
|
-
{
|
|
138
|
-
id: 'test',
|
|
139
|
-
uri: 'https://example.com',
|
|
140
|
-
expiresAt: new Date()
|
|
141
|
-
}
|
|
142
|
-
)
|
|
143
|
-
)
|
|
144
|
-
).toBeTruthy();
|
|
145
|
-
|
|
146
|
-
expect(
|
|
147
|
-
isTrue(
|
|
148
|
-
testSchemaEquality(zodBillingPortalSchema, typeboxBillingPortalSchema, {
|
|
149
|
-
id: 'test',
|
|
150
|
-
customerId: 'test',
|
|
151
|
-
uri: 'https://example.com',
|
|
152
|
-
expiresAt: new Date(),
|
|
153
|
-
extraFields: {
|
|
154
|
-
test: 'test'
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
)
|
|
158
|
-
).toBeTruthy();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('should be equal for checkout session', () => {
|
|
162
|
-
expect(
|
|
163
|
-
isTrue(
|
|
164
|
-
testSchemaEquality(
|
|
165
|
-
zodCreateCheckoutSessionSchema,
|
|
166
|
-
typeboxCreateCheckoutSessionSchema,
|
|
167
|
-
{
|
|
168
|
-
customerId: 'test',
|
|
169
|
-
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
170
|
-
successRedirectUri: 'https://example.com',
|
|
171
|
-
cancelRedirectUri: 'https://example.com',
|
|
172
|
-
extraFields: {
|
|
173
|
-
test: 'test'
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
)
|
|
178
|
-
).toBeTruthy();
|
|
179
|
-
|
|
180
|
-
expect(
|
|
181
|
-
isTrue(
|
|
182
|
-
testSchemaEquality(
|
|
183
|
-
zodUpdateCheckoutSessionSchema,
|
|
184
|
-
typeboxUpdateCheckoutSessionSchema,
|
|
185
|
-
{
|
|
186
|
-
id: 'test',
|
|
187
|
-
customerId: 'test',
|
|
188
|
-
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
189
|
-
successRedirectUri: 'https://example.com',
|
|
190
|
-
cancelRedirectUri: 'https://example.com',
|
|
191
|
-
extraFields: {
|
|
192
|
-
test: 'test'
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
)
|
|
196
|
-
)
|
|
197
|
-
).toBeTruthy();
|
|
198
|
-
|
|
199
|
-
expect(
|
|
200
|
-
isTrue(
|
|
201
|
-
testSchemaEquality(
|
|
202
|
-
zodCheckoutSessionSchema,
|
|
203
|
-
typeboxCheckoutSessionSchema,
|
|
204
|
-
{
|
|
205
|
-
id: 'test',
|
|
206
|
-
customerId: 'test',
|
|
207
|
-
paymentMethods: [DummyEnum.A, DummyEnum.B],
|
|
208
|
-
successRedirectUri: 'https://example.com',
|
|
209
|
-
cancelRedirectUri: 'https://example.com',
|
|
210
|
-
extraFields: {
|
|
211
|
-
test: 'test'
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
)
|
|
216
|
-
).toBeTruthy();
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it('should be equal for payment link', () => {
|
|
220
|
-
expect(
|
|
221
|
-
isTrue(
|
|
222
|
-
testSchemaEquality(
|
|
223
|
-
zodCreatePaymentLinkSchema,
|
|
224
|
-
typeboxCreatePaymentLinkSchema,
|
|
225
|
-
{
|
|
226
|
-
amount: 100,
|
|
227
|
-
currency: DummyEnum.A,
|
|
228
|
-
successRedirectUri: 'https://example.com',
|
|
229
|
-
cancelRedirectUri: 'https://example.com',
|
|
230
|
-
description: 'test',
|
|
231
|
-
metadata: {
|
|
232
|
-
test: 'test'
|
|
233
|
-
},
|
|
234
|
-
extraFields: {
|
|
235
|
-
test: 'test'
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
)
|
|
239
|
-
)
|
|
240
|
-
).toBeTruthy();
|
|
241
|
-
|
|
242
|
-
expect(
|
|
243
|
-
isTrue(
|
|
244
|
-
testSchemaEquality(
|
|
245
|
-
zodUpdatePaymentLinkSchema,
|
|
246
|
-
typeboxUpdatePaymentLinkSchema,
|
|
247
|
-
{
|
|
248
|
-
id: 'test',
|
|
249
|
-
amount: 100,
|
|
250
|
-
currency: DummyEnum.A,
|
|
251
|
-
successRedirectUri: 'https://example.com',
|
|
252
|
-
cancelRedirectUri: 'https://example.com',
|
|
253
|
-
description: 'test',
|
|
254
|
-
metadata: {
|
|
255
|
-
test: 'test'
|
|
256
|
-
},
|
|
257
|
-
extraFields: {
|
|
258
|
-
test: 'test'
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
)
|
|
262
|
-
)
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
expect(
|
|
266
|
-
isTrue(
|
|
267
|
-
testSchemaEquality(zodPaymentLinkSchema, typeboxPaymentLinkSchema, {
|
|
268
|
-
id: 'test',
|
|
269
|
-
amount: 100,
|
|
270
|
-
currency: DummyEnum.A,
|
|
271
|
-
successRedirectUri: 'https://example.com',
|
|
272
|
-
cancelRedirectUri: 'https://example.com',
|
|
273
|
-
description: 'test',
|
|
274
|
-
metadata: {
|
|
275
|
-
test: 'test'
|
|
276
|
-
},
|
|
277
|
-
extraFields: {
|
|
278
|
-
test: 'test'
|
|
279
|
-
}
|
|
280
|
-
})
|
|
281
|
-
)
|
|
282
|
-
).toBeTruthy();
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
it('should be equal for plan', () => {
|
|
286
|
-
expect(
|
|
287
|
-
isTrue(
|
|
288
|
-
testSchemaEquality(zodCreatePlanSchema, typeboxCreatePlanSchema, {
|
|
289
|
-
name: 'test',
|
|
290
|
-
price: 100,
|
|
291
|
-
cadence: DummyEnum.A,
|
|
292
|
-
features: [DummyEnum.A, DummyEnum.B],
|
|
293
|
-
externalId: 'test',
|
|
294
|
-
active: true,
|
|
295
|
-
description: 'test',
|
|
296
|
-
extraFields: {
|
|
297
|
-
test: 'test'
|
|
298
|
-
}
|
|
299
|
-
})
|
|
300
|
-
)
|
|
301
|
-
).toBeTruthy();
|
|
302
|
-
|
|
303
|
-
expect(
|
|
304
|
-
isTrue(
|
|
305
|
-
testSchemaEquality(zodUpdatePlanSchema, typeboxUpdatePlanSchema, {
|
|
306
|
-
id: 'test',
|
|
307
|
-
name: 'test',
|
|
308
|
-
price: 100,
|
|
309
|
-
cadence: DummyEnum.A,
|
|
310
|
-
features: [DummyEnum.A, DummyEnum.B],
|
|
311
|
-
externalId: 'test',
|
|
312
|
-
active: true,
|
|
313
|
-
description: 'test',
|
|
314
|
-
extraFields: {
|
|
315
|
-
test: 'test'
|
|
316
|
-
}
|
|
317
|
-
})
|
|
318
|
-
)
|
|
319
|
-
).toBeTruthy();
|
|
320
|
-
|
|
321
|
-
expect(
|
|
322
|
-
isTrue(
|
|
323
|
-
testSchemaEquality(zodPlanSchema, typeboxPlanSchema, {
|
|
324
|
-
id: 'test',
|
|
325
|
-
name: 'test',
|
|
326
|
-
price: 100,
|
|
327
|
-
cadence: DummyEnum.A,
|
|
328
|
-
features: [DummyEnum.A, DummyEnum.B],
|
|
329
|
-
externalId: 'test',
|
|
330
|
-
active: true,
|
|
331
|
-
description: 'test',
|
|
332
|
-
extraFields: {
|
|
333
|
-
test: 'test'
|
|
334
|
-
}
|
|
335
|
-
})
|
|
336
|
-
)
|
|
337
|
-
).toBeTruthy();
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
it('should be equal for subscription', () => {
|
|
341
|
-
expect(
|
|
342
|
-
isTrue(
|
|
343
|
-
testSchemaEquality(
|
|
344
|
-
zodCreateSubscriptionSchema,
|
|
345
|
-
typeboxCreateSubscriptionSchema,
|
|
346
|
-
{
|
|
347
|
-
partyId: 'test',
|
|
348
|
-
partyType: DummyEnum.A,
|
|
349
|
-
productId: 'test',
|
|
350
|
-
status: DummyEnum.A,
|
|
351
|
-
active: true,
|
|
352
|
-
externalId: 'test',
|
|
353
|
-
startDate: new Date(),
|
|
354
|
-
endDate: new Date(),
|
|
355
|
-
description: 'test',
|
|
356
|
-
extraFields: {
|
|
357
|
-
test: 'test'
|
|
358
|
-
},
|
|
359
|
-
billingProvider: DummyEnum.A
|
|
360
|
-
}
|
|
361
|
-
)
|
|
362
|
-
)
|
|
363
|
-
).toBeTruthy();
|
|
364
|
-
|
|
365
|
-
expect(
|
|
366
|
-
isTrue(
|
|
367
|
-
testSchemaEquality(
|
|
368
|
-
zodUpdateSubscriptionSchema,
|
|
369
|
-
typeboxUpdateSubscriptionSchema,
|
|
370
|
-
{
|
|
371
|
-
id: 'test',
|
|
372
|
-
partyId: 'test',
|
|
373
|
-
partyType: DummyEnum.A,
|
|
374
|
-
productId: 'test',
|
|
375
|
-
status: DummyEnum.A,
|
|
376
|
-
active: true,
|
|
377
|
-
externalId: 'test',
|
|
378
|
-
startDate: new Date(),
|
|
379
|
-
endDate: new Date(),
|
|
380
|
-
description: 'test',
|
|
381
|
-
extraFields: {
|
|
382
|
-
test: 'test'
|
|
383
|
-
},
|
|
384
|
-
billingProvider: DummyEnum.A
|
|
385
|
-
}
|
|
386
|
-
)
|
|
387
|
-
)
|
|
388
|
-
).toBeTruthy();
|
|
389
|
-
|
|
390
|
-
expect(
|
|
391
|
-
isTrue(
|
|
392
|
-
testSchemaEquality(zodSubscriptionSchema, typeboxSubscriptionSchema, {
|
|
393
|
-
id: 'test',
|
|
394
|
-
partyId: 'test',
|
|
395
|
-
partyType: DummyEnum.A,
|
|
396
|
-
productId: 'test',
|
|
397
|
-
status: DummyEnum.A,
|
|
398
|
-
active: true,
|
|
399
|
-
externalId: 'test',
|
|
400
|
-
startDate: new Date(),
|
|
401
|
-
endDate: new Date(),
|
|
402
|
-
description: 'test',
|
|
403
|
-
extraFields: {
|
|
404
|
-
test: 'test'
|
|
405
|
-
},
|
|
406
|
-
billingProvider: DummyEnum.A
|
|
407
|
-
})
|
|
408
|
-
)
|
|
409
|
-
).toBeTruthy();
|
|
410
|
-
});
|
|
411
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { serviceSchemaResolver } from '@forklaunch/core/dtoMapper';
|
|
2
|
-
import {
|
|
3
|
-
BillingPortalSchema as TypeBoxBillingPortalSchema,
|
|
4
|
-
CreateBillingPortalSchema as TypeBoxCreateBillingPortalSchema,
|
|
5
|
-
UpdateBillingPortalSchema as TypeBoxUpdateBillingPortalSchema
|
|
6
|
-
} from './typebox/billingPortal.schema';
|
|
7
|
-
import {
|
|
8
|
-
BillingPortalSchema as ZodBillingPortalSchema,
|
|
9
|
-
CreateBillingPortalSchema as ZodCreateBillingPortalSchema,
|
|
10
|
-
UpdateBillingPortalSchema as ZodUpdateBillingPortalSchema
|
|
11
|
-
} from './zod/billingPortal.schema';
|
|
12
|
-
|
|
13
|
-
const TypeBoxSchemas = (uuidId: boolean) => ({
|
|
14
|
-
CreateBillingPortalSchema: TypeBoxCreateBillingPortalSchema,
|
|
15
|
-
UpdateBillingPortalSchema: TypeBoxUpdateBillingPortalSchema(uuidId),
|
|
16
|
-
BillingPortalSchema: TypeBoxBillingPortalSchema(uuidId)
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const ZodSchemas = (uuidId: boolean) => ({
|
|
20
|
-
CreateBillingPortalSchema: ZodCreateBillingPortalSchema,
|
|
21
|
-
UpdateBillingPortalSchema: ZodUpdateBillingPortalSchema(uuidId),
|
|
22
|
-
BillingPortalSchema: ZodBillingPortalSchema(uuidId)
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BaseBillingPortalServiceSchemas = serviceSchemaResolver(
|
|
26
|
-
TypeBoxSchemas,
|
|
27
|
-
ZodSchemas
|
|
28
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { serviceSchemaResolver } from '@forklaunch/core/dtoMapper';
|
|
2
|
-
import {
|
|
3
|
-
CheckoutSessionSchema as TypeBoxCheckoutSessionSchema,
|
|
4
|
-
CreateCheckoutSessionSchema as TypeBoxCreateCheckoutSessionSchema,
|
|
5
|
-
UpdateCheckoutSessionSchema as TypeBoxUpdateCheckoutSessionSchema
|
|
6
|
-
} from './typebox/checkoutSession.schema';
|
|
7
|
-
import {
|
|
8
|
-
CheckoutSessionSchema as ZodCheckoutSessionSchema,
|
|
9
|
-
CreateCheckoutSessionSchema as ZodCreateCheckoutSessionSchema,
|
|
10
|
-
UpdateCheckoutSessionSchema as ZodUpdateCheckoutSessionSchema
|
|
11
|
-
} from './zod/checkoutSession.schema';
|
|
12
|
-
|
|
13
|
-
const TypeBoxSchemas = (uuidId: boolean) => ({
|
|
14
|
-
CreateCheckoutSessionSchema: TypeBoxCreateCheckoutSessionSchema,
|
|
15
|
-
UpdateCheckoutSessionSchema: TypeBoxUpdateCheckoutSessionSchema(uuidId),
|
|
16
|
-
CheckoutSessionSchema: TypeBoxCheckoutSessionSchema(uuidId)
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const ZodSchemas = (uuidId: boolean) => ({
|
|
20
|
-
CreateCheckoutSessionSchema: ZodCreateCheckoutSessionSchema,
|
|
21
|
-
UpdateCheckoutSessionSchema: ZodUpdateCheckoutSessionSchema(uuidId),
|
|
22
|
-
CheckoutSessionSchema: ZodCheckoutSessionSchema(uuidId)
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BaseCheckoutSessionServiceSchemas = serviceSchemaResolver(
|
|
26
|
-
TypeBoxSchemas,
|
|
27
|
-
ZodSchemas
|
|
28
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { serviceSchemaResolver } from '@forklaunch/core/dtoMapper';
|
|
2
|
-
import {
|
|
3
|
-
CreatePaymentLinkSchema as TypeBoxCreatePaymentLinkSchema,
|
|
4
|
-
PaymentLinkSchema as TypeBoxPaymentLinkSchema,
|
|
5
|
-
UpdatePaymentLinkSchema as TypeBoxUpdatePaymentLinkSchema
|
|
6
|
-
} from './typebox/paymentLink.schema';
|
|
7
|
-
import {
|
|
8
|
-
CreatePaymentLinkSchema as ZodCreatePaymentLinkSchema,
|
|
9
|
-
PaymentLinkSchema as ZodPaymentLinkSchema,
|
|
10
|
-
UpdatePaymentLinkSchema as ZodUpdatePaymentLinkSchema
|
|
11
|
-
} from './zod/paymentLink.schema';
|
|
12
|
-
|
|
13
|
-
const TypeBoxSchemas = (uuidId: boolean) => ({
|
|
14
|
-
CreatePaymentLinkSchema: TypeBoxCreatePaymentLinkSchema,
|
|
15
|
-
UpdatePaymentLinkSchema: TypeBoxUpdatePaymentLinkSchema(uuidId),
|
|
16
|
-
PaymentLinkSchema: TypeBoxPaymentLinkSchema(uuidId)
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const ZodSchemas = (uuidId: boolean) => ({
|
|
20
|
-
CreatePaymentLinkSchema: ZodCreatePaymentLinkSchema,
|
|
21
|
-
UpdatePaymentLinkSchema: ZodUpdatePaymentLinkSchema(uuidId),
|
|
22
|
-
PaymentLinkSchema: ZodPaymentLinkSchema(uuidId)
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BasePaymentLinkServiceSchemas = serviceSchemaResolver(
|
|
26
|
-
TypeBoxSchemas,
|
|
27
|
-
ZodSchemas
|
|
28
|
-
);
|
package/schemas/plan.schema.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { serviceSchemaResolver } from '@forklaunch/core/dtoMapper';
|
|
2
|
-
import {
|
|
3
|
-
CreatePlanSchema as TypeBoxCreatePlanSchema,
|
|
4
|
-
PlanSchema as TypeBoxPlanSchema,
|
|
5
|
-
UpdatePlanSchema as TypeBoxUpdatePlanSchema
|
|
6
|
-
} from './typebox/plan.schema';
|
|
7
|
-
import {
|
|
8
|
-
CreatePlanSchema as ZodCreatePlanSchema,
|
|
9
|
-
PlanSchema as ZodPlanSchema,
|
|
10
|
-
UpdatePlanSchema as ZodUpdatePlanSchema
|
|
11
|
-
} from './zod/plan.schema';
|
|
12
|
-
|
|
13
|
-
const TypeBoxSchemas = (uuidId: boolean) => ({
|
|
14
|
-
CreatePlanSchema: TypeBoxCreatePlanSchema,
|
|
15
|
-
UpdatePlanSchema: TypeBoxUpdatePlanSchema(uuidId),
|
|
16
|
-
PlanSchema: TypeBoxPlanSchema(uuidId)
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const ZodSchemas = (uuidId: boolean) => ({
|
|
20
|
-
CreatePlanSchema: ZodCreatePlanSchema,
|
|
21
|
-
UpdatePlanSchema: ZodUpdatePlanSchema(uuidId),
|
|
22
|
-
PlanSchema: ZodPlanSchema(uuidId)
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BasePlanServiceSchemas = serviceSchemaResolver(
|
|
26
|
-
TypeBoxSchemas,
|
|
27
|
-
ZodSchemas
|
|
28
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { serviceSchemaResolver } from '@forklaunch/core/dtoMapper';
|
|
2
|
-
import {
|
|
3
|
-
CreateSubscriptionSchema as TypeBoxCreateSubscriptionSchema,
|
|
4
|
-
SubscriptionSchema as TypeBoxSubscriptionSchema,
|
|
5
|
-
UpdateSubscriptionSchema as TypeBoxUpdateSubscriptionSchema
|
|
6
|
-
} from './typebox/subscription.schema';
|
|
7
|
-
import {
|
|
8
|
-
CreateSubscriptionSchema as ZodCreateSubscriptionSchema,
|
|
9
|
-
SubscriptionSchema as ZodSubscriptionSchema,
|
|
10
|
-
UpdateSubscriptionSchema as ZodUpdateSubscriptionSchema
|
|
11
|
-
} from './zod/subscription.schema';
|
|
12
|
-
|
|
13
|
-
const TypeBoxSchemas = (uuidId: boolean) => ({
|
|
14
|
-
CreateSubscriptionSchema: TypeBoxCreateSubscriptionSchema,
|
|
15
|
-
UpdateSubscriptionSchema: TypeBoxUpdateSubscriptionSchema(uuidId),
|
|
16
|
-
SubscriptionSchema: TypeBoxSubscriptionSchema
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const ZodSchemas = (uuidId: boolean) => ({
|
|
20
|
-
CreateSubscriptionSchema: ZodCreateSubscriptionSchema,
|
|
21
|
-
UpdateSubscriptionSchema: ZodUpdateSubscriptionSchema(uuidId),
|
|
22
|
-
SubscriptionSchema: ZodSubscriptionSchema(uuidId)
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export const BaseSubscriptionServiceSchemas = serviceSchemaResolver(
|
|
26
|
-
TypeBoxSchemas,
|
|
27
|
-
ZodSchemas
|
|
28
|
-
);
|
package/tsconfig.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|