@forklaunch/implementation-billing-base 0.5.4 → 0.5.5

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,249 +1,704 @@
1
1
  import { InstanceTypeRecord, IdDto, IdsDto } from '@forklaunch/common';
2
2
  import { TtlCache } from '@forklaunch/core/cache';
3
- import { TelemetryOptions, OpenTelemetryCollector, MetricsDefinition } from '@forklaunch/core/http';
4
- import { BillingPortalService, CheckoutSessionService, PaymentLinkService, PlanService, SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
5
- import { BillingPortalDto, CreateBillingPortalDto, UpdateBillingPortalDto, CheckoutSessionDto, CreateCheckoutSessionDto, UpdateCheckoutSessionDto, PaymentLinkDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, PlanDto, CreatePlanDto, UpdatePlanDto, SubscriptionDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
6
- import { InternalMapper, ResponseMapperConstructor, RequestMapperConstructor } from '@forklaunch/internal';
3
+ import {
4
+ TelemetryOptions,
5
+ OpenTelemetryCollector,
6
+ MetricsDefinition
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
+ InternalMapper,
34
+ ResponseMapperConstructor,
35
+ RequestMapperConstructor
36
+ } from '@forklaunch/internal';
7
37
  import { AnySchemaValidator } from '@forklaunch/validator';
8
38
  import { EntityManager } from '@mikro-orm/core';
9
39
 
10
40
  type BaseBillingDtos = {
11
- BillingPortalMapper: BillingPortalDto;
12
- CreateBillingPortalMapper: CreateBillingPortalDto;
13
- UpdateBillingPortalMapper: UpdateBillingPortalDto;
41
+ BillingPortalMapper: BillingPortalDto;
42
+ CreateBillingPortalMapper: CreateBillingPortalDto;
43
+ UpdateBillingPortalMapper: UpdateBillingPortalDto;
14
44
  };
15
45
  type BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
16
- CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
17
- CreateCheckoutSessionMapper: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
18
- UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<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
+ >;
19
61
  };
20
62
  type BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
21
- PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
22
- CreatePaymentLinkMapper: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
23
- UpdatePaymentLinkMapper: UpdatePaymentLinkDto<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
+ >;
24
78
  };
25
79
  type BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
26
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
27
- CreatePlanMapper: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
28
- UpdatePlanMapper: UpdatePlanDto<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
+ >;
29
91
  };
30
92
  type BaseSubscriptionDtos<PartyType, BillingProviderType> = {
31
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
32
- CreateSubscriptionMapper: CreateSubscriptionDto<PartyType, BillingProviderType>;
33
- UpdateSubscriptionMapper: UpdateSubscriptionDto<PartyType, BillingProviderType>;
93
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
94
+ CreateSubscriptionMapper: CreateSubscriptionDto<
95
+ PartyType,
96
+ BillingProviderType
97
+ >;
98
+ UpdateSubscriptionMapper: UpdateSubscriptionDto<
99
+ PartyType,
100
+ BillingProviderType
101
+ >;
34
102
  };
35
103
 
36
104
  type BaseBillingEntities = {
37
- BillingPortalMapper: BillingPortalDto;
38
- CreateBillingPortalMapper: BillingPortalDto;
39
- UpdateBillingPortalMapper: BillingPortalDto;
40
- };
41
- type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
42
- CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
43
- CreateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
44
- UpdateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
105
+ BillingPortalMapper: BillingPortalDto;
106
+ CreateBillingPortalMapper: BillingPortalDto;
107
+ UpdateBillingPortalMapper: BillingPortalDto;
45
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
+ };
46
127
  type BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
47
- PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
48
- CreatePaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
49
- UpdatePaymentLinkMapper: PaymentLinkDto<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
+ >;
50
143
  };
51
144
  type BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
52
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
53
- CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
54
- UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
145
+ PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
146
+ CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
147
+ UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
55
148
  };
56
149
  type BaseSubscriptionEntities<PartyType, BillingProviderType> = {
57
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
58
- CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
59
- UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
150
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
151
+ CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
152
+ UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
60
153
  };
61
154
 
