@forklaunch/implementation-billing-base 0.3.2 → 0.3.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.
@@ -1,255 +1,704 @@
1
- import { IdDto, IdsDto } from '@forklaunch/common';
1
+ import { InstanceTypeRecord, IdDto, IdsDto } from '@forklaunch/common';
2
2
  import { TtlCache } from '@forklaunch/core/cache';
3
- import { MetricsDefinition, OpenTelemetryCollector, TelemetryOptions } from '@forklaunch/core/http';
4
- import { ResponseDtoMapperConstructor, RequestDtoMapperConstructor } from '@forklaunch/core/mappers';
5
- import { BillingPortalService, CheckoutSessionService, PaymentLinkService, PlanService, SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
6
- import { BillingPortalDto, CreateBillingPortalDto, UpdateBillingPortalDto, CheckoutSessionDto, CreateCheckoutSessionDto, UpdateCheckoutSessionDto, PaymentLinkDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, PlanDto, CreatePlanDto, UpdatePlanDto, SubscriptionDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
3
+ import {
4
+ OpenTelemetryCollector,
5
+ MetricsDefinition,
6
+ TelemetryOptions
7
+ } from '@forklaunch/core/http';
8
+ import {
9
+ BillingPortalService,
10
+ CheckoutSessionService,
11
+ PaymentLinkService,
12
+ PlanService,
13
+ SubscriptionService
14
+ } from '@forklaunch/interfaces-billing/interfaces';
15
+ import {
16
+ BillingPortalDto,
17
+ CreateBillingPortalDto,
18
+ UpdateBillingPortalDto,
19
+ CheckoutSessionDto,
20
+ CreateCheckoutSessionDto,
21
+ UpdateCheckoutSessionDto,
22
+ PaymentLinkDto,
23
+ CreatePaymentLinkDto,
24
+ UpdatePaymentLinkDto,
25
+ PlanDto,
26
+ CreatePlanDto,
27
+ UpdatePlanDto,
28
+ SubscriptionDto,
29
+ CreateSubscriptionDto,
30
+ UpdateSubscriptionDto
31
+ } from '@forklaunch/interfaces-billing/types';
32
+ import {
33
+ ResponseMapperConstructor,
34
+ RequestMapperConstructor,
35
+ InternalMapper
36
+ } from '@forklaunch/internal';
7
37
  import { AnySchemaValidator } from '@forklaunch/validator';
8
38
  import { EntityManager } from '@mikro-orm/core';
9
39
 
10
- declare class BaseBillingPortalService<SchemaValidator extends AnySchemaValidator, Metrics extends MetricsDefinition = MetricsDefinition, Dto extends {
11
- BillingPortalDtoMapper: BillingPortalDto;
12
- CreateBillingPortalDtoMapper: CreateBillingPortalDto;
13
- UpdateBillingPortalDtoMapper: UpdateBillingPortalDto;
14
- } = {
15
- BillingPortalDtoMapper: BillingPortalDto;
16
- CreateBillingPortalDtoMapper: CreateBillingPortalDto;
17
- UpdateBillingPortalDtoMapper: UpdateBillingPortalDto;
18
- }, Entities extends {
19
- BillingPortalDtoMapper: BillingPortalDto;
20
- CreateBillingPortalDtoMapper: BillingPortalDto;
21
- UpdateBillingPortalDtoMapper: BillingPortalDto;
22
- } = {
23
- BillingPortalDtoMapper: BillingPortalDto;
24
- CreateBillingPortalDtoMapper: BillingPortalDto;
25
- UpdateBillingPortalDtoMapper: BillingPortalDto;
26
- }> implements BillingPortalService {
27
- #private;
28
- protected em: EntityManager;
29
- protected cache: TtlCache;
30
- protected openTelemetryCollector: OpenTelemetryCollector<Metrics>;
31
- protected schemaValidator: SchemaValidator;
32
- protected mappers: {
33
- BillingPortalDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['BillingPortalDtoMapper'], Entities['BillingPortalDtoMapper']>;
34
- CreateBillingPortalDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateBillingPortalDtoMapper'], Entities['CreateBillingPortalDtoMapper']>;
35
- UpdateBillingPortalDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalDtoMapper'], Entities['UpdateBillingPortalDtoMapper']>;
36
- };
37
- readonly options?: {
38
- telemetry?: TelemetryOptions;
39
- enableDatabaseBackup?: boolean;
40
- } | undefined;
41
- private evaluatedTelemetryOptions;
42
- private enableDatabaseBackup;
43
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<Metrics>, schemaValidator: SchemaValidator, mappers: {
44
- BillingPortalDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['BillingPortalDtoMapper'], Entities['BillingPortalDtoMapper']>;
45
- CreateBillingPortalDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateBillingPortalDtoMapper'], Entities['CreateBillingPortalDtoMapper']>;
46
- UpdateBillingPortalDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalDtoMapper'], Entities['UpdateBillingPortalDtoMapper']>;
47
- }, options?: {
40
+ type BaseBillingDtos = {
41
+ BillingPortalMapper: BillingPortalDto;
42
+ CreateBillingPortalMapper: CreateBillingPortalDto;
43
+ UpdateBillingPortalMapper: UpdateBillingPortalDto;
44
+ };
45
+ type BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
46
+ CheckoutSessionMapper: CheckoutSessionDto<
47
+ PaymentMethodEnum,
48
+ CurrencyEnum,
49
+ StatusEnum
50
+ >;
51
+ CreateCheckoutSessionMapper: CreateCheckoutSessionDto<
52
+ PaymentMethodEnum,
53
+ CurrencyEnum,
54
+ StatusEnum
55
+ >;
56
+ UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<
57
+ PaymentMethodEnum,
58
+ CurrencyEnum,
59
+ StatusEnum
60
+ >;
61
+ };
62
+ type BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
63
+ PaymentLinkMapper: PaymentLinkDto<
64
+ PaymentMethodEnum,
65
+ CurrencyEnum,
66
+ StatusEnum
67
+ >;
68
+ CreatePaymentLinkMapper: CreatePaymentLinkDto<
69
+ PaymentMethodEnum,
70
+ CurrencyEnum,
71
+ StatusEnum
72
+ >;
73
+ UpdatePaymentLinkMapper: UpdatePaymentLinkDto<
74
+ PaymentMethodEnum,
75
+ CurrencyEnum,
76
+ StatusEnum
77
+ >;
78
+ };
79
+ type BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
80
+ PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
81
+ CreatePlanMapper: CreatePlanDto<
82
+ PlanCadenceEnum,
83
+ CurrencyEnum,
84
+ BillingProviderEnum
85
+ >;
86
+ UpdatePlanMapper: UpdatePlanDto<
87
+ PlanCadenceEnum,
88
+ CurrencyEnum,
89
+ BillingProviderEnum
90
+ >;
91
+ };
92
+ type BaseSubscriptionDtos<PartyType, BillingProviderType> = {
93
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
94
+ CreateSubscriptionMapper: CreateSubscriptionDto<
95
+ PartyType,
96
+ BillingProviderType
97
+ >;
98
+ UpdateSubscriptionMapper: UpdateSubscriptionDto<
99
+ PartyType,
100
+ BillingProviderType
101
+ >;
102
+ };
103
+
104
+ type BaseBillingEntities = {
105
+ BillingPortalMapper: BillingPortalDto;
106
+ CreateBillingPortalMapper: BillingPortalDto;
107
+ UpdateBillingPortalMapper: BillingPortalDto;
108
+ };
109
+ type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
110
+ {
111
+ CheckoutSessionMapper: CheckoutSessionDto<
112
+ PaymentMethodEnum,
113
+ CurrencyEnum,
114
+ StatusEnum
115
+ >;
116
+ CreateCheckoutSessionMapper: CheckoutSessionDto<
117
+ PaymentMethodEnum,
118
+ CurrencyEnum,
119
+ StatusEnum
120
+ >;
121
+ UpdateCheckoutSessionMapper: CheckoutSessionDto<
122
+ PaymentMethodEnum,
123
+ CurrencyEnum,
124
+ StatusEnum
125
+ >;
126
+ };
127
+ type BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
128
+ PaymentLinkMapper: PaymentLinkDto<
129
+ PaymentMethodEnum,
130
+ CurrencyEnum,
131
+ StatusEnum
132
+ >;
133
+ CreatePaymentLinkMapper: PaymentLinkDto<
134
+ PaymentMethodEnum,
135
+ CurrencyEnum,
136
+ StatusEnum
137
+ >;
138
+ UpdatePaymentLinkMapper: PaymentLinkDto<
139
+ PaymentMethodEnum,
140
+ CurrencyEnum,
141
+ StatusEnum
142
+ >;
143
+ };
144
+ type BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
145
+ PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
146
+ CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
147
+ UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
148
+ };
149
+ type BaseSubscriptionEntities<PartyType, BillingProviderType> = {
150
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
151
+ CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
152
+ UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
153
+ };
154
+
155
+ declare class BaseBillingPortalService<
156
+ SchemaValidator extends AnySchemaValidator,
157
+ Entities extends BaseBillingEntities,
158
+ Dto extends BaseBillingDtos = BaseBillingDtos
159
+ > implements BillingPortalService
160
+ {
161
+ protected em: EntityManager;
162
+ protected cache: TtlCache;
163
+ protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
164
+ protected schemaValidator: SchemaValidator;
165
+ protected mappers: {
166
+ BillingPortalMapper: ResponseMapperConstructor<
167
+ SchemaValidator,
168
+ Dto['BillingPortalMapper'],
169
+ Entities['BillingPortalMapper']
170
+ >;
171
+ CreateBillingPortalMapper: RequestMapperConstructor<
172
+ SchemaValidator,
173
+ Dto['CreateBillingPortalMapper'],
174
+ Entities['CreateBillingPortalMapper'],
175
+ (
176
+ dto: Dto['CreateBillingPortalMapper'],
177
+ em: EntityManager
178
+ ) => Promise<Entities['CreateBillingPortalMapper']>
179
+ >;
180
+ UpdateBillingPortalMapper: RequestMapperConstructor<
181
+ SchemaValidator,
182
+ Dto['UpdateBillingPortalMapper'],
183
+ Entities['UpdateBillingPortalMapper'],
184
+ (
185
+ dto: Dto['UpdateBillingPortalMapper'],
186
+ em: EntityManager
187
+ ) => Promise<Entities['UpdateBillingPortalMapper']>
188
+ >;
189
+ };
190
+ readonly options?:
191
+ | {
48
192
  telemetry?: TelemetryOptions;
49
193
  enableDatabaseBackup?: boolean;
50
- } | undefined);
51
- protected createCacheKey: (id: string) => string;
52
- createBillingPortalSession(billingPortalDto: Dto['CreateBillingPortalDtoMapper']): Promise<Dto['BillingPortalDtoMapper']>;
53
- getBillingPortalSession(idDto: IdDto): Promise<Dto['BillingPortalDtoMapper']>;
54
- updateBillingPortalSession(billingPortalDto: UpdateBillingPortalDto): Promise<Dto['BillingPortalDtoMapper']>;
55
- expireBillingPortalSession(idDto: IdDto): Promise<void>;
194
+ }
195
+ | undefined;
196
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
197
+ protected evaluatedTelemetryOptions: {
198
+ logging?: boolean;
199
+ metrics?: boolean;
200
+ tracing?: boolean;
201
+ };
202
+ protected enableDatabaseBackup: boolean;
203
+ constructor(
204
+ em: EntityManager,
205
+ cache: TtlCache,
206
+ openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
207
+ schemaValidator: SchemaValidator,
208
+ mappers: {
209
+ BillingPortalMapper: ResponseMapperConstructor<
210
+ SchemaValidator,
211
+ Dto['BillingPortalMapper'],
212
+ Entities['BillingPortalMapper']
213
+ >;
214
+ CreateBillingPortalMapper: RequestMapperConstructor<
215
+ SchemaValidator,
216
+ Dto['CreateBillingPortalMapper'],
217
+ Entities['CreateBillingPortalMapper'],
218
+ (
219
+ dto: Dto['CreateBillingPortalMapper'],
220
+ em: EntityManager
221
+ ) => Promise<Entities['CreateBillingPortalMapper']>
222
+ >;
223
+ UpdateBillingPortalMapper: RequestMapperConstructor<
224
+ SchemaValidator,
225
+ Dto['UpdateBillingPortalMapper'],
226
+ Entities['UpdateBillingPortalMapper'],
227
+ (
228
+ dto: Dto['UpdateBillingPortalMapper'],
229
+ em: EntityManager
230
+ ) => Promise<Entities['UpdateBillingPortalMapper']>
231
+ >;
232
+ },
233
+ options?:
234
+ | {
235
+ telemetry?: TelemetryOptions;
236
+ enableDatabaseBackup?: boolean;
237
+ }
238
+ | undefined
239
+ );
240
+ protected createCacheKey: (id: string) => string;
241
+ createBillingPortalSession(
242
+ billingPortalDto: Dto['CreateBillingPortalMapper']
243
+ ): Promise<Dto['BillingPortalMapper']>;
244
+ getBillingPortalSession(idDto: IdDto): Promise<Dto['BillingPortalMapper']>;
245
+ updateBillingPortalSession(
246
+ billingPortalDto: UpdateBillingPortalDto
247
+ ): Promise<Dto['BillingPortalMapper']>;
248
+ expireBillingPortalSession(idDto: IdDto): Promise<void>;
56
249
  }
