@forklaunch/implementation-billing-base 0.6.0 → 0.6.1

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,326 +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
- type BaseBillingDtos$1 = {
21
- BillingPortalMapper: BillingPortalDto;
22
- CreateBillingPortalMapper: CreateBillingPortalDto;
23
- UpdateBillingPortalMapper: UpdateBillingPortalDto;
4
+ type BaseBillingDtos = {
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
- type BaseBillingEntities$1 = {
85
- BillingPortalMapper: BillingPortalDto;
86
- CreateBillingPortalMapper: BillingPortalDto;
87
- UpdateBillingPortalMapper: BillingPortalDto;
30
+ type BaseBillingEntities = {
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>;
133
- };
134
-
135
- type BaseBillingDtos = {
136
- BillingPortalMapper: BillingPortalDto;
137
- CreateBillingPortalMapper: CreateBillingPortalDto;
138
- UpdateBillingPortalMapper: UpdateBillingPortalDto;
51
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
52
+ CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
53
+ UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
139
54
  };
140
55
 
141
- type BaseBillingEntities = {
142
- BillingPortalMapper: BillingPortalDto;
143
- CreateBillingPortalMapper: BillingPortalDto;
144
- UpdateBillingPortalMapper: BillingPortalDto;
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
+ };
145
66
  };
146
67
 
147
- type BillingPortalMappers<
148
- MapperEntities extends BaseBillingEntities,
149
- MapperDomains extends BaseBillingDtos
150
- > = {
151
- BillingPortalMapper: {
152
- toDto: (
153
- entity: MapperEntities['BillingPortalMapper']
154
- ) => Promise<MapperDomains['BillingPortalMapper']>;
155
- };
156
- CreateBillingPortalMapper: {
157
- toEntity: (
158
- dto: MapperDomains['CreateBillingPortalMapper'],
159
- em: EntityManager,
160
- ...args: unknown[]
161
- ) => Promise<MapperEntities['CreateBillingPortalMapper']>;
162
- };
163
- UpdateBillingPortalMapper: {
164
- toEntity: (
165
- dto: MapperDomains['UpdateBillingPortalMapper'],
166
- em: EntityManager,
167
- ...args: unknown[]
168
- ) => Promise<MapperEntities['UpdateBillingPortalMapper']>;
169
- };
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
+ };
170
78
  };
171
79
 
172
- type CheckoutSessionMappers<
173
- PaymentMethodEnum,
174
- CurrencyEnum,
175
- StatusEnum,
176
- MapperEntities extends BaseCheckoutSessionEntities<
177
- PaymentMethodEnum,
178
- CurrencyEnum,
179
- StatusEnum
180
- >,
181
- MapperDomains extends BaseCheckoutSessionDtos<
182
- PaymentMethodEnum,
183
- CurrencyEnum,
184
- StatusEnum
185
- >
186
- > = {
187
- CheckoutSessionMapper: {
188
- toDto: (
189
- entity: MapperEntities['CheckoutSessionMapper']
190
- ) => Promise<MapperDomains['CheckoutSessionMapper']>;
191
- };
192
- CreateCheckoutSessionMapper: {
193
- toEntity: (
194
- dto: MapperDomains['CreateCheckoutSessionMapper'],
195
- em: EntityManager,
196
- ...args: unknown[]
197
- ) => Promise<MapperEntities['CreateCheckoutSessionMapper']>;
198
- };
199
- UpdateCheckoutSessionMapper: {
200
- toEntity: (
201
- dto: MapperDomains['UpdateCheckoutSessionMapper'],
202
- em: EntityManager,
203
- ...args: unknown[]
204
- ) => Promise<MapperEntities['UpdateCheckoutSessionMapper']>;
205
- };
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
+ };
206
90
  };
207
91
 