62
- declare class BaseBillingPortalService<SchemaValidator extends AnySchemaValidator, Entities extends BaseBillingEntities, Dto extends BaseBillingDtos = BaseBillingDtos> implements BillingPortalService {
63
- readonly options?: {
64
- telemetry?: TelemetryOptions;
65
- enableDatabaseBackup?: boolean;
66
- } | undefined;
67
- protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
68
- protected evaluatedTelemetryOptions: {
69
- logging?: boolean;
70
- metrics?: boolean;
71
- tracing?: boolean;
72
- };
73
- protected enableDatabaseBackup: boolean;
74
- protected em: EntityManager;
75
- protected cache: TtlCache;
76
- protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
77
- protected schemaValidator: SchemaValidator;
78
- protected mappers: {
79
- BillingPortalMapper: ResponseMapperConstructor<SchemaValidator, Dto['BillingPortalMapper'], Entities['BillingPortalMapper']>;
80
- CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager) => Promise<Entities['CreateBillingPortalMapper']>>;
81
- UpdateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalMapper'], Entities['UpdateBillingPortalMapper'], (dto: Dto['UpdateBillingPortalMapper'], em: EntityManager) => Promise<Entities['UpdateBillingPortalMapper']>>;
82
- };
83
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
84
- BillingPortalMapper: ResponseMapperConstructor<SchemaValidator, Dto['BillingPortalMapper'], Entities['BillingPortalMapper']>;
85
- CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager) => Promise<Entities['CreateBillingPortalMapper']>>;
86
- UpdateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalMapper'], Entities['UpdateBillingPortalMapper'], (dto: Dto['UpdateBillingPortalMapper'], em: EntityManager) => Promise<Entities['UpdateBillingPortalMapper']>>;
87
- }, options?: {
155
+ declare class BaseBillingPortalService<
156
+ SchemaValidator extends AnySchemaValidator,
157
+ Entities extends BaseBillingEntities,
158
+ Dto extends BaseBillingDtos = BaseBillingDtos
159
+ > implements BillingPortalService
160
+ {
161
+ readonly options?:
162
+ | {
88
163
  telemetry?: TelemetryOptions;
89
164
  enableDatabaseBackup?: boolean;
90
- } | undefined);
91
- protected createCacheKey: (id: string) => string;
92
- createBillingPortalSession(billingPortalDto: Dto['CreateBillingPortalMapper']): Promise<Dto['BillingPortalMapper']>;
93
- getBillingPortalSession(idDto: IdDto): Promise<Dto['BillingPortalMapper']>;
94
- updateBillingPortalSession(billingPortalDto: UpdateBillingPortalDto): Promise<Dto['BillingPortalMapper']>;
95
- expireBillingPortalSession(idDto: IdDto): Promise<void>;
165
+ }
166
+ | undefined;
167
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
168
+ protected evaluatedTelemetryOptions: {
169
+ logging?: boolean;
170
+ metrics?: boolean;
171
+ tracing?: boolean;
172
+ };
173
+ protected enableDatabaseBackup: boolean;
174
+ protected em: EntityManager;
175
+ protected cache: TtlCache;
176
+ protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
177
+ protected schemaValidator: SchemaValidator;
178
+ protected mappers: {
179
+ BillingPortalMapper: ResponseMapperConstructor<
180
+ SchemaValidator,
181
+ Dto['BillingPortalMapper'],
182
+ Entities['BillingPortalMapper']
183
+ >;
184
+ CreateBillingPortalMapper: RequestMapperConstructor<
185
+ SchemaValidator,
186
+ Dto['CreateBillingPortalMapper'],
187
+ Entities['CreateBillingPortalMapper'],
188
+ (
189
+ dto: Dto['CreateBillingPortalMapper'],
190
+ em: EntityManager
191
+ ) => Promise<Entities['CreateBillingPortalMapper']>
192
+ >;
193
+ UpdateBillingPortalMapper: RequestMapperConstructor<
194
+ SchemaValidator,
195
+ Dto['UpdateBillingPortalMapper'],
196
+ Entities['UpdateBillingPortalMapper'],
197
+ (
198
+ dto: Dto['UpdateBillingPortalMapper'],
199
+ em: EntityManager
200
+ ) => Promise<Entities['UpdateBillingPortalMapper']>
201
+ >;
202
+ };
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>;
96
249
  }
97
250
 
