@forklaunch/implementation-billing-stripe 0.3.3 → 0.3.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.
- package/lib/domain/enum/index.d.mts +119 -112
- package/lib/domain/enum/index.d.ts +119 -112
- package/lib/domain/enum/index.js +124 -119
- package/lib/domain/enum/index.mjs +109 -109
- package/lib/domain/schemas/index.d.mts +2914 -323
- package/lib/domain/schemas/index.d.ts +2914 -323
- package/lib/domain/schemas/index.js +257 -181
- package/lib/domain/schemas/index.mjs +131 -130
- package/lib/domain/types/index.d.mts +375 -135
- package/lib/domain/types/index.d.ts +375 -135
- package/lib/domain/types/index.js +8 -4
- package/lib/services/index.d.mts +461 -148
- package/lib/services/index.d.ts +461 -148
- package/lib/services/index.js +229 -131
- package/lib/services/index.mjs +194 -103
- package/package.json +11 -11
package/lib/services/index.d.mts
CHANGED
|
@@ -1,177 +1,490 @@
|
|
|
1
1
|
import { IdDto, IdsDto } from '@forklaunch/common';
|
|
2
2
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
6
22
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
7
23
|
import { EntityManager } from '@mikro-orm/core';
|
|
8
24
|
import stripe__default from 'stripe';
|
|
9
|
-
import {
|
|
10
|
-
|
|
25
|
+
import {
|
|
26
|
+
StripeBillingPortalEntities,
|
|
27
|
+
StripeBillingPortalDtos,
|
|
28
|
+
StripeBillingPortalMappers,
|
|
29
|
+
StripeCreateBillingPortalDto,
|
|
30
|
+
StripeUpdateBillingPortalDto,
|
|
31
|
+
StripeCheckoutSessionEntities,
|
|
32
|
+
StripeCheckoutSessionDtos,
|
|
33
|
+
StripeCheckoutSessionMappers,
|
|
34
|
+
StripeCreateCheckoutSessionDto,
|
|
35
|
+
StripePaymentLinkEntities,
|
|
36
|
+
StripePaymentLinkDtos,
|
|
37
|
+
StripeCreatePaymentLinkDto,
|
|
38
|
+
StripeUpdatePaymentLinkDto,
|
|
39
|
+
StripePaymentLinkDto,
|
|
40
|
+
StripePaymentLinkMappers,
|
|
41
|
+
StripePlanEntities,
|
|
42
|
+
StripePlanDtos,
|
|
43
|
+
StripeCreatePlanDto,
|
|
44
|
+
StripeUpdatePlanDto,
|
|
45
|
+
StripePlanDto,
|
|
46
|
+
StripePlanMappers,
|
|
47
|
+
StripeSubscriptionEntities,
|
|
48
|
+
StripeSubscriptionDtos,
|
|
49
|
+
StripeCreateSubscriptionDto,
|
|
50
|
+
StripeUpdateSubscriptionDto,
|
|
51
|
+
StripeSubscriptionDto,
|
|
52
|
+
StripeSubscriptionMappers
|
|
53
|
+
} from '../domain/types/index.mjs';
|
|
54
|
+
import {
|
|
55
|
+
PaymentMethodEnum,
|
|
56
|
+
CurrencyEnum,
|
|
57
|
+
PlanCadenceEnum,
|
|
58
|
+
BillingProviderEnum
|
|
59
|
+
} from '../domain/enum/index.mjs';
|
|
11
60
|
import '@forklaunch/interfaces-billing/types';
|
|
12
61
|
|
|
13
|
-
declare class StripeBillingPortalService<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
62
|
+
declare class StripeBillingPortalService<
|
|
63
|
+
SchemaValidator extends AnySchemaValidator,
|
|
64
|
+
Entities extends StripeBillingPortalEntities,
|
|
65
|
+
Dto extends StripeBillingPortalDtos = StripeBillingPortalDtos
|
|
66
|
+
> implements
|
|
67
|
+
BillingPortalService<{
|
|
68
|
+
CreateBillingPortalDto: Dto['CreateBillingPortalMapper'];
|
|
69
|
+
UpdateBillingPortalDto: Dto['UpdateBillingPortalMapper'];
|
|
70
|
+
BillingPortalDto: Dto['BillingPortalMapper'];
|
|
71
|
+
IdDto: IdDto;
|
|
72
|
+
}>
|
|
73
|
+
{
|
|
74
|
+
readonly options?:
|
|
75
|
+
| {
|
|
20
76
|
enableDatabaseBackup?: boolean;
|
|
21
77
|
telemetry?: TelemetryOptions;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
78
|
+
}
|
|
79
|
+
| undefined;
|
|
80
|
+
baseBillingPortalService: BaseBillingPortalService<
|
|
81
|
+
SchemaValidator,
|
|
82
|
+
Entities,
|
|
83
|
+
Dto
|
|
84
|
+
>;
|
|
85
|
+
protected readonly stripeClient: stripe__default;
|
|
86
|
+
protected readonly em: EntityManager;
|
|
87
|
+
protected readonly cache: TtlCache;
|
|
88
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
89
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
90
|
+
private readonly billingPortalSessionExpiryDurationMs;
|
|
91
|
+
protected readonly mappers: StripeBillingPortalMappers<Entities, Dto>;
|
|
92
|
+
constructor(
|
|
93
|
+
stripeClient: stripe__default,
|
|
94
|
+
em: EntityManager,
|
|
95
|
+
cache: TtlCache,
|
|
96
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
97
|
+
schemaValidator: SchemaValidator,
|
|
98
|
+
mappers: StripeBillingPortalMappers<Entities, Dto>,
|
|
99
|
+
options?:
|
|
100
|
+
| {
|
|
101
|
+
enableDatabaseBackup?: boolean;
|
|
102
|
+
telemetry?: TelemetryOptions;
|
|
103
|
+
}
|
|
104
|
+
| undefined
|
|
105
|
+
);
|
|
106
|
+
createBillingPortalSession(
|
|
107
|
+
billingPortalDto: StripeCreateBillingPortalDto,
|
|
108
|
+
...args: unknown[]
|
|
109
|
+
): Promise<Dto['BillingPortalMapper']>;
|
|
110
|
+
getBillingPortalSession(idDto: IdDto): Promise<Dto['BillingPortalMapper']>;
|
|
111
|
+
expireBillingPortalSession(idDto: IdDto): Promise<void>;
|
|
112
|
+
updateBillingPortalSession(
|
|
113
|
+
billingPortalDto: StripeUpdateBillingPortalDto,
|
|
114
|
+
...args: unknown[]
|
|
115
|
+
): Promise<Dto['BillingPortalMapper']>;
|
|
39
116
|
}
|
|
40
117
|
|
|
41
|
-
declare class StripeCheckoutSessionService<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
118
|
+
declare class StripeCheckoutSessionService<
|
|
119
|
+
SchemaValidator extends AnySchemaValidator,
|
|
120
|
+
StatusEnum,
|
|
121
|
+
Entities extends StripeCheckoutSessionEntities<StatusEnum>,
|
|
122
|
+
Dto extends
|
|
123
|
+
StripeCheckoutSessionDtos<StatusEnum> = StripeCheckoutSessionDtos<StatusEnum>
|
|
124
|
+
> implements
|
|
125
|
+
CheckoutSessionService<
|
|
126
|
+
typeof PaymentMethodEnum,
|
|
127
|
+
typeof CurrencyEnum,
|
|
128
|
+
StatusEnum,
|
|
129
|
+
{
|
|
130
|
+
CreateCheckoutSessionDto: Dto['CreateCheckoutSessionMapper'];
|
|
131
|
+
CheckoutSessionDto: Dto['CheckoutSessionMapper'];
|
|
132
|
+
IdDto: IdDto;
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
{
|
|
136
|
+
readonly options?:
|
|
137
|
+
| {
|
|
47
138
|
enableDatabaseBackup?: boolean;
|
|
48
139
|
telemetry?: TelemetryOptions;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
140
|
+
}
|
|
141
|
+
| undefined;
|
|
142
|
+
baseCheckoutSessionService: BaseCheckoutSessionService<
|
|
143
|
+
SchemaValidator,
|
|
144
|
+
PaymentMethodEnum,
|
|
145
|
+
CurrencyEnum,
|
|
146
|
+
StatusEnum,
|
|
147
|
+
Entities,
|
|
148
|
+
Dto
|
|
149
|
+
>;
|
|
150
|
+
protected readonly stripeClient: stripe__default;
|
|
151
|
+
protected readonly em: EntityManager;
|
|
152
|
+
protected readonly cache: TtlCache;
|
|
153
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
154
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
155
|
+
protected readonly mappers: StripeCheckoutSessionMappers<
|
|
156
|
+
StatusEnum,
|
|
157
|
+
Entities,
|
|
158
|
+
Dto
|
|
159
|
+
>;
|
|
160
|
+
constructor(
|
|
161
|
+
stripeClient: stripe__default,
|
|
162
|
+
em: EntityManager,
|
|
163
|
+
cache: TtlCache,
|
|
164
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
165
|
+
schemaValidator: SchemaValidator,
|
|
166
|
+
mappers: StripeCheckoutSessionMappers<StatusEnum, Entities, Dto>,
|
|
167
|
+
options?:
|
|
168
|
+
| {
|
|
169
|
+
enableDatabaseBackup?: boolean;
|
|
170
|
+
telemetry?: TelemetryOptions;
|
|
171
|
+
}
|
|
172
|
+
| undefined
|
|
173
|
+
);
|
|
174
|
+
createCheckoutSession(
|
|
175
|
+
checkoutSessionDto: StripeCreateCheckoutSessionDto<StatusEnum>,
|
|
176
|
+
...args: unknown[]
|
|
177
|
+
): Promise<Dto['CheckoutSessionMapper']>;
|
|
178
|
+
getCheckoutSession(idDto: IdDto): Promise<Dto['CheckoutSessionMapper']>;
|
|
179
|
+
expireCheckoutSession({ id }: IdDto): Promise<void>;
|
|
180
|
+
handleCheckoutSuccess({ id }: IdDto): Promise<void>;
|
|
181
|
+
handleCheckoutFailure({ id }: IdDto): Promise<void>;
|
|
66
182
|
}
|
|
67
183
|
|
|
68
|
-
declare class StripePaymentLinkService<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
184
|
+
declare class StripePaymentLinkService<
|
|
185
|
+
SchemaValidator extends AnySchemaValidator,
|
|
186
|
+
StatusEnum,
|
|
187
|
+
Entities extends StripePaymentLinkEntities<StatusEnum>,
|
|
188
|
+
Dto extends
|
|
189
|
+
StripePaymentLinkDtos<StatusEnum> = StripePaymentLinkDtos<StatusEnum>
|
|
190
|
+
> implements
|
|
191
|
+
PaymentLinkService<
|
|
192
|
+
PaymentMethodEnum,
|
|
193
|
+
typeof CurrencyEnum,
|
|
194
|
+
StatusEnum,
|
|
195
|
+
{
|
|
196
|
+
CreatePaymentLinkDto: StripeCreatePaymentLinkDto<StatusEnum>;
|
|
197
|
+
UpdatePaymentLinkDto: StripeUpdatePaymentLinkDto<StatusEnum>;
|
|
198
|
+
PaymentLinkDto: StripePaymentLinkDto<StatusEnum>;
|
|
199
|
+
IdDto: IdDto;
|
|
200
|
+
IdsDto: IdsDto;
|
|
201
|
+
}
|
|
202
|
+
>
|
|
203
|
+
{
|
|
204
|
+
readonly options?:
|
|
205
|
+
| {
|
|
87
206
|
enableDatabaseBackup?: boolean;
|
|
88
207
|
telemetry?: TelemetryOptions;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
208
|
+
}
|
|
209
|
+
| undefined;
|
|
210
|
+
basePaymentLinkService: BasePaymentLinkService<
|
|
211
|
+
SchemaValidator,
|
|
212
|
+
PaymentMethodEnum,
|
|
213
|
+
CurrencyEnum,
|
|
214
|
+
StatusEnum,
|
|
215
|
+
Entities,
|
|
216
|
+
Dto
|
|
217
|
+
>;
|
|
218
|
+
protected readonly stripeClient: stripe__default;
|
|
219
|
+
protected readonly em: EntityManager;
|
|
220
|
+
protected readonly cache: TtlCache;
|
|
221
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
222
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
223
|
+
protected readonly mappers: StripePaymentLinkMappers<
|
|
224
|
+
StatusEnum,
|
|
225
|
+
Entities,
|
|
226
|
+
Dto
|
|
227
|
+
>;
|
|
228
|
+
constructor(
|
|
229
|
+
stripeClient: stripe__default,
|
|
230
|
+
em: EntityManager,
|
|
231
|
+
cache: TtlCache,
|
|
232
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
233
|
+
schemaValidator: SchemaValidator,
|
|
234
|
+
mappers: StripePaymentLinkMappers<StatusEnum, Entities, Dto>,
|
|
235
|
+
options?:
|
|
236
|
+
| {
|
|
237
|
+
enableDatabaseBackup?: boolean;
|
|
238
|
+
telemetry?: TelemetryOptions;
|
|
239
|
+
}
|
|
240
|
+
| undefined
|
|
241
|
+
);
|
|
242
|
+
createPaymentLink(
|
|
243
|
+
paymentLinkDto: StripeCreatePaymentLinkDto<StatusEnum>,
|
|
244
|
+
...args: unknown[]
|
|
245
|
+
): Promise<Dto['PaymentLinkMapper']>;
|
|
246
|
+
updatePaymentLink(
|
|
247
|
+
paymentLinkDto: StripeUpdatePaymentLinkDto<StatusEnum>,
|
|
248
|
+
...args: unknown[]
|
|
249
|
+
): Promise<Dto['PaymentLinkMapper']>;
|
|
250
|
+
getPaymentLink({ id }: IdDto): Promise<Dto['PaymentLinkMapper']>;
|
|
251
|
+
expirePaymentLink({ id }: IdDto): Promise<void>;
|
|
252
|
+
handlePaymentSuccess({ id }: IdDto): Promise<void>;
|
|
253
|
+
handlePaymentFailure({ id }: IdDto): Promise<void>;
|
|
254
|
+
listPaymentLinks(idsDto?: IdsDto): Promise<Dto['PaymentLinkMapper'][]>;
|
|
97
255
|
}
|
|
98
256
|
|
|
99
|
-
declare class StripePlanService<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
257
|
+
declare class StripePlanService<
|
|
258
|
+
SchemaValidator extends AnySchemaValidator,
|
|
259
|
+
Entities extends StripePlanEntities,
|
|
260
|
+
Dto extends StripePlanDtos = StripePlanDtos
|
|
261
|
+
> implements
|
|
262
|
+
PlanService<
|
|
263
|
+
typeof PlanCadenceEnum,
|
|
264
|
+
typeof CurrencyEnum,
|
|
265
|
+
typeof BillingProviderEnum,
|
|
266
|
+
{
|
|
267
|
+
CreatePlanDto: StripeCreatePlanDto;
|
|
268
|
+
UpdatePlanDto: StripeUpdatePlanDto;
|
|
269
|
+
PlanDto: StripePlanDto;
|
|
270
|
+
IdDto: IdDto;
|
|
271
|
+
IdsDto: IdsDto;
|
|
272
|
+
}
|
|
273
|
+
>
|
|
274
|
+
{
|
|
275
|
+
readonly options?:
|
|
276
|
+
| {
|
|
117
277
|
telemetry?: TelemetryOptions;
|
|
118
278
|
databaseTableName?: string;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
279
|
+
}
|
|
280
|
+
| undefined;
|
|
281
|
+
basePlanService: BasePlanService<
|
|
282
|
+
SchemaValidator,
|
|
283
|
+
PlanCadenceEnum,
|
|
284
|
+
CurrencyEnum,
|
|
285
|
+
BillingProviderEnum,
|
|
286
|
+
Entities,
|
|
287
|
+
Dto
|
|
288
|
+
>;
|
|
289
|
+
protected readonly stripeClient: stripe__default;
|
|
290
|
+
protected readonly em: EntityManager;
|
|
291
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
292
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
293
|
+
protected readonly mappers: StripePlanMappers<Entities, Dto>;
|
|
294
|
+
constructor(
|
|
295
|
+
stripeClient: stripe__default,
|
|
296
|
+
em: EntityManager,
|
|
297
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
298
|
+
schemaValidator: SchemaValidator,
|
|
299
|
+
mappers: StripePlanMappers<Entities, Dto>,
|
|
300
|
+
options?:
|
|
301
|
+
| {
|
|
302
|
+
telemetry?: TelemetryOptions;
|
|
303
|
+
databaseTableName?: string;
|
|
304
|
+
}
|
|
305
|
+
| undefined
|
|
306
|
+
);
|
|
307
|
+
createPlan(
|
|
308
|
+
planDto: StripeCreatePlanDto,
|
|
309
|
+
em?: EntityManager
|
|
310
|
+
): Promise<Dto['PlanMapper']>;
|
|
311
|
+
getPlan(idDto: IdDto, em?: EntityManager): Promise<Dto['PlanMapper']>;
|
|
312
|
+
updatePlan(
|
|
313
|
+
planDto: StripeUpdatePlanDto,
|
|
314
|
+
em?: EntityManager
|
|
315
|
+
): Promise<Dto['PlanMapper']>;
|
|
316
|
+
deletePlan(
|
|
317
|
+
idDto: {
|
|
318
|
+
id: string;
|
|
319
|
+
},
|
|
320
|
+
em?: EntityManager
|
|
321
|
+
): Promise<void>;
|
|
322
|
+
listPlans(idsDto?: IdsDto, em?: EntityManager): Promise<Dto['PlanMapper'][]>;
|
|
127
323
|
}
|
|
128
324
|
|
|
129
|
-
declare class StripeSubscriptionService<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
325
|
+
declare class StripeSubscriptionService<
|
|
326
|
+
SchemaValidator extends AnySchemaValidator,
|
|
327
|
+
PartyType,
|
|
328
|
+
Entities extends StripeSubscriptionEntities<PartyType>,
|
|
329
|
+
Dto extends
|
|
330
|
+
StripeSubscriptionDtos<PartyType> = StripeSubscriptionDtos<PartyType>
|
|
331
|
+
> implements
|
|
332
|
+
SubscriptionService<
|
|
333
|
+
PartyType,
|
|
334
|
+
typeof BillingProviderEnum,
|
|
335
|
+
{
|
|
336
|
+
CreateSubscriptionDto: StripeCreateSubscriptionDto<PartyType>;
|
|
337
|
+
UpdateSubscriptionDto: StripeUpdateSubscriptionDto<PartyType>;
|
|
338
|
+
SubscriptionDto: StripeSubscriptionDto<PartyType>;
|
|
339
|
+
IdDto: IdDto;
|
|
340
|
+
IdsDto: IdsDto;
|
|
341
|
+
}
|
|
342
|
+
>
|
|
343
|
+
{
|
|
344
|
+
readonly options?:
|
|
345
|
+
| {
|
|
147
346
|
telemetry?: TelemetryOptions;
|
|
148
347
|
databaseTableName?: string;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
348
|
+
}
|
|
349
|
+
| undefined;
|
|
350
|
+
baseSubscriptionService: BaseSubscriptionService<
|
|
351
|
+
SchemaValidator,
|
|
352
|
+
PartyType,
|
|
353
|
+
BillingProviderEnum,
|
|
354
|
+
Entities,
|
|
355
|
+
Dto
|
|
356
|
+
>;
|
|
357
|
+
protected readonly stripeClient: stripe__default;
|
|
358
|
+
protected readonly em: EntityManager;
|
|
359
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
360
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
361
|
+
protected readonly mappers: StripeSubscriptionMappers<
|
|
362
|
+
PartyType,
|
|
363
|
+
Entities,
|
|
364
|
+
Dto
|
|
365
|
+
>;
|
|
366
|
+
constructor(
|
|
367
|
+
stripeClient: stripe__default,
|
|
368
|
+
em: EntityManager,
|
|
369
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
370
|
+
schemaValidator: SchemaValidator,
|
|
371
|
+
mappers: StripeSubscriptionMappers<PartyType, Entities, Dto>,
|
|
372
|
+
options?:
|
|
373
|
+
| {
|
|
374
|
+
telemetry?: TelemetryOptions;
|
|
375
|
+
databaseTableName?: string;
|
|
376
|
+
}
|
|
377
|
+
| undefined
|
|
378
|
+
);
|
|
379
|
+
createSubscription(
|
|
380
|
+
subscriptionDto: StripeCreateSubscriptionDto<PartyType>,
|
|
381
|
+
em?: EntityManager
|
|
382
|
+
): Promise<Dto['SubscriptionMapper']>;
|
|
383
|
+
getSubscription(
|
|
384
|
+
idDto: IdDto,
|
|
385
|
+
em?: EntityManager
|
|
386
|
+
): Promise<Dto['SubscriptionMapper']>;
|
|
387
|
+
getUserSubscription(
|
|
388
|
+
idDto: IdDto,
|
|
389
|
+
em?: EntityManager
|
|
390
|
+
): Promise<Dto['SubscriptionMapper']>;
|
|
391
|
+
getOrganizationSubscription(
|
|
392
|
+
idDto: IdDto,
|
|
393
|
+
em?: EntityManager
|
|
394
|
+
): Promise<Dto['SubscriptionMapper']>;
|
|
395
|
+
updateSubscription(
|
|
396
|
+
subscriptionDto: StripeUpdateSubscriptionDto<PartyType>,
|
|
397
|
+
em?: EntityManager
|
|
398
|
+
): Promise<Dto['SubscriptionMapper']>;
|
|
399
|
+
deleteSubscription(
|
|
400
|
+
idDto: {
|
|
401
|
+
id: string;
|
|
402
|
+
},
|
|
403
|
+
em?: EntityManager
|
|
404
|
+
): Promise<void>;
|
|
405
|
+
listSubscriptions(
|
|
406
|
+
idsDto: IdsDto,
|
|
407
|
+
em?: EntityManager
|
|
408
|
+
): Promise<Dto['SubscriptionMapper'][]>;
|
|
409
|
+
cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
410
|
+
resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
161
411
|
}
|
|
162
412
|
|
|
163
|
-
declare class StripeWebhookService<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
413
|
+
declare class StripeWebhookService<
|
|
414
|
+
SchemaValidator extends AnySchemaValidator,
|
|
415
|
+
StatusEnum,
|
|
416
|
+
PartyEnum,
|
|
417
|
+
BillingPortalEntities extends
|
|
418
|
+
StripeBillingPortalEntities = StripeBillingPortalEntities,
|
|
419
|
+
CheckoutSessionEntities extends
|
|
420
|
+
StripeCheckoutSessionEntities<StatusEnum> = StripeCheckoutSessionEntities<StatusEnum>,
|
|
421
|
+
PaymentLinkEntities extends
|
|
422
|
+
StripePaymentLinkEntities<StatusEnum> = StripePaymentLinkEntities<StatusEnum>,
|
|
423
|
+
PlanEntities extends StripePlanEntities = StripePlanEntities,
|
|
424
|
+
SubscriptionEntities extends
|
|
425
|
+
StripeSubscriptionEntities<PartyEnum> = StripeSubscriptionEntities<PartyEnum>
|
|
426
|
+
> {
|
|
427
|
+
protected readonly stripeClient: stripe__default;
|
|
428
|
+
protected readonly em: EntityManager;
|
|
429
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
430
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
431
|
+
protected readonly billingPortalService: StripeBillingPortalService<
|
|
432
|
+
SchemaValidator,
|
|
433
|
+
BillingPortalEntities
|
|
434
|
+
>;
|
|
435
|
+
protected readonly checkoutSessionService: StripeCheckoutSessionService<
|
|
436
|
+
SchemaValidator,
|
|
437
|
+
StatusEnum,
|
|
438
|
+
CheckoutSessionEntities
|
|
439
|
+
>;
|
|
440
|
+
protected readonly paymentLinkService: StripePaymentLinkService<
|
|
441
|
+
SchemaValidator,
|
|
442
|
+
StatusEnum,
|
|
443
|
+
PaymentLinkEntities
|
|
444
|
+
>;
|
|
445
|
+
protected readonly planService: StripePlanService<
|
|
446
|
+
SchemaValidator,
|
|
447
|
+
PlanEntities
|
|
448
|
+
>;
|
|
449
|
+
protected readonly subscriptionService: StripeSubscriptionService<
|
|
450
|
+
SchemaValidator,
|
|
451
|
+
PartyEnum,
|
|
452
|
+
SubscriptionEntities
|
|
453
|
+
>;
|
|
454
|
+
constructor(
|
|
455
|
+
stripeClient: stripe__default,
|
|
456
|
+
em: EntityManager,
|
|
457
|
+
schemaValidator: SchemaValidator,
|
|
458
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
459
|
+
billingPortalService: StripeBillingPortalService<
|
|
460
|
+
SchemaValidator,
|
|
461
|
+
BillingPortalEntities
|
|
462
|
+
>,
|
|
463
|
+
checkoutSessionService: StripeCheckoutSessionService<
|
|
464
|
+
SchemaValidator,
|
|
465
|
+
StatusEnum,
|
|
466
|
+
CheckoutSessionEntities
|
|
467
|
+
>,
|
|
468
|
+
paymentLinkService: StripePaymentLinkService<
|
|
469
|
+
SchemaValidator,
|
|
470
|
+
StatusEnum,
|
|
471
|
+
PaymentLinkEntities
|
|
472
|
+
>,
|
|
473
|
+
planService: StripePlanService<SchemaValidator, PlanEntities>,
|
|
474
|
+
subscriptionService: StripeSubscriptionService<
|
|
475
|
+
SchemaValidator,
|
|
476
|
+
PartyEnum,
|
|
477
|
+
SubscriptionEntities
|
|
478
|
+
>
|
|
479
|
+
);
|
|
480
|
+
handleWebhookEvent(event: stripe__default.Event): Promise<void>;
|
|
175
481
|
}
|
|
176
482
|
|
|
177
|
-
export {
|
|
483
|
+
export {
|
|
484
|
+
StripeBillingPortalService,
|
|
485
|
+
StripeCheckoutSessionService,
|
|
486
|
+
StripePaymentLinkService,
|
|
487
|
+
StripePlanService,
|
|
488
|
+
StripeSubscriptionService,
|
|
489
|
+
StripeWebhookService
|
|
490
|
+
};
|