@forklaunch/implementation-billing-base 0.6.5 → 0.7.0
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/schemas/index.d.mts +342 -1196
- package/lib/domain/schemas/index.d.ts +342 -1196
- package/lib/domain/schemas/index.js +250 -389
- package/lib/domain/schemas/index.mjs +225 -281
- package/lib/domain/types/index.d.mts +84 -282
- package/lib/domain/types/index.d.ts +84 -282
- package/lib/domain/types/index.js +4 -8
- package/lib/eject/domain/schemas/billingPortal.schema.ts +7 -1
- package/lib/services/index.d.mts +105 -361
- package/lib/services/index.d.ts +105 -361
- package/lib/services/index.js +161 -198
- package/lib/services/index.mjs +160 -182
- package/package.json +10 -10
package/lib/services/index.d.ts
CHANGED
|
@@ -1,377 +1,121 @@
|
|
|
1
1
|
import { IdDto, IdsDto } from '@forklaunch/common';
|
|
2
2
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
TelemetryOptions
|
|
7
|
-
} from '@forklaunch/core/http';
|
|
8
|
-
import {
|
|
9
|
-
BillingPortalService,
|
|
10
|
-
CheckoutSessionService,
|
|
11
|
-
PaymentLinkService,
|
|
12
|
-
PlanService,
|
|
13
|
-
SubscriptionService
|
|
14
|
-
} from '@forklaunch/interfaces-billing/interfaces';
|
|
15
|
-
import {
|
|
16
|
-
CreateBillingPortalDto,
|
|
17
|
-
UpdateBillingPortalDto,
|
|
18
|
-
CreateCheckoutSessionDto,
|
|
19
|
-
CreatePaymentLinkDto,
|
|
20
|
-
UpdatePaymentLinkDto,
|
|
21
|
-
CreatePlanDto,
|
|
22
|
-
UpdatePlanDto,
|
|
23
|
-
CreateSubscriptionDto,
|
|
24
|
-
UpdateSubscriptionDto
|
|
25
|
-
} from '@forklaunch/interfaces-billing/types';
|
|
3
|
+
import { OpenTelemetryCollector, MetricsDefinition, TelemetryOptions } from '@forklaunch/core/http';
|
|
4
|
+
import { BillingPortalService, CheckoutSessionService, PaymentLinkService, PlanService, SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
|
|
5
|
+
import { CreateBillingPortalDto, UpdateBillingPortalDto, CreateCheckoutSessionDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, CreatePlanDto, UpdatePlanDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
|
|
26
6
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
27
7
|
import { EntityManager } from '@mikro-orm/core';
|
|
28
|
-
import {
|
|
29
|
-
BaseBillingEntities,
|
|
30
|
-
BaseBillingDtos,
|
|
31
|
-
BillingPortalMappers,
|
|
32
|
-
BaseCheckoutSessionEntities,
|
|
33
|
-
BaseCheckoutSessionDtos,
|
|
34
|
-
CheckoutSessionMappers,
|
|
35
|
-
BasePaymentLinkEntities,
|
|
36
|
-
BasePaymentLinkDtos,
|
|
37
|
-
PaymentLinkMappers,
|
|
38
|
-
BasePlanEntities,
|
|
39
|
-
BasePlanDtos,
|
|
40
|
-
PlanMappers,
|
|
41
|
-
BaseSubscriptionEntities,
|
|
42
|
-
BaseSubscriptionDtos,
|
|
43
|
-
SubscriptionMappers
|
|
44
|
-
} from '../domain/types/index.js';
|
|
8
|
+
import { BaseBillingEntities, BaseBillingDtos, BillingPortalMappers, BaseCheckoutSessionEntities, BaseCheckoutSessionDtos, CheckoutSessionMappers, BasePaymentLinkEntities, BasePaymentLinkDtos, PaymentLinkMappers, BasePlanEntities, BasePlanDtos, PlanMappers, BaseSubscriptionEntities, BaseSubscriptionDtos, SubscriptionMappers } from '../domain/types/index.js';
|
|
45
9
|
|
|
46
|
-
declare class BaseBillingPortalService<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
schemaValidator: SchemaValidator,
|
|
64
|
-
mappers: BillingPortalMappers<MapperEntities, MapperDomains>,
|
|
65
|
-
options?: {
|
|
66
|
-
telemetry?: TelemetryOptions;
|
|
67
|
-
enableDatabaseBackup?: boolean;
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
protected createCacheKey: (id: string) => string;
|
|
71
|
-
createBillingPortalSession(
|
|
72
|
-
billingPortalDto: CreateBillingPortalDto,
|
|
73
|
-
...args: unknown[]
|
|
74
|
-
): Promise<MapperDomains['BillingPortalMapper']>;
|
|
75
|
-
getBillingPortalSession(
|
|
76
|
-
idDto: IdDto
|
|
77
|
-
): Promise<MapperDomains['BillingPortalMapper']>;
|
|
78
|
-
updateBillingPortalSession(
|
|
79
|
-
billingPortalDto: UpdateBillingPortalDto,
|
|
80
|
-
...args: unknown[]
|
|
81
|
-
): Promise<MapperDomains['BillingPortalMapper']>;
|
|
82
|
-
expireBillingPortalSession(idDto: IdDto): Promise<void>;
|
|
10
|
+
declare class BaseBillingPortalService<SchemaValidator extends AnySchemaValidator, MapperEntities extends BaseBillingEntities, MapperDomains extends BaseBillingDtos = BaseBillingDtos> implements BillingPortalService {
|
|
11
|
+
private evaluatedTelemetryOptions;
|
|
12
|
+
protected enableDatabaseBackup: boolean;
|
|
13
|
+
em: EntityManager;
|
|
14
|
+
protected cache: TtlCache;
|
|
15
|
+
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
16
|
+
protected schemaValidator: SchemaValidator;
|
|
17
|
+
protected mappers: BillingPortalMappers<MapperEntities, MapperDomains>;
|
|
18
|
+
constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: BillingPortalMappers<MapperEntities, MapperDomains>, options?: {
|
|
19
|
+
telemetry?: TelemetryOptions;
|
|
20
|
+
enableDatabaseBackup?: boolean;
|
|
21
|
+
});
|
|
22
|
+
protected createCacheKey: (id: string) => string;
|
|
23
|
+
createBillingPortalSession(billingPortalDto: CreateBillingPortalDto, ...args: unknown[]): Promise<MapperDomains['BillingPortalMapper']>;
|
|
24
|
+
getBillingPortalSession(idDto: IdDto): Promise<MapperDomains['BillingPortalMapper']>;
|
|
25
|
+
updateBillingPortalSession(billingPortalDto: UpdateBillingPortalDto, ...args: unknown[]): Promise<MapperDomains['BillingPortalMapper']>;
|
|
26
|
+
expireBillingPortalSession(idDto: IdDto): Promise<void>;
|
|
83
27
|
}
|
|
84
28
|
|
|
85
|
-
declare class BaseCheckoutSessionService<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
CurrencyEnum,
|
|
93
|
-
StatusEnum
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
StatusEnum
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
protected enableDatabaseBackup: boolean;
|
|
104
|
-
em: EntityManager;
|
|
105
|
-
protected cache: TtlCache;
|
|
106
|
-
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
107
|
-
protected schemaValidator: SchemaValidator;
|
|
108
|
-
protected mappers: CheckoutSessionMappers<
|
|
109
|
-
PaymentMethodEnum,
|
|
110
|
-
CurrencyEnum,
|
|
111
|
-
StatusEnum,
|
|
112
|
-
MapperEntities,
|
|
113
|
-
MapperDomains
|
|
114
|
-
>;
|
|
115
|
-
constructor(
|
|
116
|
-
em: EntityManager,
|
|
117
|
-
cache: TtlCache,
|
|
118
|
-
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
119
|
-
schemaValidator: SchemaValidator,
|
|
120
|
-
mappers: CheckoutSessionMappers<
|
|
121
|
-
PaymentMethodEnum,
|
|
122
|
-
CurrencyEnum,
|
|
123
|
-
StatusEnum,
|
|
124
|
-
MapperEntities,
|
|
125
|
-
MapperDomains
|
|
126
|
-
>,
|
|
127
|
-
options?: {
|
|
128
|
-
telemetry?: TelemetryOptions;
|
|
129
|
-
enableDatabaseBackup?: boolean;
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
protected createCacheKey: (id: string) => string;
|
|
133
|
-
createCheckoutSession(
|
|
134
|
-
checkoutSessionDto: CreateCheckoutSessionDto<
|
|
135
|
-
PaymentMethodEnum,
|
|
136
|
-
CurrencyEnum,
|
|
137
|
-
StatusEnum
|
|
138
|
-
>,
|
|
139
|
-
...args: unknown[]
|
|
140
|
-
): Promise<MapperDomains['CheckoutSessionMapper']>;
|
|
141
|
-
getCheckoutSession({
|
|
142
|
-
id
|
|
143
|
-
}: IdDto): Promise<MapperDomains['CheckoutSessionMapper']>;
|
|
144
|
-
expireCheckoutSession({ id }: IdDto): Promise<void>;
|
|
145
|
-
handleCheckoutSuccess({ id }: IdDto): Promise<void>;
|
|
146
|
-
handleCheckoutFailure({ id }: IdDto): Promise<void>;
|
|
29
|
+
declare class BaseCheckoutSessionService<SchemaValidator extends AnySchemaValidator, PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> implements CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum> {
|
|
30
|
+
private evaluatedTelemetryOptions;
|
|
31
|
+
protected enableDatabaseBackup: boolean;
|
|
32
|
+
em: EntityManager;
|
|
33
|
+
protected cache: TtlCache;
|
|
34
|
+
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
35
|
+
protected schemaValidator: SchemaValidator;
|
|
36
|
+
protected mappers: CheckoutSessionMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities, MapperDomains>;
|
|
37
|
+
constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: CheckoutSessionMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities, MapperDomains>, options?: {
|
|
38
|
+
telemetry?: TelemetryOptions;
|
|
39
|
+
enableDatabaseBackup?: boolean;
|
|
40
|
+
});
|
|
41
|
+
protected createCacheKey: (id: string) => string;
|
|
42
|
+
createCheckoutSession(checkoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>, ...args: unknown[]): Promise<MapperDomains['CheckoutSessionMapper']>;
|
|
43
|
+
getCheckoutSession({ id }: IdDto): Promise<MapperDomains['CheckoutSessionMapper']>;
|
|
44
|
+
expireCheckoutSession({ id }: IdDto): Promise<void>;
|
|
45
|
+
handleCheckoutSuccess({ id }: IdDto): Promise<void>;
|
|
46
|
+
handleCheckoutFailure({ id }: IdDto): Promise<void>;
|
|
147
47
|
}
|
|
148
48
|
|
|
149
|
-
declare class BasePaymentLinkService<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
CurrencyEnum,
|
|
157
|
-
StatusEnum
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
171
|
-
protected schemaValidator: SchemaValidator;
|
|
172
|
-
protected mappers: PaymentLinkMappers<
|
|
173
|
-
PaymentMethodEnum,
|
|
174
|
-
CurrencyEnum,
|
|
175
|
-
StatusEnum,
|
|
176
|
-
MapperEntities,
|
|
177
|
-
MapperDomains
|
|
178
|
-
>;
|
|
179
|
-
constructor(
|
|
180
|
-
em: EntityManager,
|
|
181
|
-
cache: TtlCache,
|
|
182
|
-
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
183
|
-
schemaValidator: SchemaValidator,
|
|
184
|
-
mappers: PaymentLinkMappers<
|
|
185
|
-
PaymentMethodEnum,
|
|
186
|
-
CurrencyEnum,
|
|
187
|
-
StatusEnum,
|
|
188
|
-
MapperEntities,
|
|
189
|
-
MapperDomains
|
|
190
|
-
>,
|
|
191
|
-
options?: {
|
|
192
|
-
telemetry?: TelemetryOptions;
|
|
193
|
-
enableDatabaseBackup?: boolean;
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
protected cacheKeyPrefix: string;
|
|
197
|
-
protected createCacheKey: (id: string) => string;
|
|
198
|
-
createPaymentLink(
|
|
199
|
-
paymentLinkDto: CreatePaymentLinkDto<
|
|
200
|
-
PaymentMethodEnum,
|
|
201
|
-
CurrencyEnum,
|
|
202
|
-
StatusEnum
|
|
203
|
-
>,
|
|
204
|
-
...args: unknown[]
|
|
205
|
-
): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
206
|
-
updatePaymentLink(
|
|
207
|
-
paymentLinkDto: UpdatePaymentLinkDto<
|
|
208
|
-
PaymentMethodEnum,
|
|
209
|
-
CurrencyEnum,
|
|
210
|
-
StatusEnum
|
|
211
|
-
>,
|
|
212
|
-
...args: unknown[]
|
|
213
|
-
): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
214
|
-
getPaymentLink({ id }: IdDto): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
215
|
-
expirePaymentLink({ id }: IdDto): Promise<void>;
|
|
216
|
-
handlePaymentSuccess({ id }: IdDto): Promise<void>;
|
|
217
|
-
handlePaymentFailure({ id }: IdDto): Promise<void>;
|
|
218
|
-
listPaymentLinks(
|
|
219
|
-
idsDto?: IdsDto
|
|
220
|
-
): Promise<MapperDomains['PaymentLinkMapper'][]>;
|
|
49
|
+
declare class BasePaymentLinkService<SchemaValidator extends AnySchemaValidator, PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> implements PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum> {
|
|
50
|
+
private evaluatedTelemetryOptions;
|
|
51
|
+
protected enableDatabaseBackup: boolean;
|
|
52
|
+
em: EntityManager;
|
|
53
|
+
protected cache: TtlCache;
|
|
54
|
+
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
55
|
+
protected schemaValidator: SchemaValidator;
|
|
56
|
+
protected mappers: PaymentLinkMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities, MapperDomains>;
|
|
57
|
+
constructor(em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: PaymentLinkMappers<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities, MapperDomains>, options?: {
|
|
58
|
+
telemetry?: TelemetryOptions;
|
|
59
|
+
enableDatabaseBackup?: boolean;
|
|
60
|
+
});
|
|
61
|
+
protected cacheKeyPrefix: string;
|
|
62
|
+
protected createCacheKey: (id: string) => string;
|
|
63
|
+
createPaymentLink(paymentLinkDto: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>, ...args: unknown[]): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
64
|
+
updatePaymentLink(paymentLinkDto: UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>, ...args: unknown[]): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
65
|
+
getPaymentLink({ id }: IdDto): Promise<MapperDomains['PaymentLinkMapper']>;
|
|
66
|
+
expirePaymentLink({ id }: IdDto): Promise<void>;
|
|
67
|
+
handlePaymentSuccess({ id }: IdDto): Promise<void>;
|
|
68
|
+
handlePaymentFailure({ id }: IdDto): Promise<void>;
|
|
69
|
+
listPaymentLinks(idsDto?: IdsDto): Promise<MapperDomains['PaymentLinkMapper'][]>;
|
|
221
70
|
}
|
|
222
71
|
|
|
223
|
-
declare class BasePlanService<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
PlanCadenceEnum,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
CurrencyEnum,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
{
|
|
240
|
-
private evaluatedTelemetryOptions;
|
|
241
|
-
em: EntityManager;
|
|
242
|
-
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
243
|
-
protected schemaValidator: SchemaValidator;
|
|
244
|
-
protected mappers: PlanMappers<
|
|
245
|
-
PlanCadenceEnum,
|
|
246
|
-
CurrencyEnum,
|
|
247
|
-
BillingProviderEnum,
|
|
248
|
-
MapperEntities,
|
|
249
|
-
MapperDomains
|
|
250
|
-
>;
|
|
251
|
-
constructor(
|
|
252
|
-
em: EntityManager,
|
|
253
|
-
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
254
|
-
schemaValidator: SchemaValidator,
|
|
255
|
-
mappers: PlanMappers<
|
|
256
|
-
PlanCadenceEnum,
|
|
257
|
-
CurrencyEnum,
|
|
258
|
-
BillingProviderEnum,
|
|
259
|
-
MapperEntities,
|
|
260
|
-
MapperDomains
|
|
261
|
-
>,
|
|
262
|
-
options?: {
|
|
263
|
-
telemetry?: TelemetryOptions;
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
listPlans(
|
|
267
|
-
idsDto?: IdsDto,
|
|
268
|
-
em?: EntityManager
|
|
269
|
-
): Promise<MapperDomains['PlanMapper'][]>;
|
|
270
|
-
createPlan(
|
|
271
|
-
planDto: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>,
|
|
272
|
-
em?: EntityManager,
|
|
273
|
-
...args: unknown[]
|
|
274
|
-
): Promise<MapperDomains['PlanMapper']>;
|
|
275
|
-
getPlan(
|
|
276
|
-
idDto: IdDto,
|
|
277
|
-
em?: EntityManager
|
|
278
|
-
): Promise<MapperDomains['PlanMapper']>;
|
|
279
|
-
updatePlan(
|
|
280
|
-
planDto: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>,
|
|
281
|
-
em?: EntityManager,
|
|
282
|
-
...args: unknown[]
|
|
283
|
-
): Promise<MapperDomains['PlanMapper']>;
|
|
284
|
-
deletePlan(
|
|
285
|
-
idDto: {
|
|
286
|
-
id: string;
|
|
287
|
-
},
|
|
288
|
-
em?: EntityManager
|
|
289
|
-
): Promise<void>;
|
|
72
|
+
declare class BasePlanService<SchemaValidator extends AnySchemaValidator, PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, MapperEntities extends BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, MapperDomains extends BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> implements PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> {
|
|
73
|
+
private evaluatedTelemetryOptions;
|
|
74
|
+
em: EntityManager;
|
|
75
|
+
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
76
|
+
protected schemaValidator: SchemaValidator;
|
|
77
|
+
protected mappers: PlanMappers<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, MapperEntities, MapperDomains>;
|
|
78
|
+
constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: PlanMappers<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, MapperEntities, MapperDomains>, options?: {
|
|
79
|
+
telemetry?: TelemetryOptions;
|
|
80
|
+
});
|
|
81
|
+
listPlans(idsDto?: IdsDto, em?: EntityManager): Promise<MapperDomains['PlanMapper'][]>;
|
|
82
|
+
createPlan(planDto: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, em?: EntityManager, ...args: unknown[]): Promise<MapperDomains['PlanMapper']>;
|
|
83
|
+
getPlan(idDto: IdDto, em?: EntityManager): Promise<MapperDomains['PlanMapper']>;
|
|
84
|
+
updatePlan(planDto: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, em?: EntityManager, ...args: unknown[]): Promise<MapperDomains['PlanMapper']>;
|
|
85
|
+
deletePlan(idDto: {
|
|
86
|
+
id: string;
|
|
87
|
+
}, em?: EntityManager): Promise<void>;
|
|
290
88
|
}
|
|
291
89
|
|
|
292
|
-
declare class BaseSubscriptionService<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
90
|
+
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> {
|
|
91
|
+
readonly options?: {
|
|
92
|
+
telemetry?: TelemetryOptions;
|
|
93
|
+
} | undefined;
|
|
94
|
+
protected evaluatedTelemetryOptions: {
|
|
95
|
+
logging?: boolean;
|
|
96
|
+
metrics?: boolean;
|
|
97
|
+
tracing?: boolean;
|
|
98
|
+
};
|
|
99
|
+
protected em: EntityManager;
|
|
100
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
101
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
102
|
+
protected readonly mappers: SubscriptionMappers<PartyType, BillingProviderType, Entities, Dto>;
|
|
103
|
+
constructor(em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: SubscriptionMappers<PartyType, BillingProviderType, Entities, Dto>, options?: {
|
|
305
104
|
telemetry?: TelemetryOptions;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
Dto
|
|
321
|
-
>;
|
|
322
|
-
constructor(
|
|
323
|
-
em: EntityManager,
|
|
324
|
-
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
325
|
-
schemaValidator: SchemaValidator,
|
|
326
|
-
mappers: SubscriptionMappers<PartyType, BillingProviderType, Entities, Dto>,
|
|
327
|
-
options?:
|
|
328
|
-
| {
|
|
329
|
-
telemetry?: TelemetryOptions;
|
|
330
|
-
}
|
|
331
|
-
| undefined
|
|
332
|
-
);
|
|
333
|
-
createSubscription(
|
|
334
|
-
subscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>,
|
|
335
|
-
em?: EntityManager,
|
|
336
|
-
...args: unknown[]
|
|
337
|
-
): Promise<Dto['SubscriptionMapper']>;
|
|
338
|
-
getSubscription(
|
|
339
|
-
idDto: IdDto,
|
|
340
|
-
em?: EntityManager
|
|
341
|
-
): Promise<Dto['SubscriptionMapper']>;
|
|
342
|
-
getUserSubscription(
|
|
343
|
-
{ id }: IdDto,
|
|
344
|
-
em?: EntityManager
|
|
345
|
-
): Promise<Dto['SubscriptionMapper']>;
|
|
346
|
-
getOrganizationSubscription(
|
|
347
|
-
{ id }: IdDto,
|
|
348
|
-
em?: EntityManager
|
|
349
|
-
): Promise<Dto['SubscriptionMapper']>;
|
|
350
|
-
updateSubscription(
|
|
351
|
-
subscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>,
|
|
352
|
-
em?: EntityManager,
|
|
353
|
-
...args: unknown[]
|
|
354
|
-
): Promise<Dto['SubscriptionMapper']>;
|
|
355
|
-
deleteSubscription(
|
|
356
|
-
idDto: {
|
|
357
|
-
id: string;
|
|
358
|
-
},
|
|
359
|
-
em?: EntityManager
|
|
360
|
-
): Promise<void>;
|
|
361
|
-
listSubscriptions(
|
|
362
|
-
idsDto: {
|
|
363
|
-
ids?: string[];
|
|
364
|
-
},
|
|
365
|
-
em?: EntityManager
|
|
366
|
-
): Promise<Dto['SubscriptionMapper'][]>;
|
|
367
|
-
cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
368
|
-
resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
105
|
+
} | undefined);
|
|
106
|
+
createSubscription(subscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>, em?: EntityManager, ...args: unknown[]): Promise<Dto['SubscriptionMapper']>;
|
|
107
|
+
getSubscription(idDto: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
|
|
108
|
+
getUserSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
|
|
109
|
+
getOrganizationSubscription({ id }: IdDto, em?: EntityManager): Promise<Dto['SubscriptionMapper']>;
|
|
110
|
+
updateSubscription(subscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>, em?: EntityManager, ...args: unknown[]): Promise<Dto['SubscriptionMapper']>;
|
|
111
|
+
deleteSubscription(idDto: {
|
|
112
|
+
id: string;
|
|
113
|
+
}, em?: EntityManager): Promise<void>;
|
|
114
|
+
listSubscriptions(idsDto: {
|
|
115
|
+
ids?: string[];
|
|
116
|
+
}, em?: EntityManager): Promise<Dto['SubscriptionMapper'][]>;
|
|
117
|
+
cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
118
|
+
resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void>;
|
|
369
119
|
}
|
|
370
120
|
|
|
371
|
-
export {
|
|
372
|
-
BaseBillingPortalService,
|
|
373
|
-
BaseCheckoutSessionService,
|
|
374
|
-
BasePaymentLinkService,
|
|
375
|
-
BasePlanService,
|
|
376
|
-
BaseSubscriptionService
|
|
377
|
-
};
|
|
121
|
+
export { BaseBillingPortalService, BaseCheckoutSessionService, BasePaymentLinkService, BasePlanService, BaseSubscriptionService };
|