98
- declare class BaseCheckoutSessionService<SchemaValidator extends AnySchemaValidator, PaymentMethodEnum, CurrencyEnum, StatusEnum, Entities extends BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, Dto extends BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> implements CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum> {
99
- readonly options?: {
100
- enableDatabaseBackup?: boolean;
101
- telemetry?: TelemetryOptions;
102
- } | undefined;
103
- protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
104
- protected evaluatedTelemetryOptions: {
105
- logging?: boolean;
106
- metrics?: boolean;
107
- tracing?: boolean;
108
- };
109
- protected enableDatabaseBackup: boolean;
110
- protected readonly em: EntityManager;
111
- protected readonly cache: TtlCache;
112
- protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
113
- protected readonly schemaValidator: SchemaValidator;
114
- protected readonly mappers: {
115
- CheckoutSessionMapper: ResponseMapperConstructor<SchemaValidator, Dto['CheckoutSessionMapper'], Entities['CheckoutSessionMapper']>;
116
- CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager) => Promise<Entities['CreateCheckoutSessionMapper']>>;
117
- UpdateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionMapper'], Entities['UpdateCheckoutSessionMapper'], (dto: Dto['UpdateCheckoutSessionMapper'], em: EntityManager) => Promise<Entities['UpdateCheckoutSessionMapper']>>;
118
- };
119
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
120
- CheckoutSessionMapper: ResponseMapperConstructor<SchemaValidator, Dto['CheckoutSessionMapper'], Entities['CheckoutSessionMapper']>;
121
- CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager) => Promise<Entities['CreateCheckoutSessionMapper']>>;
122
- UpdateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionMapper'], Entities['UpdateCheckoutSessionMapper'], (dto: Dto['UpdateCheckoutSessionMapper'], em: EntityManager) => Promise<Entities['UpdateCheckoutSessionMapper']>>;
123
- }, 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
+ readonly options?:
269
+ | {
124
270
  enableDatabaseBackup?: boolean;
125
271
  telemetry?: TelemetryOptions;
126
- } | undefined);
127
- protected createCacheKey: (id: string) => string;
128
- createCheckoutSession(checkoutSessionDto: Dto['CreateCheckoutSessionMapper']): Promise<Dto['CheckoutSessionMapper']>;
129
- getCheckoutSession({ id }: IdDto): Promise<Dto['CheckoutSessionMapper']>;
130
- expireCheckoutSession({ id }: IdDto): Promise<void>;
131
- handleCheckoutSuccess({ id }: IdDto): Promise<void>;
132
- handleCheckoutFailure({ id }: IdDto): Promise<void>;
272
+ }
273
+ | undefined;
274
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
275
+ protected evaluatedTelemetryOptions: {
276
+ logging?: boolean;
277
+ metrics?: boolean;
278
+ tracing?: boolean;
279
+ };
280
+ protected enableDatabaseBackup: boolean;
281
+ protected readonly em: EntityManager;
282
+ protected readonly cache: TtlCache;
283
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
284
+ protected readonly schemaValidator: SchemaValidator;
285
+ protected readonly mappers: {
286
+ CheckoutSessionMapper: ResponseMapperConstructor<
287
+ SchemaValidator,
288
+ Dto['CheckoutSessionMapper'],
289
+ Entities['CheckoutSessionMapper']
290
+ >;
291
+ CreateCheckoutSessionMapper: RequestMapperConstructor<
292
+ SchemaValidator,
293
+ Dto['CreateCheckoutSessionMapper'],
294
+ Entities['CreateCheckoutSessionMapper'],
295
+ (
296
+ dto: Dto['CreateCheckoutSessionMapper'],
297
+ em: EntityManager
298
+ ) => Promise<Entities['CreateCheckoutSessionMapper']>
299
+ >;
300
+ UpdateCheckoutSessionMapper: RequestMapperConstructor<
301
+ SchemaValidator,
302
+ Dto['UpdateCheckoutSessionMapper'],
303
+ Entities['UpdateCheckoutSessionMapper'],
304
+ (
305
+ dto: Dto['UpdateCheckoutSessionMapper'],
306
+ em: EntityManager
307
+ ) => Promise<Entities['UpdateCheckoutSessionMapper']>
308
+ >;
309
+ };
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>;
133
355
  }
