@forklaunch/implementation-billing-base 0.6.5 → 0.7.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.
@@ -1,314 +1,116 @@
1
- import {
2
- BillingPortalDto,
3
- CreateBillingPortalDto,
4
- UpdateBillingPortalDto,
5
- CheckoutSessionDto,
6
- CreateCheckoutSessionDto,
7
- UpdateCheckoutSessionDto,
8
- PaymentLinkDto,
9
- CreatePaymentLinkDto,
10
- UpdatePaymentLinkDto,
11
- PlanDto,
12
- CreatePlanDto,
13
- UpdatePlanDto,
14
- SubscriptionDto,
15
- CreateSubscriptionDto,
16
- UpdateSubscriptionDto
17
- } from '@forklaunch/interfaces-billing/types';
1
+ import { BillingPortalDto, CreateBillingPortalDto, UpdateBillingPortalDto, CheckoutSessionDto, CreateCheckoutSessionDto, UpdateCheckoutSessionDto, PaymentLinkDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, PlanDto, CreatePlanDto, UpdatePlanDto, SubscriptionDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
18
2
  import { EntityManager } from '@mikro-orm/core';
19
3
 
20
4
  type BaseBillingDtos = {
21
- BillingPortalMapper: BillingPortalDto;
22
- CreateBillingPortalMapper: CreateBillingPortalDto;
23
- UpdateBillingPortalMapper: UpdateBillingPortalDto;
5
+ BillingPortalMapper: BillingPortalDto;
6
+ CreateBillingPortalMapper: CreateBillingPortalDto;
7
+ UpdateBillingPortalMapper: UpdateBillingPortalDto;
24
8
  };
25
9
  type BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
26
- CheckoutSessionMapper: CheckoutSessionDto<
27
- PaymentMethodEnum,
28
- CurrencyEnum,
29
- StatusEnum
30
- >;
31
- CreateCheckoutSessionMapper: CreateCheckoutSessionDto<
32
- PaymentMethodEnum,
33
- CurrencyEnum,
34
- StatusEnum
35
- >;
36
- UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<
37
- PaymentMethodEnum,
38
- CurrencyEnum,
39
- StatusEnum
40
- >;
10
+ CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
11
+ CreateCheckoutSessionMapper: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
12
+ UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
41
13
  };
42
14
  type BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
43
- PaymentLinkMapper: PaymentLinkDto<
44
- PaymentMethodEnum,
45
- CurrencyEnum,
46
- StatusEnum
47
- >;
48
- CreatePaymentLinkMapper: CreatePaymentLinkDto<
49
- PaymentMethodEnum,
50
- CurrencyEnum,
51
- StatusEnum
52
- >;
53
- UpdatePaymentLinkMapper: UpdatePaymentLinkDto<
54
- PaymentMethodEnum,
55
- CurrencyEnum,
56
- StatusEnum
57
- >;
15
+ PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
16
+ CreatePaymentLinkMapper: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
17
+ UpdatePaymentLinkMapper: UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
58
18
  };
59
19
  type BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
60
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
61
- CreatePlanMapper: CreatePlanDto<
62
- PlanCadenceEnum,
63
- CurrencyEnum,
64
- BillingProviderEnum
65
- >;
66
- UpdatePlanMapper: UpdatePlanDto<
67
- PlanCadenceEnum,
68
- CurrencyEnum,
69
- BillingProviderEnum
70
- >;
20
+ PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
21
+ CreatePlanMapper: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
22
+ UpdatePlanMapper: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
71
23
  };
72
24
  type BaseSubscriptionDtos<PartyType, BillingProviderType> = {
73
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
74
- CreateSubscriptionMapper: CreateSubscriptionDto<
75
- PartyType,
76
- BillingProviderType
77
- >;
78
- UpdateSubscriptionMapper: UpdateSubscriptionDto<
79
- PartyType,
80
- BillingProviderType
81
- >;
25
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
26
+ CreateSubscriptionMapper: CreateSubscriptionDto<PartyType, BillingProviderType>;
27
+ UpdateSubscriptionMapper: UpdateSubscriptionDto<PartyType, BillingProviderType>;
82
28
  };
83
29
 
