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