134
356
 
135
- declare class BasePaymentLinkService<SchemaValidator extends AnySchemaValidator, PaymentMethodEnum, CurrencyEnum, StatusEnum, Entities extends BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, Dto extends BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> implements PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum> {
136
- 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
+ readonly options?:
375
+ | {
137
376
  enableDatabaseBackup?: boolean;
138
377
  telemetry?: TelemetryOptions;
139
- } | undefined;
140
- protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
141
- protected evaluatedTelemetryOptions: {
142
- logging?: boolean;
143
- metrics?: boolean;
144
- tracing?: boolean;
145
- };
146
- protected enableDatabaseBackup: boolean;
147
- protected readonly em: EntityManager;
148
- protected readonly cache: TtlCache;
149
- protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
150
- protected readonly schemaValidator: SchemaValidator;
151
- protected readonly mappers: {
152
- PaymentLinkMapper: ResponseMapperConstructor<SchemaValidator, Dto['PaymentLinkMapper'], Entities['PaymentLinkMapper']>;
153
- CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager) => Promise<Entities['CreatePaymentLinkMapper']>>;
154
- UpdatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkMapper'], Entities['UpdatePaymentLinkMapper'], (dto: Dto['UpdatePaymentLinkMapper'], em: EntityManager) => Promise<Entities['UpdatePaymentLinkMapper']>>;
155
- };
156
- constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
157
- PaymentLinkMapper: ResponseMapperConstructor<SchemaValidator, Dto['PaymentLinkMapper'], Entities['PaymentLinkMapper']>;
158
- CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager) => Promise<Entities['CreatePaymentLinkMapper']>>;
159
- UpdatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkMapper'], Entities['UpdatePaymentLinkMapper'], (dto: Dto['UpdatePaymentLinkMapper'], em: EntityManager) => Promise<Entities['UpdatePaymentLinkMapper']>>;
160
- }, options?: {
161
- enableDatabaseBackup?: boolean;
162
- telemetry?: TelemetryOptions;
163
- } | undefined);
164
- protected cacheKeyPrefix: string;
165
- protected createCacheKey: (id: string) => string;
166
- createPaymentLink(paymentLinkDto: Dto['CreatePaymentLinkMapper']): Promise<Dto['PaymentLinkMapper']>;
167
- updatePaymentLink(paymentLinkDto: Dto['UpdatePaymentLinkMapper']): Promise<Dto['PaymentLinkMapper']>;
168
- getPaymentLink({ id }: IdDto): Promise<Dto['PaymentLinkMapper']>;
169
- expirePaymentLink({ id }: IdDto): Promise<void>;
170
- handlePaymentSuccess({ id }: IdDto): Promise<void>;
171
- handlePaymentFailure({ id }: IdDto): Promise<void>;
172
- listPaymentLinks(idsDto?: IdsDto): Promise<Dto['PaymentLinkMapper'][]>;
378
+ }
379
+ | undefined;
380
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
381
+ protected evaluatedTelemetryOptions: {
382
+ logging?: boolean;
383
+ metrics?: boolean;
384
+ tracing?: boolean;
385
+ };
386
+ protected enableDatabaseBackup: boolean;
387
+ protected readonly em: EntityManager;
388
+ protected readonly cache: TtlCache;
389
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
390
+ protected readonly schemaValidator: SchemaValidator;
391
+ protected readonly mappers: {
392
+ PaymentLinkMapper: ResponseMapperConstructor<
393
+ SchemaValidator,
394
+ Dto['PaymentLinkMapper'],
395
+ Entities['PaymentLinkMapper']
396
+ >;
397
+ CreatePaymentLinkMapper: RequestMapperConstructor<
398
+ SchemaValidator,
399
+ Dto['CreatePaymentLinkMapper'],
400
+ Entities['CreatePaymentLinkMapper'],
401
+ (
402
+ dto: Dto['CreatePaymentLinkMapper'],
403
+ em: EntityManager
404
+ ) => Promise<Entities['CreatePaymentLinkMapper']>
405
+ >;
406
+ UpdatePaymentLinkMapper: RequestMapperConstructor<
407
+ SchemaValidator,
408
+ Dto['UpdatePaymentLinkMapper'],
409
+ Entities['UpdatePaymentLinkMapper'],
410
+ (
411
+ dto: Dto['UpdatePaymentLinkMapper'],
412
+ em: EntityManager
413
+ ) => Promise<Entities['UpdatePaymentLinkMapper']>
414
+ >;
415
+ };
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'][]>;
173
466
  }