208
- type PaymentLinkMappers<
209
- PaymentMethodEnum,
210
- CurrencyEnum,
211
- StatusEnum,
212
- MapperEntities extends BasePaymentLinkEntities<
213
- PaymentMethodEnum,
214
- CurrencyEnum,
215
- StatusEnum
216
- >,
217
- MapperDomains extends BasePaymentLinkDtos<
218
- PaymentMethodEnum,
219
- CurrencyEnum,
220
- StatusEnum
221
- >
222
- > = {
223
- PaymentLinkMapper: {
224
- toDto: (
225
- entity: MapperEntities['PaymentLinkMapper']
226
- ) => Promise<MapperDomains['PaymentLinkMapper']>;
227
- };
228
- CreatePaymentLinkMapper: {
229
- toEntity: (
230
- dto: MapperDomains['CreatePaymentLinkMapper'],
231
- em: EntityManager,
232
- ...args: unknown[]
233
- ) => Promise<MapperEntities['CreatePaymentLinkMapper']>;
234
- };
235
- UpdatePaymentLinkMapper: {
236
- toEntity: (
237
- dto: MapperDomains['UpdatePaymentLinkMapper'],
238
- em: EntityManager,
239
- ...args: unknown[]
240
- ) => Promise<MapperEntities['UpdatePaymentLinkMapper']>;
241
- };
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
+ };
242
102
  };
243
103
 
244
- type PlanMappers<
245
- PlanCadenceEnum,
246
- CurrencyEnum,
247
- BillingProviderEnum,
248
- MapperEntities extends BasePlanEntities<
249
- PlanCadenceEnum,
250
- CurrencyEnum,
251
- BillingProviderEnum
252
- >,
253
- MapperDomains extends BasePlanDtos<
254
- PlanCadenceEnum,
255
- CurrencyEnum,
256
- BillingProviderEnum
257
- >
258
- > = {
259
- PlanMapper: {
260
- toDto: (
261
- entity: MapperEntities['PlanMapper']
262
- ) => Promise<MapperDomains['PlanMapper']>;
263
- };
264
- CreatePlanMapper: {
265
- toEntity: (
266
- dto: MapperDomains['CreatePlanMapper'],
267
- em: EntityManager,
268
- ...args: unknown[]
269
- ) => Promise<MapperEntities['CreatePlanMapper']>;
270
- };
271
- UpdatePlanMapper: {
272
- toEntity: (
273
- dto: MapperDomains['UpdatePlanMapper'],
274
- em: EntityManager,
275
- ...args: unknown[]
276
- ) => Promise<MapperEntities['UpdatePlanMapper']>;
277
- };
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
+ };
278
114
  };
279
115
 
280
- type SubscriptionMappers<
281
- PartyType,
282
- BillingProviderType,
283
- MapperEntities extends BaseSubscriptionEntities<
284
- PartyType,
285
- BillingProviderType
286
- >,
287
- MapperDomains extends BaseSubscriptionDtos<PartyType, BillingProviderType>
288
- > = {
289
- SubscriptionMapper: {
290
- toDto: (
291
- entity: MapperEntities['SubscriptionMapper']
292
- ) => Promise<MapperDomains['SubscriptionMapper']>;
293
- };
294
- CreateSubscriptionMapper: {
295
- toEntity: (
296
- dto: MapperDomains['CreateSubscriptionMapper'],
297
- em: EntityManager,
298
- ...args: unknown[]
299
- ) => Promise<MapperEntities['CreateSubscriptionMapper']>;
300
- };
301
- UpdateSubscriptionMapper: {
302
- toEntity: (
303
- dto: MapperDomains['UpdateSubscriptionMapper'],
304
- em: EntityManager,
305
- ...args: unknown[]
306
- ) => Promise<MapperEntities['UpdateSubscriptionMapper']>;
307
- };
308
- };
309
-
310
- export type {
311
- BaseBillingDtos$1 as BaseBillingDtos,
312
- BaseBillingEntities$1 as BaseBillingEntities,
313
- BaseCheckoutSessionDtos,
314
- BaseCheckoutSessionEntities,
315
- BasePaymentLinkDtos,
316
- BasePaymentLinkEntities,
317
- BasePlanDtos,
318
- BasePlanEntities,
319
- BaseSubscriptionDtos,
320
- BaseSubscriptionEntities,
321
- BillingPortalMappers,
322
- CheckoutSessionMappers,
323
- PaymentLinkMappers,
324
- PlanMappers,
325
- SubscriptionMappers
326
- };
116
+ export type { BaseBillingDtos, BaseBillingEntities, BaseCheckoutSessionDtos, BaseCheckoutSessionEntities, BasePaymentLinkDtos, BasePaymentLinkEntities, BasePlanDtos, BasePlanEntities, BaseSubscriptionDtos, BaseSubscriptionEntities, BillingPortalMappers, CheckoutSessionMappers, PaymentLinkMappers, PlanMappers, SubscriptionMappers };