84
30
  type BaseBillingEntities = {
85
- BillingPortalMapper: BillingPortalDto;
86
- CreateBillingPortalMapper: BillingPortalDto;
87
- UpdateBillingPortalMapper: BillingPortalDto;
31
+ BillingPortalMapper: BillingPortalDto;
32
+ CreateBillingPortalMapper: BillingPortalDto;
33
+ UpdateBillingPortalMapper: BillingPortalDto;
34
+ };
35
+ type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
36
+ CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
37
+ CreateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
38
+ UpdateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
88
39
  };
89
- type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
90
- {
91
- CheckoutSessionMapper: CheckoutSessionDto<
92
- PaymentMethodEnum,
93
- CurrencyEnum,
94
- StatusEnum
95
- >;
96
- CreateCheckoutSessionMapper: CheckoutSessionDto<
97
- PaymentMethodEnum,
98
- CurrencyEnum,
99
- StatusEnum
100
- >;
101
- UpdateCheckoutSessionMapper: CheckoutSessionDto<
102
- PaymentMethodEnum,
103
- CurrencyEnum,
104
- StatusEnum
105
- >;
106
- };
107
40
  type BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
108
- PaymentLinkMapper: PaymentLinkDto<
109
- PaymentMethodEnum,
110
- CurrencyEnum,
111
- StatusEnum
112
- >;
113
- CreatePaymentLinkMapper: PaymentLinkDto<
114
- PaymentMethodEnum,
115
- CurrencyEnum,
116
- StatusEnum
117
- >;
118
- UpdatePaymentLinkMapper: PaymentLinkDto<
119
- PaymentMethodEnum,
120
- CurrencyEnum,
121
- StatusEnum
122
- >;
41
+ PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
42
+ CreatePaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
43
+ UpdatePaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
123
44
  };
124
45
  type BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
125
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
126
- CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
127
- UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
46
+ PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
47
+ CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
48
+ UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
128
49
  };
129
50
  type BaseSubscriptionEntities<PartyType, BillingProviderType> = {
130
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
131
- CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
132
- UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
51
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
52
+ CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
53
+ UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
133
54
  };
134
55
 