57
250
 
58
- declare class BaseCheckoutSessionService<SchemaValidator extends AnySchemaValidator, PaymentMethodEnum, StatusEnum, Metrics extends MetricsDefinition = MetricsDefinition, Dto extends {
59
- CheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
60
- CreateCheckoutSessionDtoMapper: CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
61
- UpdateCheckoutSessionDtoMapper: UpdateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
62
- } = {
63
- CheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
64
- CreateCheckoutSessionDtoMapper: CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
65
- UpdateCheckoutSessionDtoMapper: UpdateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
66
- }, Entities extends {
67
- CheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
68
- CreateCheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
69
- UpdateCheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
70
- } = {
71
- CheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
72
- CreateCheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
73
- UpdateCheckoutSessionDtoMapper: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
74
- }> implements CheckoutSessionService<PaymentMethodEnum, StatusEnum> {
75
- #private;
76
- protected readonly em: EntityManager;
77
- protected readonly cache: TtlCache;
78
- protected readonly openTelemetryCollector: OpenTelemetryCollector<Metrics>;
79
- protected readonly schemaValidator: SchemaValidator;
80
- protected readonly mappers: {
81
- CheckoutSessionDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['CheckoutSessionDtoMapper'], Entities['CheckoutSessionDtoMapper']>;
82
- CreateCheckoutSessionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionDtoMapper'], Entities['CreateCheckoutSessionDtoMapper']>;
83
- UpdateCheckoutSessionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionDtoMapper'], Entities['UpdateCheckoutSessionDtoMapper']>;
84
- };
85
- readonly options?: {
86
- enableDatabaseBackup?: boolean;
87
- telemetry?: TelemetryOptions;
88
- } | undefined;
89
- private evaluatedTelemetryOptions;
90
- private enableDatabaseBackup;
91
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<Metrics>, schemaValidator: SchemaValidator, mappers: {
92
- CheckoutSessionDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['CheckoutSessionDtoMapper'], Entities['CheckoutSessionDtoMapper']>;
93
- CreateCheckoutSessionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionDtoMapper'], Entities['CreateCheckoutSessionDtoMapper']>;
94
- UpdateCheckoutSessionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionDtoMapper'], Entities['UpdateCheckoutSessionDtoMapper']>;
95
- }, options?: {
251
+ declare class BaseCheckoutSessionService<
252
+ SchemaValidator extends AnySchemaValidator,
253
+ PaymentMethodEnum,
254
+ CurrencyEnum,
255
+ StatusEnum,
256
+ Entities extends BaseCheckoutSessionEntities<
257
+ PaymentMethodEnum,
258
+ CurrencyEnum,
259
+ StatusEnum
260
+ >,
261
+ Dto extends BaseCheckoutSessionDtos<
262
+ PaymentMethodEnum,
263
+ CurrencyEnum,
264
+ StatusEnum
265
+ > = BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>
266
+ > implements CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum>
267
+ {
268
+ protected readonly em: EntityManager;
269
+ protected readonly cache: TtlCache;
270
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
271
+ protected readonly schemaValidator: SchemaValidator;
272
+ protected readonly mappers: {
273
+ CheckoutSessionMapper: ResponseMapperConstructor<
274
+ SchemaValidator,
275
+ Dto['CheckoutSessionMapper'],
276
+ Entities['CheckoutSessionMapper']
277
+ >;
278
+ CreateCheckoutSessionMapper: RequestMapperConstructor<
279
+ SchemaValidator,
280
+ Dto['CreateCheckoutSessionMapper'],
281
+ Entities['CreateCheckoutSessionMapper'],
282
+ (
283
+ dto: Dto['CreateCheckoutSessionMapper'],
284
+ em: EntityManager
285
+ ) => Promise<Entities['CreateCheckoutSessionMapper']>
286
+ >;
287
+ UpdateCheckoutSessionMapper: RequestMapperConstructor<
288
+ SchemaValidator,
289
+ Dto['UpdateCheckoutSessionMapper'],
290
+ Entities['UpdateCheckoutSessionMapper'],
291
+ (
292
+ dto: Dto['UpdateCheckoutSessionMapper'],
293
+ em: EntityManager
294
+ ) => Promise<Entities['UpdateCheckoutSessionMapper']>
295
+ >;
296
+ };
297
+ readonly options?:
298
+ | {
96
299
  enableDatabaseBackup?: boolean;
97
300
  telemetry?: TelemetryOptions;
98
- } | undefined);
99
- protected createCacheKey: (id: string) => string;
100
- createCheckoutSession(checkoutSessionDto: Dto['CreateCheckoutSessionDtoMapper']): Promise<Dto['CheckoutSessionDtoMapper']>;
101
- getCheckoutSession({ id }: IdDto): Promise<Dto['CheckoutSessionDtoMapper']>;
102
- expireCheckoutSession({ id }: IdDto): Promise<void>;
103
- handleCheckoutSuccess({ id }: IdDto): Promise<void>;
104
- handleCheckoutFailure({ id }: IdDto): Promise<void>;
301
+ }
302
+ | undefined;
303
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
304
+ protected evaluatedTelemetryOptions: {
305
+ logging?: boolean;
306
+ metrics?: boolean;
307
+ tracing?: boolean;
308
+ };
309
+ protected enableDatabaseBackup: boolean;
310
+ constructor(
311
+ em: EntityManager,
312
+ cache: TtlCache,
313
+ openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
314
+ schemaValidator: SchemaValidator,
315
+ mappers: {
316
+ CheckoutSessionMapper: ResponseMapperConstructor<
317
+ SchemaValidator,
318
+ Dto['CheckoutSessionMapper'],
319
+ Entities['CheckoutSessionMapper']
320
+ >;
321
+ CreateCheckoutSessionMapper: RequestMapperConstructor<
322
+ SchemaValidator,
323
+ Dto['CreateCheckoutSessionMapper'],
324
+ Entities['CreateCheckoutSessionMapper'],
325
+ (
326
+ dto: Dto['CreateCheckoutSessionMapper'],
327
+ em: EntityManager
328
+ ) => Promise<Entities['CreateCheckoutSessionMapper']>
329
+ >;
330
+ UpdateCheckoutSessionMapper: RequestMapperConstructor<
331
+ SchemaValidator,
332
+ Dto['UpdateCheckoutSessionMapper'],
333
+ Entities['UpdateCheckoutSessionMapper'],
334
+ (
335
+ dto: Dto['UpdateCheckoutSessionMapper'],
336
+ em: EntityManager
337
+ ) => Promise<Entities['UpdateCheckoutSessionMapper']>
338
+ >;
339
+ },
340
+ options?:
341
+ | {
342
+ enableDatabaseBackup?: boolean;
343
+ telemetry?: TelemetryOptions;
344
+ }
345
+ | undefined
346
+ );
347
+ protected createCacheKey: (id: string) => string;
348
+ createCheckoutSession(
349
+ checkoutSessionDto: Dto['CreateCheckoutSessionMapper']
350
+ ): Promise<Dto['CheckoutSessionMapper']>;
351
+ getCheckoutSession({ id }: IdDto): Promise<Dto['CheckoutSessionMapper']>;
352
+ expireCheckoutSession({ id }: IdDto): Promise<void>;
353
+ handleCheckoutSuccess({ id }: IdDto): Promise<void>;
354
+ handleCheckoutFailure({ id }: IdDto): Promise<void>;
105
355
  }