174
467
 
175
- declare class BasePlanService<SchemaValidator extends AnySchemaValidator, PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, Entities extends BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, Dto extends BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> implements PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> {
176
- readonly options?: {
177
- telemetry?: TelemetryOptions;
178
- } | undefined;
179
- protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
180
- protected evaluatedTelemetryOptions: {
181
- logging?: boolean;
182
- metrics?: boolean;
183
- tracing?: boolean;
184
- };
185
- protected em: EntityManager;
186
- protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
187
- protected readonly schemaValidator: SchemaValidator;
188
- protected readonly mappers: {
189
- PlanMapper: ResponseMapperConstructor<SchemaValidator, Dto['PlanMapper'], Entities['PlanMapper']>;
190
- CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager) => Promise<Entities['CreatePlanMapper']>>;
191
- UpdatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePlanMapper'], Entities['UpdatePlanMapper'], (dto: Dto['UpdatePlanMapper'], em: EntityManager) => Promise<Entities['UpdatePlanMapper']>>;
192
- };
193
- constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
194
- PlanMapper: ResponseMapperConstructor<SchemaValidator, Dto['PlanMapper'], Entities['PlanMapper']>;
195
- CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager) => Promise<Entities['CreatePlanMapper']>>;
196
- UpdatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePlanMapper'], Entities['UpdatePlanMapper'], (dto: Dto['UpdatePlanMapper'], em: EntityManager) => Promise<Entities['UpdatePlanMapper']>>;
197
- }, 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
+ readonly options?:
486
+ | {
198
487
  telemetry?: TelemetryOptions;
199
- } | undefined);
200
- listPlans(idsDto?: IdsDto, em?: EntityManager): Promise<Dto['PlanMapper'][]>;
201
- createPlan(planDto: Dto['CreatePlanMapper'], em?: EntityManager): Promise<Dto['PlanMapper']>;
202
- getPlan(idDto: IdDto, em?: EntityManager): Promise<Dto['PlanMapper']>;
203
- updatePlan(planDto: Dto['UpdatePlanMapper'], em?: EntityManager): Promise<Dto['PlanMapper']>;
204
- deletePlan(idDto: {
205
- id: string;
206
- }, em?: EntityManager): Promise<void>;
488
+ }
489
+ | undefined;
490
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
491
+ protected evaluatedTelemetryOptions: {
492
+ logging?: boolean;
493
+ metrics?: boolean;
494
+ tracing?: boolean;
495
+ };
496
+ protected em: EntityManager;
497
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
498
+ protected readonly schemaValidator: SchemaValidator;
499
+ protected readonly mappers: {
500
+ PlanMapper: ResponseMapperConstructor<
501
+ SchemaValidator,
502
+ Dto['PlanMapper'],
503
+ Entities['PlanMapper']
504
+ >;
505
+ CreatePlanMapper: RequestMapperConstructor<
506
+ SchemaValidator,
507
+ Dto['CreatePlanMapper'],
508
+ Entities['CreatePlanMapper'],
509
+ (
510
+ dto: Dto['CreatePlanMapper'],
511
+ em: EntityManager
512
+ ) => Promise<Entities['CreatePlanMapper']>
513
+ >;
514
+ UpdatePlanMapper: RequestMapperConstructor<
515
+ SchemaValidator,
516
+ Dto['UpdatePlanMapper'],
517
+ Entities['UpdatePlanMapper'],
518
+ (
519
+ dto: Dto['UpdatePlanMapper'],
520
+ em: EntityManager
521
+ ) => Promise<Entities['UpdatePlanMapper']>
522
+ >;
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>;
207
575
  }
208
576
 