135
- type BillingPortalMappers<
136
- MapperEntities extends BaseBillingEntities,
137
- MapperDomains extends BaseBillingDtos
138
- > = {
139
- BillingPortalMapper: {
140
- toDto: (
141
- entity: MapperEntities['BillingPortalMapper']
142
- ) => Promise<MapperDomains['BillingPortalMapper']>;
143
- };
144
- CreateBillingPortalMapper: {
145
- toEntity: (
146
- dto: MapperDomains['CreateBillingPortalMapper'],
147
- em: EntityManager,
148
- ...args: unknown[]
149
- ) => Promise<MapperEntities['CreateBillingPortalMapper']>;
150
- };
151
- UpdateBillingPortalMapper: {
152
- toEntity: (
153
- dto: MapperDomains['UpdateBillingPortalMapper'],
154
- em: EntityManager,
155
- ...args: unknown[]
156
- ) => Promise<MapperEntities['UpdateBillingPortalMapper']>;
157
- };
56
+ type BillingPortalMappers<MapperEntities extends BaseBillingEntities, MapperDomains extends BaseBillingDtos> = {
57
+ BillingPortalMapper: {
58
+ toDto: (entity: MapperEntities['BillingPortalMapper']) => Promise<MapperDomains['BillingPortalMapper']>;
59
+ };
60
+ CreateBillingPortalMapper: {
61
+ toEntity: (dto: MapperDomains['CreateBillingPortalMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateBillingPortalMapper']>;
62
+ };
63
+ UpdateBillingPortalMapper: {
64
+ toEntity: (dto: MapperDomains['UpdateBillingPortalMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateBillingPortalMapper']>;
65
+ };
158
66
  };
159
67
 
160
- type CheckoutSessionMappers<
161
- PaymentMethodEnum,
162
- CurrencyEnum,
163
- StatusEnum,
164
- MapperEntities extends BaseCheckoutSessionEntities<
165
- PaymentMethodEnum,
166
- CurrencyEnum,
167
- StatusEnum
168
- >,
169
- MapperDomains extends BaseCheckoutSessionDtos<
170
- PaymentMethodEnum,
171
- CurrencyEnum,
172
- StatusEnum
173
- >
174
- > = {
175
- CheckoutSessionMapper: {
176
- toDto: (
177
- entity: MapperEntities['CheckoutSessionMapper']
178
- ) => Promise<MapperDomains['CheckoutSessionMapper']>;
179
- };
180
- CreateCheckoutSessionMapper: {
181
- toEntity: (
182
- dto: MapperDomains['CreateCheckoutSessionMapper'],
183
- em: EntityManager,
184
- ...args: unknown[]
185
- ) => Promise<MapperEntities['CreateCheckoutSessionMapper']>;
186
- };
187
- UpdateCheckoutSessionMapper: {
188
- toEntity: (
189
- dto: MapperDomains['UpdateCheckoutSessionMapper'],
190
- em: EntityManager,
191
- ...args: unknown[]
192
- ) => Promise<MapperEntities['UpdateCheckoutSessionMapper']>;
193
- };
68
+ type CheckoutSessionMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> = {
69
+ CheckoutSessionMapper: {
70
+ toDto: (entity: MapperEntities['CheckoutSessionMapper']) => Promise<MapperDomains['CheckoutSessionMapper']>;
71
+ };
72
+ CreateCheckoutSessionMapper: {
73
+ toEntity: (dto: MapperDomains['CreateCheckoutSessionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateCheckoutSessionMapper']>;
74
+ };
75
+ UpdateCheckoutSessionMapper: {
76
+ toEntity: (dto: MapperDomains['UpdateCheckoutSessionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateCheckoutSessionMapper']>;
77
+ };
194
78
  };
195
79
 
196
- type PaymentLinkMappers<
197
- PaymentMethodEnum,
198
- CurrencyEnum,
199
- StatusEnum,
200
- MapperEntities extends BasePaymentLinkEntities<
201
- PaymentMethodEnum,
202
- CurrencyEnum,
203
- StatusEnum
204
- >,
205
- MapperDomains extends BasePaymentLinkDtos<
206
- PaymentMethodEnum,
207
- CurrencyEnum,
208
- StatusEnum
209
- >
210
- > = {
211
- PaymentLinkMapper: {
212
- toDto: (
213
- entity: MapperEntities['PaymentLinkMapper']
214
- ) => Promise<MapperDomains['PaymentLinkMapper']>;
215
- };
216
- CreatePaymentLinkMapper: {
217
- toEntity: (
218
- dto: MapperDomains['CreatePaymentLinkMapper'],
219
- em: EntityManager,
220
- ...args: unknown[]
221
- ) => Promise<MapperEntities['CreatePaymentLinkMapper']>;
222
- };
223
- UpdatePaymentLinkMapper: {
224
- toEntity: (
225
- dto: MapperDomains['UpdatePaymentLinkMapper'],
226
- em: EntityManager,
227
- ...args: unknown[]
228
- ) => Promise<MapperEntities['UpdatePaymentLinkMapper']>;
229
- };
80
+ type PaymentLinkMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> = {
81
+ PaymentLinkMapper: {
82
+ toDto: (entity: MapperEntities['PaymentLinkMapper']) => Promise<MapperDomains['PaymentLinkMapper']>;
83
+ };
84
+ CreatePaymentLinkMapper: {
85
+ toEntity: (dto: MapperDomains['CreatePaymentLinkMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreatePaymentLinkMapper']>;
86
+ };
87
+ UpdatePaymentLinkMapper: {
88
+ toEntity: (dto: MapperDomains['UpdatePaymentLinkMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdatePaymentLinkMapper']>;
89
+ };
230
90
  };
231
91
 
232
- type PlanMappers<
233
- PlanCadenceEnum,
234
- CurrencyEnum,
235
- BillingProviderEnum,
236
- MapperEntities extends BasePlanEntities<
237
- PlanCadenceEnum,
238
- CurrencyEnum,
239
- BillingProviderEnum
240
- >,
241
- MapperDomains extends BasePlanDtos<
242
- PlanCadenceEnum,
243
- CurrencyEnum,
244
- BillingProviderEnum
245
- >
246
- > = {
247
- PlanMapper: {
248
- toDto: (
249
- entity: MapperEntities['PlanMapper']
250
- ) => Promise<MapperDomains['PlanMapper']>;
251
- };
252
- CreatePlanMapper: {
253
- toEntity: (
254
- dto: MapperDomains['CreatePlanMapper'],
255
- em: EntityManager,
256
- ...args: unknown[]
257
- ) => Promise<MapperEntities['CreatePlanMapper']>;
258
- };
259
- UpdatePlanMapper: {
260
- toEntity: (
261
- dto: MapperDomains['UpdatePlanMapper'],
262
- em: EntityManager,
263
- ...args: unknown[]
264
- ) => Promise<MapperEntities['UpdatePlanMapper']>;
265
- };
92
+ type PlanMappers<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, MapperEntities extends BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, MapperDomains extends BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> = {
93
+ PlanMapper: {
94
+ toDto: (entity: MapperEntities['PlanMapper']) => Promise<MapperDomains['PlanMapper']>;
95
+ };
96
+ CreatePlanMapper: {
97
+ toEntity: (dto: MapperDomains['CreatePlanMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreatePlanMapper']>;
98
+ };
99
+ UpdatePlanMapper: {
100
+ toEntity: (dto: MapperDomains['UpdatePlanMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdatePlanMapper']>;
101
+ };
266
102
  };
267
103
 
268
- type SubscriptionMappers<
269
- PartyType,
270
- BillingProviderType,
271
- MapperEntities extends BaseSubscriptionEntities<
272
- PartyType,
273
- BillingProviderType
274
- >,
275
- MapperDomains extends BaseSubscriptionDtos<PartyType, BillingProviderType>
276
- > = {
277
- SubscriptionMapper: {
278
- toDto: (
279
- entity: MapperEntities['SubscriptionMapper']
280
- ) => Promise<MapperDomains['SubscriptionMapper']>;
281
- };
282
- CreateSubscriptionMapper: {
283
- toEntity: (
284
- dto: MapperDomains['CreateSubscriptionMapper'],
285
- em: EntityManager,
286
- ...args: unknown[]
287
- ) => Promise<MapperEntities['CreateSubscriptionMapper']>;
288
- };
289
- UpdateSubscriptionMapper: {
290
- toEntity: (
291
- dto: MapperDomains['UpdateSubscriptionMapper'],
292
- em: EntityManager,
293
- ...args: unknown[]
294
- ) => Promise<MapperEntities['UpdateSubscriptionMapper']>;
295
- };
104
+ type SubscriptionMappers<PartyType, BillingProviderType, MapperEntities extends BaseSubscriptionEntities<PartyType, BillingProviderType>, MapperDomains extends BaseSubscriptionDtos<PartyType, BillingProviderType>> = {
105
+ SubscriptionMapper: {
106
+ toDto: (entity: MapperEntities['SubscriptionMapper']) => Promise<MapperDomains['SubscriptionMapper']>;
107
+ };
108
+ CreateSubscriptionMapper: {
109
+ toEntity: (dto: MapperDomains['CreateSubscriptionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateSubscriptionMapper']>;
110
+ };
111
+ UpdateSubscriptionMapper: {
112
+ toEntity: (dto: MapperDomains['UpdateSubscriptionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateSubscriptionMapper']>;
113
+ };
296
114
  };
297
115
 
298
- export type {
299
- BaseBillingDtos,
300
- BaseBillingEntities,
301
- BaseCheckoutSessionDtos,
302
- BaseCheckoutSessionEntities,
303
- BasePaymentLinkDtos,
304
- BasePaymentLinkEntities,
305
- BasePlanDtos,
306
- BasePlanEntities,
307
- BaseSubscriptionDtos,
308
- BaseSubscriptionEntities,
309
- BillingPortalMappers,
310
- CheckoutSessionMappers,
311
- PaymentLinkMappers,
312
- PlanMappers,
313
- SubscriptionMappers
314
- };
116
+ export type { BaseBillingDtos, BaseBillingEntities, BaseCheckoutSessionDtos, BaseCheckoutSessionEntities, BasePaymentLinkDtos, BasePaymentLinkEntities, BasePlanDtos, BasePlanEntities, BaseSubscriptionDtos, BaseSubscriptionEntities, BillingPortalMappers, CheckoutSessionMappers, PaymentLinkMappers, PlanMappers, SubscriptionMappers };