106
356
 
107
- declare class BasePaymentLinkService<SchemaValidator extends AnySchemaValidator, CurrencyEnum, StatusEnum, Metrics extends MetricsDefinition = MetricsDefinition, Dto extends {
108
- PaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
109
- CreatePaymentLinkDtoMapper: CreatePaymentLinkDto<CurrencyEnum, StatusEnum>;
110
- UpdatePaymentLinkDtoMapper: UpdatePaymentLinkDto<CurrencyEnum, StatusEnum>;
111
- } = {
112
- PaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
113
- CreatePaymentLinkDtoMapper: CreatePaymentLinkDto<CurrencyEnum, StatusEnum>;
114
- UpdatePaymentLinkDtoMapper: UpdatePaymentLinkDto<CurrencyEnum, StatusEnum>;
115
- }, Entities extends {
116
- PaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
117
- CreatePaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
118
- UpdatePaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
119
- } = {
120
- PaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
121
- CreatePaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
122
- UpdatePaymentLinkDtoMapper: PaymentLinkDto<CurrencyEnum, StatusEnum>;
123
- }> implements PaymentLinkService<CurrencyEnum, StatusEnum> {
124
- #private;
125
- protected readonly em: EntityManager;
126
- protected readonly cache: TtlCache;
127
- protected readonly openTelemetryCollector: OpenTelemetryCollector<Metrics>;
128
- protected readonly schemaValidator: SchemaValidator;
129
- protected readonly mappers: {
130
- PaymentLinkDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['PaymentLinkDtoMapper'], Entities['PaymentLinkDtoMapper']>;
131
- CreatePaymentLinkDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkDtoMapper'], Entities['CreatePaymentLinkDtoMapper']>;
132
- UpdatePaymentLinkDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkDtoMapper'], Entities['UpdatePaymentLinkDtoMapper']>;
133
- };
134
- readonly options?: {
357
+ declare class BasePaymentLinkService<
358
+ SchemaValidator extends AnySchemaValidator,
359
+ PaymentMethodEnum,
360
+ CurrencyEnum,
361
+ StatusEnum,
362
+ Entities extends BasePaymentLinkEntities<
363
+ PaymentMethodEnum,
364
+ CurrencyEnum,
365
+ StatusEnum
366
+ >,
367
+ Dto extends BasePaymentLinkDtos<
368
+ PaymentMethodEnum,
369
+ CurrencyEnum,
370
+ StatusEnum
371
+ > = BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>
372
+ > implements PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum>
373
+ {
374
+ protected readonly em: EntityManager;
375
+ protected readonly cache: TtlCache;
376
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
377
+ protected readonly schemaValidator: SchemaValidator;
378
+ protected readonly mappers: {
379
+ PaymentLinkMapper: ResponseMapperConstructor<
380
+ SchemaValidator,
381
+ Dto['PaymentLinkMapper'],
382
+ Entities['PaymentLinkMapper']
383
+ >;
384
+ CreatePaymentLinkMapper: RequestMapperConstructor<
385
+ SchemaValidator,
386
+ Dto['CreatePaymentLinkMapper'],
387
+ Entities['CreatePaymentLinkMapper'],
388
+ (
389
+ dto: Dto['CreatePaymentLinkMapper'],
390
+ em: EntityManager
391
+ ) => Promise<Entities['CreatePaymentLinkMapper']>
392
+ >;
393
+ UpdatePaymentLinkMapper: RequestMapperConstructor<
394
+ SchemaValidator,
395
+ Dto['UpdatePaymentLinkMapper'],
396
+ Entities['UpdatePaymentLinkMapper'],
397
+ (
398
+ dto: Dto['UpdatePaymentLinkMapper'],
399
+ em: EntityManager
400
+ ) => Promise<Entities['UpdatePaymentLinkMapper']>
401
+ >;
402
+ };
403
+ readonly options?:
404
+ | {
135
405
  enableDatabaseBackup?: boolean;
136
406
  telemetry?: TelemetryOptions;
137
- } | undefined;
138
- private evaluatedTelemetryOptions;
139
- private enableDatabaseBackup;
140
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<Metrics>, schemaValidator: SchemaValidator, mappers: {
141
- PaymentLinkDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['PaymentLinkDtoMapper'], Entities['PaymentLinkDtoMapper']>;
142
- CreatePaymentLinkDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkDtoMapper'], Entities['CreatePaymentLinkDtoMapper']>;
143
- UpdatePaymentLinkDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkDtoMapper'], Entities['UpdatePaymentLinkDtoMapper']>;
144
- }, options?: {
145
- enableDatabaseBackup?: boolean;
146
- telemetry?: TelemetryOptions;
147
- } | undefined);
148
- protected cacheKeyPrefix: string;
149
- protected createCacheKey: (id: string) => string;
150
- createPaymentLink(paymentLinkDto: Dto['CreatePaymentLinkDtoMapper']): Promise<Dto['PaymentLinkDtoMapper']>;
151
- updatePaymentLink(paymentLinkDto: Dto['UpdatePaymentLinkDtoMapper']): Promise<Dto['PaymentLinkDtoMapper']>;
152
- getPaymentLink({ id }: IdDto): Promise<Dto['PaymentLinkDtoMapper']>;
153
- expirePaymentLink({ id }: IdDto): Promise<void>;
154
- handlePaymentSuccess({ id }: IdDto): Promise<void>;
155
- handlePaymentFailure({ id }: IdDto): Promise<void>;
156
- listPaymentLinks(idsDto?: IdsDto): Promise<Dto['PaymentLinkDtoMapper'][]>;
407
+ }
408
+ | undefined;
409
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
410
+ protected evaluatedTelemetryOptions: {
411
+ logging?: boolean;
412
+ metrics?: boolean;
413
+ tracing?: boolean;
414
+ };
415
+ protected enableDatabaseBackup: boolean;
416
+ constructor(
417
+ em: EntityManager,
418
+ cache: TtlCache,
419
+ openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
420
+ schemaValidator: SchemaValidator,
421
+ mappers: {
422
+ PaymentLinkMapper: ResponseMapperConstructor<
423
+ SchemaValidator,
424
+ Dto['PaymentLinkMapper'],
425
+ Entities['PaymentLinkMapper']
426
+ >;
427
+ CreatePaymentLinkMapper: RequestMapperConstructor<
428
+ SchemaValidator,
429
+ Dto['CreatePaymentLinkMapper'],
430
+ Entities['CreatePaymentLinkMapper'],
431
+ (
432
+ dto: Dto['CreatePaymentLinkMapper'],
433
+ em: EntityManager
434
+ ) => Promise<Entities['CreatePaymentLinkMapper']>
435
+ >;
436
+ UpdatePaymentLinkMapper: RequestMapperConstructor<
437
+ SchemaValidator,
438
+ Dto['UpdatePaymentLinkMapper'],
439
+ Entities['UpdatePaymentLinkMapper'],
440
+ (
441
+ dto: Dto['UpdatePaymentLinkMapper'],
442
+ em: EntityManager
443
+ ) => Promise<Entities['UpdatePaymentLinkMapper']>
444
+ >;
445
+ },
446
+ options?:
447
+ | {
448
+ enableDatabaseBackup?: boolean;
449
+ telemetry?: TelemetryOptions;
450
+ }
451
+ | undefined
452
+ );
453
+ protected cacheKeyPrefix: string;
454
+ protected createCacheKey: (id: string) => string;
455
+ createPaymentLink(
456
+ paymentLinkDto: Dto['CreatePaymentLinkMapper']
457
+ ): Promise<Dto['PaymentLinkMapper']>;
458
+ updatePaymentLink(
459
+ paymentLinkDto: Dto['UpdatePaymentLinkMapper']
460
+ ): Promise<Dto['PaymentLinkMapper']>;
461
+ getPaymentLink({ id }: IdDto): Promise<Dto['PaymentLinkMapper']>;
462
+ expirePaymentLink({ id }: IdDto): Promise<void>;
463
+ handlePaymentSuccess({ id }: IdDto): Promise<void>;
464
+ handlePaymentFailure({ id }: IdDto): Promise<void>;
465
+ listPaymentLinks(idsDto?: IdsDto): Promise<Dto['PaymentLinkMapper'][]>;
157
466
  }