209
- declare class BaseSubscriptionService<SchemaValidator extends AnySchemaValidator, PartyType, BillingProviderType, Entities extends BaseSubscriptionEntities<PartyType, BillingProviderType>, Dto extends BaseSubscriptionDtos<PartyType, BillingProviderType> = BaseSubscriptionDtos<PartyType, BillingProviderType>> implements SubscriptionService<PartyType, BillingProviderType> {
210
- readonly options?: {
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
+ readonly options?:
589
+ | {
211
590
  telemetry?: TelemetryOptions;
212
- } | undefined;
213
- protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
214
- protected evaluatedTelemetryOptions: {
215
- logging?: boolean;
216
- metrics?: boolean;
217
- tracing?: boolean;
218
- };
219
- protected em: EntityManager;
220
- protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
221
- protected readonly schemaValidator: SchemaValidator;
222
- protected readonly mappers: {
223
- SubscriptionMapper: ResponseMapperConstructor<SchemaValidator, Dto['SubscriptionMapper'], Entities['SubscriptionMapper']>;
224
- CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager) => Promise<Entities['CreateSubscriptionMapper']>>;
225
- UpdateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionMapper'], Entities['UpdateSubscriptionMapper'], (dto: Dto['UpdateSubscriptionMapper'], em: EntityManager) => Promise<Entities['UpdateSubscriptionMapper']>>;
226
- };
227
- constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
228
- SubscriptionMapper: ResponseMapperConstructor<SchemaValidator, Dto['SubscriptionMapper'], Entities['SubscriptionMapper']>;
229
- CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager) => Promise<Entities['CreateSubscriptionMapper']>>;
230
- UpdateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionMapper'], Entities['UpdateSubscriptionMapper'], (dto: Dto['UpdateSubscriptionMapper'], em: EntityManager) => Promise<Entities['UpdateSubscriptionMapper']>>;
231
- }, options?: {
232
- telemetry?: TelemetryOptions;
233
- } | undefined);
234
- createSubscription(subscriptionDto: Dto['CreateSubscriptionMapper'], em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
235
- getSubscription(idDto: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
236
- getUserSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
237
- getOrganizationSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
238
- updateSubscription(subscriptionDto: Dto['UpdateSubscriptionMapper'], em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
239
- deleteSubscription(idDto: {
240
- id: string;
241
- }, em?: EntityManager): Promise<void>;
242
- listSubscriptions(idsDto: {
243
- ids?: string[];
244
- }, em?: EntityManager): Promise<Dto['SubscriptionMapper'][]>;
245
- cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
246
- resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
591
+ }
592
+ | undefined;
593
+ protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
594
+ protected evaluatedTelemetryOptions: {
595
+ logging?: boolean;
596
+ metrics?: boolean;
597
+ tracing?: boolean;
598
+ };
599
+ protected em: EntityManager;
600
+ protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
601
+ protected readonly schemaValidator: SchemaValidator;
602
+ protected readonly mappers: {
603
+ SubscriptionMapper: ResponseMapperConstructor<
604
+ SchemaValidator,
605
+ Dto['SubscriptionMapper'],
606
+ Entities['SubscriptionMapper']
607
+ >;
608
+ CreateSubscriptionMapper: RequestMapperConstructor<
609
+ SchemaValidator,
610
+ Dto['CreateSubscriptionMapper'],
611
+ Entities['CreateSubscriptionMapper'],
612
+ (
613
+ dto: Dto['CreateSubscriptionMapper'],
614
+ em: EntityManager
615
+ ) => Promise<Entities['CreateSubscriptionMapper']>
616
+ >;
617
+ UpdateSubscriptionMapper: RequestMapperConstructor<
618
+ SchemaValidator,
619
+ Dto['UpdateSubscriptionMapper'],
620
+ Entities['UpdateSubscriptionMapper'],
621
+ (
622
+ dto: Dto['UpdateSubscriptionMapper'],
623
+ em: EntityManager
624
+ ) => Promise<Entities['UpdateSubscriptionMapper']>
625
+ >;
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>;
247
696
  }
248
697
 
249
- export { BaseBillingPortalService, BaseCheckoutSessionService, BasePaymentLinkService, BasePlanService, BaseSubscriptionService };
698
+ export {
699
+ BaseBillingPortalService,
700
+ BaseCheckoutSessionService,
701
+ BasePaymentLinkService,
702
+ BasePlanService,
703
+ BaseSubscriptionService
704
+ };