158
467
 
159
- declare class BasePlanService<SchemaValidator extends AnySchemaValidator, PlanCadenceEnum, BillingProviderEnum, Metrics extends MetricsDefinition = MetricsDefinition, Dto extends {
160
- PlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
161
- CreatePlanDtoMapper: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
162
- UpdatePlanDtoMapper: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
163
- } = {
164
- PlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
165
- CreatePlanDtoMapper: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
166
- UpdatePlanDtoMapper: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
167
- }, Entities extends {
168
- PlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
169
- CreatePlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
170
- UpdatePlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
171
- } = {
172
- PlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
173
- CreatePlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
174
- UpdatePlanDtoMapper: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
175
- }> implements PlanService<PlanCadenceEnum, BillingProviderEnum> {
176
- #private;
177
- private em;
178
- private readonly openTelemetryCollector;
179
- private readonly schemaValidator;
180
- private readonly mappers;
181
- readonly options?: {
182
- telemetry?: TelemetryOptions;
183
- } | undefined;
184
- private evaluatedTelemetryOptions;
185
- constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<Metrics>, schemaValidator: SchemaValidator, mappers: {
186
- PlanDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['PlanDtoMapper'], Entities['PlanDtoMapper']>;
187
- CreatePlanDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreatePlanDtoMapper'], Entities['CreatePlanDtoMapper']>;
188
- UpdatePlanDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdatePlanDtoMapper'], Entities['UpdatePlanDtoMapper']>;
189
- }, options?: {
468
+ declare class BasePlanService<
469
+ SchemaValidator extends AnySchemaValidator,
470
+ PlanCadenceEnum,
471
+ CurrencyEnum,
472
+ BillingProviderEnum,
473
+ Entities extends BasePlanEntities<
474
+ PlanCadenceEnum,
475
+ CurrencyEnum,
476
+ BillingProviderEnum
477
+ >,
478
+ Dto extends BasePlanDtos<
479
+ PlanCadenceEnum,
480
+ CurrencyEnum,
481
+ BillingProviderEnum
482
+ > = BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
483
+ > implements PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
484
+ {
485
+ protected em: EntityManager;
486
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
487
+ protected readonly schemaValidator: SchemaValidator;
488
+ protected readonly mappers: {
489
+ PlanMapper: ResponseMapperConstructor<
490
+ SchemaValidator,
491
+ Dto['PlanMapper'],
492
+ Entities['PlanMapper']
493
+ >;
494
+ CreatePlanMapper: RequestMapperConstructor<
495
+ SchemaValidator,
496
+ Dto['CreatePlanMapper'],
497
+ Entities['CreatePlanMapper'],
498
+ (
499
+ dto: Dto['CreatePlanMapper'],
500
+ em: EntityManager
501
+ ) => Promise<Entities['CreatePlanMapper']>
502
+ >;
503
+ UpdatePlanMapper: RequestMapperConstructor<
504
+ SchemaValidator,
505
+ Dto['UpdatePlanMapper'],
506
+ Entities['UpdatePlanMapper'],
507
+ (
508
+ dto: Dto['UpdatePlanMapper'],
509
+ em: EntityManager
510
+ ) => Promise<Entities['UpdatePlanMapper']>
511
+ >;
512
+ };
513
+ readonly options?:
514
+ | {
190
515
  telemetry?: TelemetryOptions;
191
- } | undefined);
192
- listPlans(idsDto?: IdsDto, em?: EntityManager): Promise<Dto['PlanDtoMapper'][]>;
193
- createPlan(planDto: Dto['CreatePlanDtoMapper'], em?: EntityManager): Promise<Dto['PlanDtoMapper']>;
194
- getPlan(idDto: IdDto, em?: EntityManager): Promise<Dto['PlanDtoMapper']>;
195
- updatePlan(planDto: Dto['UpdatePlanDtoMapper'], em?: EntityManager): Promise<Dto['PlanDtoMapper']>;
196
- deletePlan(idDto: {
197
- id: string;
198
- }, em?: EntityManager): Promise<void>;
516
+ }
517
+ | undefined;
518
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
519
+ protected evaluatedTelemetryOptions: {
520
+ logging?: boolean;
521
+ metrics?: boolean;
522
+ tracing?: boolean;
523
+ };
524
+ constructor(
525
+ em: EntityManager,
526
+ openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
527
+ schemaValidator: SchemaValidator,
528
+ mappers: {
529
+ PlanMapper: ResponseMapperConstructor<
530
+ SchemaValidator,
531
+ Dto['PlanMapper'],
532
+ Entities['PlanMapper']
533
+ >;
534
+ CreatePlanMapper: RequestMapperConstructor<
535
+ SchemaValidator,
536
+ Dto['CreatePlanMapper'],
537
+ Entities['CreatePlanMapper'],
538
+ (
539
+ dto: Dto['CreatePlanMapper'],
540
+ em: EntityManager
541
+ ) => Promise<Entities['CreatePlanMapper']>
542
+ >;
543
+ UpdatePlanMapper: RequestMapperConstructor<
544
+ SchemaValidator,
545
+ Dto['UpdatePlanMapper'],
546
+ Entities['UpdatePlanMapper'],
547
+ (
548
+ dto: Dto['UpdatePlanMapper'],
549
+ em: EntityManager
550
+ ) => Promise<Entities['UpdatePlanMapper']>
551
+ >;
552
+ },
553
+ options?:
554
+ | {
555
+ telemetry?: TelemetryOptions;
556
+ }
557
+ | undefined
558
+ );
559
+ listPlans(idsDto?: IdsDto, em?: EntityManager): Promise<Dto['PlanMapper'][]>;
560
+ createPlan(
561
+ planDto: Dto['CreatePlanMapper'],
562
+ em?: EntityManager
563
+ ): Promise<Dto['PlanMapper']>;
564
+ getPlan(idDto: IdDto, em?: EntityManager): Promise<Dto['PlanMapper']>;
565
+ updatePlan(
566
+ planDto: Dto['UpdatePlanMapper'],
567
+ em?: EntityManager
568
+ ): Promise<Dto['PlanMapper']>;
569
+ deletePlan(
570
+ idDto: {
571
+ id: string;
572
+ },
573
+ em?: EntityManager
574
+ ): Promise<void>;
199
575
  }
200
576
 
201
- declare class BaseSubscriptionService<SchemaValidator extends AnySchemaValidator, PartyType, BillingProviderType, Metrics extends MetricsDefinition = MetricsDefinition, Dto extends {
202
- SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
203
- CreateSubscriptionDtoMapper: CreateSubscriptionDto<PartyType, BillingProviderType>;
204
- UpdateSubscriptionDtoMapper: UpdateSubscriptionDto<PartyType, BillingProviderType>;
205
- } = {
206
- SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
207
- CreateSubscriptionDtoMapper: CreateSubscriptionDto<PartyType, BillingProviderType>;
208
- UpdateSubscriptionDtoMapper: UpdateSubscriptionDto<PartyType, BillingProviderType>;
209
- }, Entities extends {
210
- SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
211
- CreateSubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
212
- UpdateSubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
213
- } = {
214
- SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
215
- CreateSubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
216
- UpdateSubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
217
- }> implements SubscriptionService<PartyType, BillingProviderType> {
218
- #private;
219
- protected em: EntityManager;
220
- protected readonly openTelemetryCollector: OpenTelemetryCollector<Metrics>;
221
- protected readonly schemaValidator: SchemaValidator;
222
- protected readonly mappers: {
223
- SubscriptionDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['SubscriptionDtoMapper'], Entities['SubscriptionDtoMapper']>;
224
- CreateSubscriptionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateSubscriptionDtoMapper'], Entities['CreateSubscriptionDtoMapper']>;
225
- UpdateSubscriptionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionDtoMapper'], Entities['UpdateSubscriptionDtoMapper']>;
226
- };
227
- readonly options?: {
228
- enableDatabaseBackup?: boolean;
229
- telemetry?: TelemetryOptions;
230
- } | undefined;
231
- private evaluatedTelemetryOptions;
232
- constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<Metrics>, schemaValidator: SchemaValidator, mappers: {
233
- SubscriptionDtoMapper: ResponseDtoMapperConstructor<SchemaValidator, Dto['SubscriptionDtoMapper'], Entities['SubscriptionDtoMapper']>;
234
- CreateSubscriptionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['CreateSubscriptionDtoMapper'], Entities['CreateSubscriptionDtoMapper']>;
235
- UpdateSubscriptionDtoMapper: RequestDtoMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionDtoMapper'], Entities['UpdateSubscriptionDtoMapper']>;
236
- }, options?: {
237
- enableDatabaseBackup?: boolean;
577
+ declare class BaseSubscriptionService<
578
+ SchemaValidator extends AnySchemaValidator,
579
+ PartyType,
580
+ BillingProviderType,
581
+ Entities extends BaseSubscriptionEntities<PartyType, BillingProviderType>,
582
+ Dto extends BaseSubscriptionDtos<
583
+ PartyType,
584
+ BillingProviderType
585
+ > = BaseSubscriptionDtos<PartyType, BillingProviderType>
586
+ > implements SubscriptionService<PartyType, BillingProviderType>
587
+ {
588
+ protected em: EntityManager;
589
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
590
+ protected readonly schemaValidator: SchemaValidator;
591
+ protected readonly mappers: {
592
+ SubscriptionMapper: ResponseMapperConstructor<
593
+ SchemaValidator,
594
+ Dto['SubscriptionMapper'],
595
+ Entities['SubscriptionMapper']
596
+ >;
597
+ CreateSubscriptionMapper: RequestMapperConstructor<
598
+ SchemaValidator,
599
+ Dto['CreateSubscriptionMapper'],
600
+ Entities['CreateSubscriptionMapper'],
601
+ (
602
+ dto: Dto['CreateSubscriptionMapper'],
603
+ em: EntityManager
604
+ ) => Promise<Entities['CreateSubscriptionMapper']>
605
+ >;
606
+ UpdateSubscriptionMapper: RequestMapperConstructor<
607
+ SchemaValidator,
608
+ Dto['UpdateSubscriptionMapper'],
609
+ Entities['UpdateSubscriptionMapper'],
610
+ (
611
+ dto: Dto['UpdateSubscriptionMapper'],
612
+ em: EntityManager
613
+ ) => Promise<Entities['UpdateSubscriptionMapper']>
614
+ >;
615
+ };
616
+ readonly options?:
617
+ | {
238
618
  telemetry?: TelemetryOptions;
239
- } | undefined);
240
- createSubscription(subscriptionDto: Dto['CreateSubscriptionDtoMapper'], em?: EntityManager): Promise<Dto['SubscriptionDtoMapper']>;
241
- getSubscription(idDto: IdDto, em?: EntityManager): Promise<Dto['SubscriptionDtoMapper']>;
242
- getUserSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionDtoMapper']>;
243
- getOrganizationSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionDtoMapper']>;
244
- updateSubscription(subscriptionDto: Dto['UpdateSubscriptionDtoMapper'], em?: EntityManager): Promise<Dto['SubscriptionDtoMapper']>;
245
- deleteSubscription(idDto: {
246
- id: string;
247
- }, em?: EntityManager): Promise<void>;
248
- listSubscriptions(idsDto: {
249
- ids?: string[];
250
- }, em?: EntityManager): Promise<Dto['SubscriptionDtoMapper'][]>;
251
- cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
252
- resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
619
+ }
620
+ | undefined;
621
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
622
+ protected evaluatedTelemetryOptions: {
623
+ logging?: boolean;
624
+ metrics?: boolean;
625
+ tracing?: boolean;
626
+ };
627
+ constructor(
628
+ em: EntityManager,
629
+ openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
630
+ schemaValidator: SchemaValidator,
631
+ mappers: {
632
+ SubscriptionMapper: ResponseMapperConstructor<
633
+ SchemaValidator,
634
+ Dto['SubscriptionMapper'],
635
+ Entities['SubscriptionMapper']
636
+ >;
637
+ CreateSubscriptionMapper: RequestMapperConstructor<
638
+ SchemaValidator,
639
+ Dto['CreateSubscriptionMapper'],
640
+ Entities['CreateSubscriptionMapper'],
641
+ (
642
+ dto: Dto['CreateSubscriptionMapper'],
643
+ em: EntityManager
644
+ ) => Promise<Entities['CreateSubscriptionMapper']>
645
+ >;
646
+ UpdateSubscriptionMapper: RequestMapperConstructor<
647
+ SchemaValidator,
648
+ Dto['UpdateSubscriptionMapper'],
649
+ Entities['UpdateSubscriptionMapper'],
650
+ (
651
+ dto: Dto['UpdateSubscriptionMapper'],
652
+ em: EntityManager
653
+ ) => Promise<Entities['UpdateSubscriptionMapper']>
654
+ >;
655
+ },
656
+ options?:
657
+ | {
658
+ telemetry?: TelemetryOptions;
659
+ }
660
+ | undefined
661
+ );
662
+ createSubscription(
663
+ subscriptionDto: Dto['CreateSubscriptionMapper'],
664
+ em?: EntityManager
665
+ ): Promise<Dto['SubscriptionMapper']>;
666
+ getSubscription(
667
+ idDto: IdDto,
668
+ em?: EntityManager
669
+ ): Promise<Dto['SubscriptionMapper']>;
670
+ getUserSubscription(
671
+ { id }: IdDto,
672
+ em?: EntityManager
673
+ ): Promise<Dto['SubscriptionMapper']>;
674
+ getOrganizationSubscription(
675
+ { id }: IdDto,
676
+ em?: EntityManager
677
+ ): Promise<Dto['SubscriptionMapper']>;
678
+ updateSubscription(
679
+ subscriptionDto: Dto['UpdateSubscriptionMapper'],
680
+ em?: EntityManager
681
+ ): Promise<Dto['SubscriptionMapper']>;
682
+ deleteSubscription(
683
+ idDto: {
684
+ id: string;
685
+ },
686
+ em?: EntityManager
687
+ ): Promise<void>;
688
+ listSubscriptions(
689
+ idsDto: {
690
+ ids?: string[];
691
+ },
692
+ em?: EntityManager
693
+ ): Promise<Dto['SubscriptionMapper'][]>;
694
+ cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
695
+ resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
253
696
  }
254
697
 
255
- export { BaseBillingPortalService, BaseCheckoutSessionService, BasePaymentLinkService, BasePlanService, BaseSubscriptionService };
698
+ export {
699
+ BaseBillingPortalService,
700
+ BaseCheckoutSessionService,
701
+ BasePaymentLinkService,
702
+ BasePlanService,
703
+ BaseSubscriptionService
704
+ };