@forklaunch/implementation-billing-stripe 0.1.0 → 0.2.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.
- package/lib/eject/services/billingPortal.service.ts +44 -6
- package/lib/eject/services/checkoutSession.service.ts +44 -6
- package/lib/eject/services/paymentLink.service.ts +45 -8
- package/lib/eject/services/plan.service.ts +41 -5
- package/lib/eject/services/subscription.service.ts +41 -5
- package/lib/eject/services/webhook.service.ts +48 -13
- package/lib/services/index.d.mts +33 -33
- package/lib/services/index.d.ts +33 -33
- package/lib/services/index.js +42 -5
- package/lib/services/index.mjs +42 -5
- package/package.json +12 -12
|
@@ -46,14 +46,46 @@ export class StripeBillingPortalService<
|
|
|
46
46
|
Entities
|
|
47
47
|
>;
|
|
48
48
|
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
49
|
+
protected stripeClient: Stripe;
|
|
50
|
+
protected em: EntityManager;
|
|
51
|
+
protected cache: TtlCache;
|
|
52
|
+
protected openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
53
|
+
protected schemaValidator: SchemaValidator;
|
|
54
|
+
protected mappers: {
|
|
55
|
+
BillingPortalMapper: ResponseMapperConstructor<
|
|
56
|
+
SchemaValidator,
|
|
57
|
+
Dto['BillingPortalMapper'],
|
|
58
|
+
Entities['BillingPortalMapper']
|
|
59
|
+
>;
|
|
60
|
+
CreateBillingPortalMapper: RequestMapperConstructor<
|
|
61
|
+
SchemaValidator,
|
|
62
|
+
Dto['CreateBillingPortalMapper'],
|
|
63
|
+
Entities['CreateBillingPortalMapper'],
|
|
64
|
+
(
|
|
65
|
+
dto: Dto['CreateBillingPortalMapper'],
|
|
66
|
+
em: EntityManager,
|
|
67
|
+
session: Stripe.BillingPortal.Session
|
|
68
|
+
) => Promise<Entities['CreateBillingPortalMapper']>
|
|
69
|
+
>;
|
|
70
|
+
UpdateBillingPortalMapper: RequestMapperConstructor<
|
|
71
|
+
SchemaValidator,
|
|
72
|
+
Dto['UpdateBillingPortalMapper'],
|
|
73
|
+
Entities['UpdateBillingPortalMapper'],
|
|
74
|
+
(
|
|
75
|
+
dto: Dto['UpdateBillingPortalMapper'],
|
|
76
|
+
em: EntityManager,
|
|
77
|
+
session: Stripe.BillingPortal.Session
|
|
78
|
+
) => Promise<Entities['UpdateBillingPortalMapper']>
|
|
79
|
+
>;
|
|
80
|
+
};
|
|
49
81
|
|
|
50
82
|
constructor(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
83
|
+
stripeClient: Stripe,
|
|
84
|
+
em: EntityManager,
|
|
85
|
+
cache: TtlCache,
|
|
86
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
87
|
+
schemaValidator: SchemaValidator,
|
|
88
|
+
mappers: {
|
|
57
89
|
BillingPortalMapper: ResponseMapperConstructor<
|
|
58
90
|
SchemaValidator,
|
|
59
91
|
Dto['BillingPortalMapper'],
|
|
@@ -85,6 +117,12 @@ export class StripeBillingPortalService<
|
|
|
85
117
|
enableDatabaseBackup?: boolean;
|
|
86
118
|
}
|
|
87
119
|
) {
|
|
120
|
+
this.stripeClient = stripeClient;
|
|
121
|
+
this.em = em;
|
|
122
|
+
this.cache = cache;
|
|
123
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
124
|
+
this.schemaValidator = schemaValidator;
|
|
125
|
+
this.mappers = mappers;
|
|
88
126
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
89
127
|
this.baseBillingPortalService = new BaseBillingPortalService(
|
|
90
128
|
em,
|
|
@@ -50,14 +50,46 @@ export class StripeCheckoutSessionService<
|
|
|
50
50
|
Entities
|
|
51
51
|
>;
|
|
52
52
|
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
53
|
+
protected readonly stripeClient: Stripe;
|
|
54
|
+
protected readonly em: EntityManager;
|
|
55
|
+
protected readonly cache: TtlCache;
|
|
56
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
57
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
58
|
+
protected readonly mappers: {
|
|
59
|
+
CheckoutSessionMapper: ResponseMapperConstructor<
|
|
60
|
+
SchemaValidator,
|
|
61
|
+
Dto['CheckoutSessionMapper'],
|
|
62
|
+
Entities['CheckoutSessionMapper']
|
|
63
|
+
>;
|
|
64
|
+
CreateCheckoutSessionMapper: RequestMapperConstructor<
|
|
65
|
+
SchemaValidator,
|
|
66
|
+
Dto['CreateCheckoutSessionMapper'],
|
|
67
|
+
Entities['CreateCheckoutSessionMapper'],
|
|
68
|
+
(
|
|
69
|
+
dto: Dto['CreateCheckoutSessionMapper'],
|
|
70
|
+
em: EntityManager,
|
|
71
|
+
session: Stripe.Checkout.Session
|
|
72
|
+
) => Promise<Entities['CreateCheckoutSessionMapper']>
|
|
73
|
+
>;
|
|
74
|
+
UpdateCheckoutSessionMapper: RequestMapperConstructor<
|
|
75
|
+
SchemaValidator,
|
|
76
|
+
Dto['UpdateCheckoutSessionMapper'],
|
|
77
|
+
Entities['UpdateCheckoutSessionMapper'],
|
|
78
|
+
(
|
|
79
|
+
dto: Dto['UpdateCheckoutSessionMapper'],
|
|
80
|
+
em: EntityManager,
|
|
81
|
+
session: Stripe.Checkout.Session
|
|
82
|
+
) => Promise<Entities['UpdateCheckoutSessionMapper']>
|
|
83
|
+
>;
|
|
84
|
+
};
|
|
53
85
|
|
|
54
86
|
constructor(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
87
|
+
stripeClient: Stripe,
|
|
88
|
+
em: EntityManager,
|
|
89
|
+
cache: TtlCache,
|
|
90
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
91
|
+
schemaValidator: SchemaValidator,
|
|
92
|
+
mappers: {
|
|
61
93
|
CheckoutSessionMapper: ResponseMapperConstructor<
|
|
62
94
|
SchemaValidator,
|
|
63
95
|
Dto['CheckoutSessionMapper'],
|
|
@@ -89,6 +121,12 @@ export class StripeCheckoutSessionService<
|
|
|
89
121
|
telemetry?: TelemetryOptions;
|
|
90
122
|
}
|
|
91
123
|
) {
|
|
124
|
+
this.stripeClient = stripeClient;
|
|
125
|
+
this.em = em;
|
|
126
|
+
this.cache = cache;
|
|
127
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
128
|
+
this.schemaValidator = schemaValidator;
|
|
129
|
+
this.mappers = mappers;
|
|
92
130
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
93
131
|
this.baseCheckoutSessionService = new BaseCheckoutSessionService(
|
|
94
132
|
em,
|
|
@@ -18,8 +18,7 @@ import {
|
|
|
18
18
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
19
19
|
import { EntityManager } from '@mikro-orm/core';
|
|
20
20
|
import Stripe from 'stripe';
|
|
21
|
-
import { CurrencyEnum } from '../domain/enum
|
|
22
|
-
import { PaymentMethodEnum } from '../domain/enum/paymentMethod.enum';
|
|
21
|
+
import { CurrencyEnum, PaymentMethodEnum } from '../domain/enum';
|
|
23
22
|
import {
|
|
24
23
|
StripeCreatePaymentLinkDto,
|
|
25
24
|
StripePaymentLinkDto,
|
|
@@ -57,14 +56,46 @@ export class StripePaymentLinkService<
|
|
|
57
56
|
Entities
|
|
58
57
|
>;
|
|
59
58
|
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
59
|
+
protected readonly stripeClient: Stripe;
|
|
60
|
+
protected readonly em: EntityManager;
|
|
61
|
+
protected readonly cache: TtlCache;
|
|
62
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
63
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
64
|
+
protected readonly mappers: {
|
|
65
|
+
PaymentLinkMapper: ResponseMapperConstructor<
|
|
66
|
+
SchemaValidator,
|
|
67
|
+
Dto['PaymentLinkMapper'],
|
|
68
|
+
Entities['PaymentLinkMapper']
|
|
69
|
+
>;
|
|
70
|
+
CreatePaymentLinkMapper: RequestMapperConstructor<
|
|
71
|
+
SchemaValidator,
|
|
72
|
+
Dto['CreatePaymentLinkMapper'],
|
|
73
|
+
Entities['CreatePaymentLinkMapper'],
|
|
74
|
+
(
|
|
75
|
+
dto: Dto['CreatePaymentLinkMapper'],
|
|
76
|
+
em: EntityManager,
|
|
77
|
+
paymentLink: Stripe.PaymentLink
|
|
78
|
+
) => Promise<Entities['CreatePaymentLinkMapper']>
|
|
79
|
+
>;
|
|
80
|
+
UpdatePaymentLinkMapper: RequestMapperConstructor<
|
|
81
|
+
SchemaValidator,
|
|
82
|
+
Dto['UpdatePaymentLinkMapper'],
|
|
83
|
+
Entities['UpdatePaymentLinkMapper'],
|
|
84
|
+
(
|
|
85
|
+
dto: Dto['UpdatePaymentLinkMapper'],
|
|
86
|
+
em: EntityManager,
|
|
87
|
+
paymentLink: Stripe.PaymentLink
|
|
88
|
+
) => Promise<Entities['UpdatePaymentLinkMapper']>
|
|
89
|
+
>;
|
|
90
|
+
};
|
|
60
91
|
|
|
61
92
|
constructor(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
93
|
+
stripeClient: Stripe,
|
|
94
|
+
em: EntityManager,
|
|
95
|
+
cache: TtlCache,
|
|
96
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
97
|
+
schemaValidator: SchemaValidator,
|
|
98
|
+
mappers: {
|
|
68
99
|
PaymentLinkMapper: ResponseMapperConstructor<
|
|
69
100
|
SchemaValidator,
|
|
70
101
|
Dto['PaymentLinkMapper'],
|
|
@@ -96,6 +127,12 @@ export class StripePaymentLinkService<
|
|
|
96
127
|
telemetry?: TelemetryOptions;
|
|
97
128
|
}
|
|
98
129
|
) {
|
|
130
|
+
this.stripeClient = stripeClient;
|
|
131
|
+
this.em = em;
|
|
132
|
+
this.cache = cache;
|
|
133
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
134
|
+
this.schemaValidator = schemaValidator;
|
|
135
|
+
this.mappers = mappers;
|
|
99
136
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
100
137
|
this.basePaymentLinkService = new BasePaymentLinkService(
|
|
101
138
|
em,
|
|
@@ -55,13 +55,44 @@ export class StripePlanService<
|
|
|
55
55
|
Entities
|
|
56
56
|
>;
|
|
57
57
|
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
58
|
+
protected readonly stripeClient: Stripe;
|
|
59
|
+
protected readonly em: EntityManager;
|
|
60
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
61
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
62
|
+
protected readonly mappers: {
|
|
63
|
+
PlanMapper: ResponseMapperConstructor<
|
|
64
|
+
SchemaValidator,
|
|
65
|
+
Dto['PlanMapper'],
|
|
66
|
+
Entities['PlanMapper']
|
|
67
|
+
>;
|
|
68
|
+
CreatePlanMapper: RequestMapperConstructor<
|
|
69
|
+
SchemaValidator,
|
|
70
|
+
Dto['CreatePlanMapper'],
|
|
71
|
+
Entities['CreatePlanMapper'],
|
|
72
|
+
(
|
|
73
|
+
dto: Dto['CreatePlanMapper'],
|
|
74
|
+
em: EntityManager,
|
|
75
|
+
plan: Stripe.Plan
|
|
76
|
+
) => Promise<Entities['CreatePlanMapper']>
|
|
77
|
+
>;
|
|
78
|
+
UpdatePlanMapper: RequestMapperConstructor<
|
|
79
|
+
SchemaValidator,
|
|
80
|
+
Dto['UpdatePlanMapper'],
|
|
81
|
+
Entities['UpdatePlanMapper'],
|
|
82
|
+
(
|
|
83
|
+
dto: Dto['UpdatePlanMapper'],
|
|
84
|
+
em: EntityManager,
|
|
85
|
+
plan: Stripe.Plan
|
|
86
|
+
) => Promise<Entities['UpdatePlanMapper']>
|
|
87
|
+
>;
|
|
88
|
+
};
|
|
58
89
|
|
|
59
90
|
constructor(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
stripeClient: Stripe,
|
|
92
|
+
em: EntityManager,
|
|
93
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
94
|
+
schemaValidator: SchemaValidator,
|
|
95
|
+
mappers: {
|
|
65
96
|
PlanMapper: ResponseMapperConstructor<
|
|
66
97
|
SchemaValidator,
|
|
67
98
|
Dto['PlanMapper'],
|
|
@@ -93,6 +124,11 @@ export class StripePlanService<
|
|
|
93
124
|
databaseTableName?: string;
|
|
94
125
|
}
|
|
95
126
|
) {
|
|
127
|
+
this.stripeClient = stripeClient;
|
|
128
|
+
this.em = em;
|
|
129
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
130
|
+
this.schemaValidator = schemaValidator;
|
|
131
|
+
this.mappers = mappers;
|
|
96
132
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
97
133
|
this.basePlanService = new BasePlanService(
|
|
98
134
|
em,
|
|
@@ -53,13 +53,44 @@ export class StripeSubscriptionService<
|
|
|
53
53
|
Entities
|
|
54
54
|
>;
|
|
55
55
|
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
56
|
+
protected readonly stripe: Stripe;
|
|
57
|
+
protected readonly em: EntityManager;
|
|
58
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
59
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
60
|
+
protected readonly mappers: {
|
|
61
|
+
SubscriptionMapper: ResponseMapperConstructor<
|
|
62
|
+
SchemaValidator,
|
|
63
|
+
Dto['SubscriptionMapper'],
|
|
64
|
+
Entities['SubscriptionMapper']
|
|
65
|
+
>;
|
|
66
|
+
CreateSubscriptionMapper: RequestMapperConstructor<
|
|
67
|
+
SchemaValidator,
|
|
68
|
+
Dto['CreateSubscriptionMapper'],
|
|
69
|
+
Entities['CreateSubscriptionMapper'],
|
|
70
|
+
(
|
|
71
|
+
dto: Dto['CreateSubscriptionMapper'],
|
|
72
|
+
em: EntityManager,
|
|
73
|
+
subscription: Stripe.Subscription
|
|
74
|
+
) => Promise<Entities['CreateSubscriptionMapper']>
|
|
75
|
+
>;
|
|
76
|
+
UpdateSubscriptionMapper: RequestMapperConstructor<
|
|
77
|
+
SchemaValidator,
|
|
78
|
+
Dto['UpdateSubscriptionMapper'],
|
|
79
|
+
Entities['UpdateSubscriptionMapper'],
|
|
80
|
+
(
|
|
81
|
+
dto: Dto['UpdateSubscriptionMapper'],
|
|
82
|
+
em: EntityManager,
|
|
83
|
+
subscription: Stripe.Subscription
|
|
84
|
+
) => Promise<Entities['UpdateSubscriptionMapper']>
|
|
85
|
+
>;
|
|
86
|
+
};
|
|
56
87
|
|
|
57
88
|
constructor(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
stripe: Stripe,
|
|
90
|
+
em: EntityManager,
|
|
91
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
92
|
+
schemaValidator: SchemaValidator,
|
|
93
|
+
mappers: {
|
|
63
94
|
SubscriptionMapper: ResponseMapperConstructor<
|
|
64
95
|
SchemaValidator,
|
|
65
96
|
Dto['SubscriptionMapper'],
|
|
@@ -91,6 +122,11 @@ export class StripeSubscriptionService<
|
|
|
91
122
|
databaseTableName?: string;
|
|
92
123
|
}
|
|
93
124
|
) {
|
|
125
|
+
this.stripe = stripe;
|
|
126
|
+
this.em = em;
|
|
127
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
128
|
+
this.schemaValidator = schemaValidator;
|
|
129
|
+
this.mappers = mappers;
|
|
94
130
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
95
131
|
this.baseSubscriptionService = new BaseSubscriptionService(
|
|
96
132
|
em,
|
|
@@ -36,35 +36,70 @@ export class StripeWebhookService<
|
|
|
36
36
|
SubscriptionEntities extends
|
|
37
37
|
StripeSubscriptionEntities<PartyEnum> = StripeSubscriptionEntities<PartyEnum>
|
|
38
38
|
> {
|
|
39
|
+
protected readonly stripeClient: Stripe;
|
|
40
|
+
protected readonly em: EntityManager;
|
|
41
|
+
protected readonly schemaValidator: SchemaValidator;
|
|
42
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
43
|
+
protected readonly billingPortalService: StripeBillingPortalService<
|
|
44
|
+
SchemaValidator,
|
|
45
|
+
BillingPortalEntities
|
|
46
|
+
>;
|
|
47
|
+
protected readonly checkoutSessionService: StripeCheckoutSessionService<
|
|
48
|
+
SchemaValidator,
|
|
49
|
+
StatusEnum,
|
|
50
|
+
CheckoutSessionEntities
|
|
51
|
+
>;
|
|
52
|
+
protected readonly paymentLinkService: StripePaymentLinkService<
|
|
53
|
+
SchemaValidator,
|
|
54
|
+
StatusEnum,
|
|
55
|
+
PaymentLinkEntities
|
|
56
|
+
>;
|
|
57
|
+
protected readonly planService: StripePlanService<
|
|
58
|
+
SchemaValidator,
|
|
59
|
+
PlanEntities
|
|
60
|
+
>;
|
|
61
|
+
protected readonly subscriptionService: StripeSubscriptionService<
|
|
62
|
+
SchemaValidator,
|
|
63
|
+
PartyEnum,
|
|
64
|
+
SubscriptionEntities
|
|
65
|
+
>;
|
|
66
|
+
|
|
39
67
|
constructor(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
68
|
+
stripeClient: Stripe,
|
|
69
|
+
em: EntityManager,
|
|
70
|
+
schemaValidator: SchemaValidator,
|
|
71
|
+
openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>,
|
|
72
|
+
billingPortalService: StripeBillingPortalService<
|
|
45
73
|
SchemaValidator,
|
|
46
74
|
BillingPortalEntities
|
|
47
75
|
>,
|
|
48
|
-
|
|
76
|
+
checkoutSessionService: StripeCheckoutSessionService<
|
|
49
77
|
SchemaValidator,
|
|
50
78
|
StatusEnum,
|
|
51
79
|
CheckoutSessionEntities
|
|
52
80
|
>,
|
|
53
|
-
|
|
81
|
+
paymentLinkService: StripePaymentLinkService<
|
|
54
82
|
SchemaValidator,
|
|
55
83
|
StatusEnum,
|
|
56
84
|
PaymentLinkEntities
|
|
57
85
|
>,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
PlanEntities
|
|
61
|
-
>,
|
|
62
|
-
protected readonly subscriptionService: StripeSubscriptionService<
|
|
86
|
+
planService: StripePlanService<SchemaValidator, PlanEntities>,
|
|
87
|
+
subscriptionService: StripeSubscriptionService<
|
|
63
88
|
SchemaValidator,
|
|
64
89
|
PartyEnum,
|
|
65
90
|
SubscriptionEntities
|
|
66
91
|
>
|
|
67
|
-
) {
|
|
92
|
+
) {
|
|
93
|
+
this.stripeClient = stripeClient;
|
|
94
|
+
this.em = em;
|
|
95
|
+
this.schemaValidator = schemaValidator;
|
|
96
|
+
this.openTelemetryCollector = openTelemetryCollector;
|
|
97
|
+
this.billingPortalService = billingPortalService;
|
|
98
|
+
this.checkoutSessionService = checkoutSessionService;
|
|
99
|
+
this.paymentLinkService = paymentLinkService;
|
|
100
|
+
this.planService = planService;
|
|
101
|
+
this.subscriptionService = subscriptionService;
|
|
102
|
+
}
|
|
68
103
|
|
|
69
104
|
async handleWebhookEvent(event: Stripe.Event): Promise<void> {
|
|
70
105
|
if (this.openTelemetryCollector) {
|
package/lib/services/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IdDto, InstanceTypeRecord, IdsDto } from '@forklaunch/common';
|
|
2
2
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
3
|
-
import { OpenTelemetryCollector, MetricsDefinition
|
|
3
|
+
import { TelemetryOptions, OpenTelemetryCollector, MetricsDefinition } from '@forklaunch/core/http';
|
|
4
4
|
import { BaseBillingPortalService, BaseCheckoutSessionService, BasePaymentLinkService, BasePlanService, BaseSubscriptionService } from '@forklaunch/implementation-billing-base/services';
|
|
5
5
|
import { BillingPortalService, CheckoutSessionService, PaymentLinkService, PlanService, SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
|
|
6
|
-
import { ResponseMapperConstructor, RequestMapperConstructor
|
|
6
|
+
import { InternalMapper, ResponseMapperConstructor, RequestMapperConstructor } from '@forklaunch/internal';
|
|
7
7
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
8
8
|
import { EntityManager } from '@mikro-orm/core';
|
|
9
9
|
import Stripe__default from 'stripe';
|
|
@@ -17,6 +17,13 @@ declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValida
|
|
|
17
17
|
BillingPortalDto: StripeBillingPortalDto;
|
|
18
18
|
IdDto: IdDto;
|
|
19
19
|
}> {
|
|
20
|
+
readonly options?: {
|
|
21
|
+
telemetry?: TelemetryOptions;
|
|
22
|
+
enableDatabaseBackup?: boolean;
|
|
23
|
+
} | undefined;
|
|
24
|
+
private readonly billingPortalSessionExpiryDurationMs;
|
|
25
|
+
baseBillingPortalService: BaseBillingPortalService<SchemaValidator, Entities, Entities>;
|
|
26
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
20
27
|
protected stripeClient: Stripe__default;
|
|
21
28
|
protected em: EntityManager;
|
|
22
29
|
protected cache: TtlCache;
|
|
@@ -27,13 +34,6 @@ declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValida
|
|
|
27
34
|
CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['CreateBillingPortalMapper']>>;
|
|
28
35
|
UpdateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalMapper'], Entities['UpdateBillingPortalMapper'], (dto: Dto['UpdateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['UpdateBillingPortalMapper']>>;
|
|
29
36
|
};
|
|
30
|
-
readonly options?: {
|
|
31
|
-
telemetry?: TelemetryOptions;
|
|
32
|
-
enableDatabaseBackup?: boolean;
|
|
33
|
-
} | undefined;
|
|
34
|
-
private readonly billingPortalSessionExpiryDurationMs;
|
|
35
|
-
baseBillingPortalService: BaseBillingPortalService<SchemaValidator, Entities, Entities>;
|
|
36
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
37
37
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
38
38
|
BillingPortalMapper: ResponseMapperConstructor<SchemaValidator, Dto['BillingPortalMapper'], Entities['BillingPortalMapper']>;
|
|
39
39
|
CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['CreateBillingPortalMapper']>>;
|
|
@@ -53,6 +53,12 @@ declare class StripeCheckoutSessionService<SchemaValidator extends AnySchemaVali
|
|
|
53
53
|
CheckoutSessionDto: Dto['CheckoutSessionMapper'];
|
|
54
54
|
IdDto: IdDto;
|
|
55
55
|
}> {
|
|
56
|
+
readonly options?: {
|
|
57
|
+
enableDatabaseBackup?: boolean;
|
|
58
|
+
telemetry?: TelemetryOptions;
|
|
59
|
+
} | undefined;
|
|
60
|
+
baseCheckoutSessionService: BaseCheckoutSessionService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
61
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
56
62
|
protected readonly stripeClient: Stripe__default;
|
|
57
63
|
protected readonly em: EntityManager;
|
|
58
64
|
protected readonly cache: TtlCache;
|
|
@@ -63,12 +69,6 @@ declare class StripeCheckoutSessionService<SchemaValidator extends AnySchemaVali
|
|
|
63
69
|
CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['CreateCheckoutSessionMapper']>>;
|
|
64
70
|
UpdateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionMapper'], Entities['UpdateCheckoutSessionMapper'], (dto: Dto['UpdateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['UpdateCheckoutSessionMapper']>>;
|
|
65
71
|
};
|
|
66
|
-
readonly options?: {
|
|
67
|
-
enableDatabaseBackup?: boolean;
|
|
68
|
-
telemetry?: TelemetryOptions;
|
|
69
|
-
} | undefined;
|
|
70
|
-
baseCheckoutSessionService: BaseCheckoutSessionService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
71
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
72
72
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
73
73
|
CheckoutSessionMapper: ResponseMapperConstructor<SchemaValidator, Dto['CheckoutSessionMapper'], Entities['CheckoutSessionMapper']>;
|
|
74
74
|
CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['CreateCheckoutSessionMapper']>>;
|
|
@@ -91,6 +91,12 @@ declare class StripePaymentLinkService<SchemaValidator extends AnySchemaValidato
|
|
|
91
91
|
IdDto: IdDto;
|
|
92
92
|
IdsDto: IdsDto;
|
|
93
93
|
}> {
|
|
94
|
+
readonly options?: {
|
|
95
|
+
enableDatabaseBackup?: boolean;
|
|
96
|
+
telemetry?: TelemetryOptions;
|
|
97
|
+
} | undefined;
|
|
98
|
+
basePaymentLinkService: BasePaymentLinkService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
99
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
94
100
|
protected readonly stripeClient: Stripe__default;
|
|
95
101
|
protected readonly em: EntityManager;
|
|
96
102
|
protected readonly cache: TtlCache;
|
|
@@ -101,12 +107,6 @@ declare class StripePaymentLinkService<SchemaValidator extends AnySchemaValidato
|
|
|
101
107
|
CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['CreatePaymentLinkMapper']>>;
|
|
102
108
|
UpdatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkMapper'], Entities['UpdatePaymentLinkMapper'], (dto: Dto['UpdatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['UpdatePaymentLinkMapper']>>;
|
|
103
109
|
};
|
|
104
|
-
readonly options?: {
|
|
105
|
-
enableDatabaseBackup?: boolean;
|
|
106
|
-
telemetry?: TelemetryOptions;
|
|
107
|
-
} | undefined;
|
|
108
|
-
basePaymentLinkService: BasePaymentLinkService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
109
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
110
110
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
111
111
|
PaymentLinkMapper: ResponseMapperConstructor<SchemaValidator, Dto['PaymentLinkMapper'], Entities['PaymentLinkMapper']>;
|
|
112
112
|
CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['CreatePaymentLinkMapper']>>;
|
|
@@ -131,6 +131,12 @@ declare class StripePlanService<SchemaValidator extends AnySchemaValidator, Enti
|
|
|
131
131
|
IdDto: IdDto;
|
|
132
132
|
IdsDto: IdsDto;
|
|
133
133
|
}> {
|
|
134
|
+
readonly options?: {
|
|
135
|
+
telemetry?: TelemetryOptions;
|
|
136
|
+
databaseTableName?: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
basePlanService: BasePlanService<SchemaValidator, typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum, Entities, Entities>;
|
|
139
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
134
140
|
protected readonly stripeClient: Stripe__default;
|
|
135
141
|
protected readonly em: EntityManager;
|
|
136
142
|
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
@@ -140,12 +146,6 @@ declare class StripePlanService<SchemaValidator extends AnySchemaValidator, Enti
|
|
|
140
146
|
CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['CreatePlanMapper']>>;
|
|
141
147
|
UpdatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePlanMapper'], Entities['UpdatePlanMapper'], (dto: Dto['UpdatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['UpdatePlanMapper']>>;
|
|
142
148
|
};
|
|
143
|
-
readonly options?: {
|
|
144
|
-
telemetry?: TelemetryOptions;
|
|
145
|
-
databaseTableName?: string;
|
|
146
|
-
} | undefined;
|
|
147
|
-
basePlanService: BasePlanService<SchemaValidator, typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum, Entities, Entities>;
|
|
148
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
149
149
|
constructor(stripeClient: Stripe__default, em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
150
150
|
PlanMapper: ResponseMapperConstructor<SchemaValidator, Dto['PlanMapper'], Entities['PlanMapper']>;
|
|
151
151
|
CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['CreatePlanMapper']>>;
|
|
@@ -170,6 +170,12 @@ declare class StripeSubscriptionService<SchemaValidator extends AnySchemaValidat
|
|
|
170
170
|
IdDto: IdDto;
|
|
171
171
|
IdsDto: IdsDto;
|
|
172
172
|
}> {
|
|
173
|
+
readonly options?: {
|
|
174
|
+
telemetry?: TelemetryOptions;
|
|
175
|
+
databaseTableName?: string;
|
|
176
|
+
} | undefined;
|
|
177
|
+
baseSubscriptionService: BaseSubscriptionService<SchemaValidator, PartyType, typeof BillingProviderEnum, Entities, Entities>;
|
|
178
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
173
179
|
protected readonly stripe: Stripe__default;
|
|
174
180
|
protected readonly em: EntityManager;
|
|
175
181
|
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
@@ -179,12 +185,6 @@ declare class StripeSubscriptionService<SchemaValidator extends AnySchemaValidat
|
|
|
179
185
|
CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['CreateSubscriptionMapper']>>;
|
|
180
186
|
UpdateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionMapper'], Entities['UpdateSubscriptionMapper'], (dto: Dto['UpdateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['UpdateSubscriptionMapper']>>;
|
|
181
187
|
};
|
|
182
|
-
readonly options?: {
|
|
183
|
-
telemetry?: TelemetryOptions;
|
|
184
|
-
databaseTableName?: string;
|
|
185
|
-
} | undefined;
|
|
186
|
-
baseSubscriptionService: BaseSubscriptionService<SchemaValidator, PartyType, typeof BillingProviderEnum, Entities, Entities>;
|
|
187
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
188
188
|
constructor(stripe: Stripe__default, em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
189
189
|
SubscriptionMapper: ResponseMapperConstructor<SchemaValidator, Dto['SubscriptionMapper'], Entities['SubscriptionMapper']>;
|
|
190
190
|
CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['CreateSubscriptionMapper']>>;
|
package/lib/services/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IdDto, InstanceTypeRecord, IdsDto } from '@forklaunch/common';
|
|
2
2
|
import { TtlCache } from '@forklaunch/core/cache';
|
|
3
|
-
import { OpenTelemetryCollector, MetricsDefinition
|
|
3
|
+
import { TelemetryOptions, OpenTelemetryCollector, MetricsDefinition } from '@forklaunch/core/http';
|
|
4
4
|
import { BaseBillingPortalService, BaseCheckoutSessionService, BasePaymentLinkService, BasePlanService, BaseSubscriptionService } from '@forklaunch/implementation-billing-base/services';
|
|
5
5
|
import { BillingPortalService, CheckoutSessionService, PaymentLinkService, PlanService, SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
|
|
6
|
-
import { ResponseMapperConstructor, RequestMapperConstructor
|
|
6
|
+
import { InternalMapper, ResponseMapperConstructor, RequestMapperConstructor } from '@forklaunch/internal';
|
|
7
7
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
8
8
|
import { EntityManager } from '@mikro-orm/core';
|
|
9
9
|
import Stripe__default from 'stripe';
|
|
@@ -17,6 +17,13 @@ declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValida
|
|
|
17
17
|
BillingPortalDto: StripeBillingPortalDto;
|
|
18
18
|
IdDto: IdDto;
|
|
19
19
|
}> {
|
|
20
|
+
readonly options?: {
|
|
21
|
+
telemetry?: TelemetryOptions;
|
|
22
|
+
enableDatabaseBackup?: boolean;
|
|
23
|
+
} | undefined;
|
|
24
|
+
private readonly billingPortalSessionExpiryDurationMs;
|
|
25
|
+
baseBillingPortalService: BaseBillingPortalService<SchemaValidator, Entities, Entities>;
|
|
26
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
20
27
|
protected stripeClient: Stripe__default;
|
|
21
28
|
protected em: EntityManager;
|
|
22
29
|
protected cache: TtlCache;
|
|
@@ -27,13 +34,6 @@ declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValida
|
|
|
27
34
|
CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['CreateBillingPortalMapper']>>;
|
|
28
35
|
UpdateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateBillingPortalMapper'], Entities['UpdateBillingPortalMapper'], (dto: Dto['UpdateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['UpdateBillingPortalMapper']>>;
|
|
29
36
|
};
|
|
30
|
-
readonly options?: {
|
|
31
|
-
telemetry?: TelemetryOptions;
|
|
32
|
-
enableDatabaseBackup?: boolean;
|
|
33
|
-
} | undefined;
|
|
34
|
-
private readonly billingPortalSessionExpiryDurationMs;
|
|
35
|
-
baseBillingPortalService: BaseBillingPortalService<SchemaValidator, Entities, Entities>;
|
|
36
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
37
37
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
38
38
|
BillingPortalMapper: ResponseMapperConstructor<SchemaValidator, Dto['BillingPortalMapper'], Entities['BillingPortalMapper']>;
|
|
39
39
|
CreateBillingPortalMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateBillingPortalMapper'], Entities['CreateBillingPortalMapper'], (dto: Dto['CreateBillingPortalMapper'], em: EntityManager, session: Stripe__default.BillingPortal.Session) => Promise<Entities['CreateBillingPortalMapper']>>;
|
|
@@ -53,6 +53,12 @@ declare class StripeCheckoutSessionService<SchemaValidator extends AnySchemaVali
|
|
|
53
53
|
CheckoutSessionDto: Dto['CheckoutSessionMapper'];
|
|
54
54
|
IdDto: IdDto;
|
|
55
55
|
}> {
|
|
56
|
+
readonly options?: {
|
|
57
|
+
enableDatabaseBackup?: boolean;
|
|
58
|
+
telemetry?: TelemetryOptions;
|
|
59
|
+
} | undefined;
|
|
60
|
+
baseCheckoutSessionService: BaseCheckoutSessionService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
61
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
56
62
|
protected readonly stripeClient: Stripe__default;
|
|
57
63
|
protected readonly em: EntityManager;
|
|
58
64
|
protected readonly cache: TtlCache;
|
|
@@ -63,12 +69,6 @@ declare class StripeCheckoutSessionService<SchemaValidator extends AnySchemaVali
|
|
|
63
69
|
CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['CreateCheckoutSessionMapper']>>;
|
|
64
70
|
UpdateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateCheckoutSessionMapper'], Entities['UpdateCheckoutSessionMapper'], (dto: Dto['UpdateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['UpdateCheckoutSessionMapper']>>;
|
|
65
71
|
};
|
|
66
|
-
readonly options?: {
|
|
67
|
-
enableDatabaseBackup?: boolean;
|
|
68
|
-
telemetry?: TelemetryOptions;
|
|
69
|
-
} | undefined;
|
|
70
|
-
baseCheckoutSessionService: BaseCheckoutSessionService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
71
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
72
72
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
73
73
|
CheckoutSessionMapper: ResponseMapperConstructor<SchemaValidator, Dto['CheckoutSessionMapper'], Entities['CheckoutSessionMapper']>;
|
|
74
74
|
CreateCheckoutSessionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateCheckoutSessionMapper'], Entities['CreateCheckoutSessionMapper'], (dto: Dto['CreateCheckoutSessionMapper'], em: EntityManager, session: Stripe__default.Checkout.Session) => Promise<Entities['CreateCheckoutSessionMapper']>>;
|
|
@@ -91,6 +91,12 @@ declare class StripePaymentLinkService<SchemaValidator extends AnySchemaValidato
|
|
|
91
91
|
IdDto: IdDto;
|
|
92
92
|
IdsDto: IdsDto;
|
|
93
93
|
}> {
|
|
94
|
+
readonly options?: {
|
|
95
|
+
enableDatabaseBackup?: boolean;
|
|
96
|
+
telemetry?: TelemetryOptions;
|
|
97
|
+
} | undefined;
|
|
98
|
+
basePaymentLinkService: BasePaymentLinkService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
99
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
94
100
|
protected readonly stripeClient: Stripe__default;
|
|
95
101
|
protected readonly em: EntityManager;
|
|
96
102
|
protected readonly cache: TtlCache;
|
|
@@ -101,12 +107,6 @@ declare class StripePaymentLinkService<SchemaValidator extends AnySchemaValidato
|
|
|
101
107
|
CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['CreatePaymentLinkMapper']>>;
|
|
102
108
|
UpdatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePaymentLinkMapper'], Entities['UpdatePaymentLinkMapper'], (dto: Dto['UpdatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['UpdatePaymentLinkMapper']>>;
|
|
103
109
|
};
|
|
104
|
-
readonly options?: {
|
|
105
|
-
enableDatabaseBackup?: boolean;
|
|
106
|
-
telemetry?: TelemetryOptions;
|
|
107
|
-
} | undefined;
|
|
108
|
-
basePaymentLinkService: BasePaymentLinkService<SchemaValidator, typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum, Entities, Entities>;
|
|
109
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
110
110
|
constructor(stripeClient: Stripe__default, em: EntityManager, cache: TtlCache, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
111
111
|
PaymentLinkMapper: ResponseMapperConstructor<SchemaValidator, Dto['PaymentLinkMapper'], Entities['PaymentLinkMapper']>;
|
|
112
112
|
CreatePaymentLinkMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePaymentLinkMapper'], Entities['CreatePaymentLinkMapper'], (dto: Dto['CreatePaymentLinkMapper'], em: EntityManager, paymentLink: Stripe__default.PaymentLink) => Promise<Entities['CreatePaymentLinkMapper']>>;
|
|
@@ -131,6 +131,12 @@ declare class StripePlanService<SchemaValidator extends AnySchemaValidator, Enti
|
|
|
131
131
|
IdDto: IdDto;
|
|
132
132
|
IdsDto: IdsDto;
|
|
133
133
|
}> {
|
|
134
|
+
readonly options?: {
|
|
135
|
+
telemetry?: TelemetryOptions;
|
|
136
|
+
databaseTableName?: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
basePlanService: BasePlanService<SchemaValidator, typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum, Entities, Entities>;
|
|
139
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
134
140
|
protected readonly stripeClient: Stripe__default;
|
|
135
141
|
protected readonly em: EntityManager;
|
|
136
142
|
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
@@ -140,12 +146,6 @@ declare class StripePlanService<SchemaValidator extends AnySchemaValidator, Enti
|
|
|
140
146
|
CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['CreatePlanMapper']>>;
|
|
141
147
|
UpdatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdatePlanMapper'], Entities['UpdatePlanMapper'], (dto: Dto['UpdatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['UpdatePlanMapper']>>;
|
|
142
148
|
};
|
|
143
|
-
readonly options?: {
|
|
144
|
-
telemetry?: TelemetryOptions;
|
|
145
|
-
databaseTableName?: string;
|
|
146
|
-
} | undefined;
|
|
147
|
-
basePlanService: BasePlanService<SchemaValidator, typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum, Entities, Entities>;
|
|
148
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
149
149
|
constructor(stripeClient: Stripe__default, em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
150
150
|
PlanMapper: ResponseMapperConstructor<SchemaValidator, Dto['PlanMapper'], Entities['PlanMapper']>;
|
|
151
151
|
CreatePlanMapper: RequestMapperConstructor<SchemaValidator, Dto['CreatePlanMapper'], Entities['CreatePlanMapper'], (dto: Dto['CreatePlanMapper'], em: EntityManager, plan: Stripe__default.Plan) => Promise<Entities['CreatePlanMapper']>>;
|
|
@@ -170,6 +170,12 @@ declare class StripeSubscriptionService<SchemaValidator extends AnySchemaValidat
|
|
|
170
170
|
IdDto: IdDto;
|
|
171
171
|
IdsDto: IdsDto;
|
|
172
172
|
}> {
|
|
173
|
+
readonly options?: {
|
|
174
|
+
telemetry?: TelemetryOptions;
|
|
175
|
+
databaseTableName?: string;
|
|
176
|
+
} | undefined;
|
|
177
|
+
baseSubscriptionService: BaseSubscriptionService<SchemaValidator, PartyType, typeof BillingProviderEnum, Entities, Entities>;
|
|
178
|
+
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
173
179
|
protected readonly stripe: Stripe__default;
|
|
174
180
|
protected readonly em: EntityManager;
|
|
175
181
|
protected readonly openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>;
|
|
@@ -179,12 +185,6 @@ declare class StripeSubscriptionService<SchemaValidator extends AnySchemaValidat
|
|
|
179
185
|
CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['CreateSubscriptionMapper']>>;
|
|
180
186
|
UpdateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['UpdateSubscriptionMapper'], Entities['UpdateSubscriptionMapper'], (dto: Dto['UpdateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['UpdateSubscriptionMapper']>>;
|
|
181
187
|
};
|
|
182
|
-
readonly options?: {
|
|
183
|
-
telemetry?: TelemetryOptions;
|
|
184
|
-
databaseTableName?: string;
|
|
185
|
-
} | undefined;
|
|
186
|
-
baseSubscriptionService: BaseSubscriptionService<SchemaValidator, PartyType, typeof BillingProviderEnum, Entities, Entities>;
|
|
187
|
-
protected _mappers: InternalMapper<InstanceTypeRecord<typeof this.mappers>>;
|
|
188
188
|
constructor(stripe: Stripe__default, em: EntityManager, openTelemetryCollector: OpenTelemetryCollector<MetricsDefinition>, schemaValidator: SchemaValidator, mappers: {
|
|
189
189
|
SubscriptionMapper: ResponseMapperConstructor<SchemaValidator, Dto['SubscriptionMapper'], Entities['SubscriptionMapper']>;
|
|
190
190
|
CreateSubscriptionMapper: RequestMapperConstructor<SchemaValidator, Dto['CreateSubscriptionMapper'], Entities['CreateSubscriptionMapper'], (dto: Dto['CreateSubscriptionMapper'], em: EntityManager, subscription: Stripe__default.Subscription) => Promise<Entities['CreateSubscriptionMapper']>>;
|
package/lib/services/index.js
CHANGED
|
@@ -34,13 +34,13 @@ var import_services = require("@forklaunch/implementation-billing-base/services"
|
|
|
34
34
|
var import_internal = require("@forklaunch/internal");
|
|
35
35
|
var StripeBillingPortalService = class {
|
|
36
36
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
37
|
+
this.options = options;
|
|
37
38
|
this.stripeClient = stripeClient;
|
|
38
39
|
this.em = em;
|
|
39
40
|
this.cache = cache;
|
|
40
41
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
41
42
|
this.schemaValidator = schemaValidator;
|
|
42
43
|
this.mappers = mappers;
|
|
43
|
-
this.options = options;
|
|
44
44
|
this._mappers = (0, import_internal.transformIntoInternalMapper)(mappers, schemaValidator);
|
|
45
45
|
this.baseBillingPortalService = new import_services.BaseBillingPortalService(
|
|
46
46
|
em,
|
|
@@ -58,6 +58,12 @@ var StripeBillingPortalService = class {
|
|
|
58
58
|
billingPortalSessionExpiryDurationMs = 5 * 60 * 1e3;
|
|
59
59
|
baseBillingPortalService;
|
|
60
60
|
_mappers;
|
|
61
|
+
stripeClient;
|
|
62
|
+
em;
|
|
63
|
+
cache;
|
|
64
|
+
openTelemetryCollector;
|
|
65
|
+
schemaValidator;
|
|
66
|
+
mappers;
|
|
61
67
|
async createBillingPortalSession(billingPortalDto) {
|
|
62
68
|
const session = await this.stripeClient.billingPortal.sessions.create({
|
|
63
69
|
...billingPortalDto.stripeFields,
|
|
@@ -123,13 +129,13 @@ var import_services2 = require("@forklaunch/implementation-billing-base/services
|
|
|
123
129
|
var import_internal2 = require("@forklaunch/internal");
|
|
124
130
|
var StripeCheckoutSessionService = class {
|
|
125
131
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
132
|
+
this.options = options;
|
|
126
133
|
this.stripeClient = stripeClient;
|
|
127
134
|
this.em = em;
|
|
128
135
|
this.cache = cache;
|
|
129
136
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
130
137
|
this.schemaValidator = schemaValidator;
|
|
131
138
|
this.mappers = mappers;
|
|
132
|
-
this.options = options;
|
|
133
139
|
this._mappers = (0, import_internal2.transformIntoInternalMapper)(mappers, schemaValidator);
|
|
134
140
|
this.baseCheckoutSessionService = new import_services2.BaseCheckoutSessionService(
|
|
135
141
|
em,
|
|
@@ -146,6 +152,12 @@ var StripeCheckoutSessionService = class {
|
|
|
146
152
|
}
|
|
147
153
|
baseCheckoutSessionService;
|
|
148
154
|
_mappers;
|
|
155
|
+
stripeClient;
|
|
156
|
+
em;
|
|
157
|
+
cache;
|
|
158
|
+
openTelemetryCollector;
|
|
159
|
+
schemaValidator;
|
|
160
|
+
mappers;
|
|
149
161
|
async createCheckoutSession(checkoutSessionDto) {
|
|
150
162
|
const session = await this.stripeClient.checkout.sessions.create({
|
|
151
163
|
...checkoutSessionDto.stripeFields,
|
|
@@ -209,13 +221,13 @@ var import_services3 = require("@forklaunch/implementation-billing-base/services
|
|
|
209
221
|
var import_internal3 = require("@forklaunch/internal");
|
|
210
222
|
var StripePaymentLinkService = class {
|
|
211
223
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
224
|
+
this.options = options;
|
|
212
225
|
this.stripeClient = stripeClient;
|
|
213
226
|
this.em = em;
|
|
214
227
|
this.cache = cache;
|
|
215
228
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
216
229
|
this.schemaValidator = schemaValidator;
|
|
217
230
|
this.mappers = mappers;
|
|
218
|
-
this.options = options;
|
|
219
231
|
this._mappers = (0, import_internal3.transformIntoInternalMapper)(mappers, schemaValidator);
|
|
220
232
|
this.basePaymentLinkService = new import_services3.BasePaymentLinkService(
|
|
221
233
|
em,
|
|
@@ -232,6 +244,12 @@ var StripePaymentLinkService = class {
|
|
|
232
244
|
}
|
|
233
245
|
basePaymentLinkService;
|
|
234
246
|
_mappers;
|
|
247
|
+
stripeClient;
|
|
248
|
+
em;
|
|
249
|
+
cache;
|
|
250
|
+
openTelemetryCollector;
|
|
251
|
+
schemaValidator;
|
|
252
|
+
mappers;
|
|
235
253
|
async createPaymentLink(paymentLinkDto) {
|
|
236
254
|
const session = await this.stripeClient.paymentLinks.create({
|
|
237
255
|
...paymentLinkDto.stripeFields,
|
|
@@ -339,12 +357,12 @@ var import_services4 = require("@forklaunch/implementation-billing-base/services
|
|
|
339
357
|
var import_internal4 = require("@forklaunch/internal");
|
|
340
358
|
var StripePlanService = class {
|
|
341
359
|
constructor(stripeClient, em, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
360
|
+
this.options = options;
|
|
342
361
|
this.stripeClient = stripeClient;
|
|
343
362
|
this.em = em;
|
|
344
363
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
345
364
|
this.schemaValidator = schemaValidator;
|
|
346
365
|
this.mappers = mappers;
|
|
347
|
-
this.options = options;
|
|
348
366
|
this._mappers = (0, import_internal4.transformIntoInternalMapper)(mappers, schemaValidator);
|
|
349
367
|
this.basePlanService = new import_services4.BasePlanService(
|
|
350
368
|
em,
|
|
@@ -360,6 +378,11 @@ var StripePlanService = class {
|
|
|
360
378
|
}
|
|
361
379
|
basePlanService;
|
|
362
380
|
_mappers;
|
|
381
|
+
stripeClient;
|
|
382
|
+
em;
|
|
383
|
+
openTelemetryCollector;
|
|
384
|
+
schemaValidator;
|
|
385
|
+
mappers;
|
|
363
386
|
async createPlan(planDto, em) {
|
|
364
387
|
const plan = await this.stripeClient.plans.create({
|
|
365
388
|
...planDto.stripeFields,
|
|
@@ -452,12 +475,12 @@ var import_services5 = require("@forklaunch/implementation-billing-base/services
|
|
|
452
475
|
var import_internal5 = require("@forklaunch/internal");
|
|
453
476
|
var StripeSubscriptionService = class {
|
|
454
477
|
constructor(stripe, em, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
478
|
+
this.options = options;
|
|
455
479
|
this.stripe = stripe;
|
|
456
480
|
this.em = em;
|
|
457
481
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
458
482
|
this.schemaValidator = schemaValidator;
|
|
459
483
|
this.mappers = mappers;
|
|
460
|
-
this.options = options;
|
|
461
484
|
this._mappers = (0, import_internal5.transformIntoInternalMapper)(mappers, schemaValidator);
|
|
462
485
|
this.baseSubscriptionService = new import_services5.BaseSubscriptionService(
|
|
463
486
|
em,
|
|
@@ -473,6 +496,11 @@ var StripeSubscriptionService = class {
|
|
|
473
496
|
}
|
|
474
497
|
baseSubscriptionService;
|
|
475
498
|
_mappers;
|
|
499
|
+
stripe;
|
|
500
|
+
em;
|
|
501
|
+
openTelemetryCollector;
|
|
502
|
+
schemaValidator;
|
|
503
|
+
mappers;
|
|
476
504
|
async createSubscription(subscriptionDto, em) {
|
|
477
505
|
const subscription = await this.stripe.subscriptions.create({
|
|
478
506
|
...subscriptionDto.stripeFields,
|
|
@@ -609,6 +637,15 @@ var BillingProviderEnum = {
|
|
|
609
637
|
|
|
610
638
|
// services/webhook.service.ts
|
|
611
639
|
var StripeWebhookService = class {
|
|
640
|
+
stripeClient;
|
|
641
|
+
em;
|
|
642
|
+
schemaValidator;
|
|
643
|
+
openTelemetryCollector;
|
|
644
|
+
billingPortalService;
|
|
645
|
+
checkoutSessionService;
|
|
646
|
+
paymentLinkService;
|
|
647
|
+
planService;
|
|
648
|
+
subscriptionService;
|
|
612
649
|
constructor(stripeClient, em, schemaValidator, openTelemetryCollector, billingPortalService, checkoutSessionService, paymentLinkService, planService, subscriptionService) {
|
|
613
650
|
this.stripeClient = stripeClient;
|
|
614
651
|
this.em = em;
|
package/lib/services/index.mjs
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
} from "@forklaunch/internal";
|
|
8
8
|
var StripeBillingPortalService = class {
|
|
9
9
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
10
|
+
this.options = options;
|
|
10
11
|
this.stripeClient = stripeClient;
|
|
11
12
|
this.em = em;
|
|
12
13
|
this.cache = cache;
|
|
13
14
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
14
15
|
this.schemaValidator = schemaValidator;
|
|
15
16
|
this.mappers = mappers;
|
|
16
|
-
this.options = options;
|
|
17
17
|
this._mappers = transformIntoInternalMapper(mappers, schemaValidator);
|
|
18
18
|
this.baseBillingPortalService = new BaseBillingPortalService(
|
|
19
19
|
em,
|
|
@@ -31,6 +31,12 @@ var StripeBillingPortalService = class {
|
|
|
31
31
|
billingPortalSessionExpiryDurationMs = 5 * 60 * 1e3;
|
|
32
32
|
baseBillingPortalService;
|
|
33
33
|
_mappers;
|
|
34
|
+
stripeClient;
|
|
35
|
+
em;
|
|
36
|
+
cache;
|
|
37
|
+
openTelemetryCollector;
|
|
38
|
+
schemaValidator;
|
|
39
|
+
mappers;
|
|
34
40
|
async createBillingPortalSession(billingPortalDto) {
|
|
35
41
|
const session = await this.stripeClient.billingPortal.sessions.create({
|
|
36
42
|
...billingPortalDto.stripeFields,
|
|
@@ -100,13 +106,13 @@ import {
|
|
|
100
106
|
} from "@forklaunch/internal";
|
|
101
107
|
var StripeCheckoutSessionService = class {
|
|
102
108
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
109
|
+
this.options = options;
|
|
103
110
|
this.stripeClient = stripeClient;
|
|
104
111
|
this.em = em;
|
|
105
112
|
this.cache = cache;
|
|
106
113
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
107
114
|
this.schemaValidator = schemaValidator;
|
|
108
115
|
this.mappers = mappers;
|
|
109
|
-
this.options = options;
|
|
110
116
|
this._mappers = transformIntoInternalMapper2(mappers, schemaValidator);
|
|
111
117
|
this.baseCheckoutSessionService = new BaseCheckoutSessionService(
|
|
112
118
|
em,
|
|
@@ -123,6 +129,12 @@ var StripeCheckoutSessionService = class {
|
|
|
123
129
|
}
|
|
124
130
|
baseCheckoutSessionService;
|
|
125
131
|
_mappers;
|
|
132
|
+
stripeClient;
|
|
133
|
+
em;
|
|
134
|
+
cache;
|
|
135
|
+
openTelemetryCollector;
|
|
136
|
+
schemaValidator;
|
|
137
|
+
mappers;
|
|
126
138
|
async createCheckoutSession(checkoutSessionDto) {
|
|
127
139
|
const session = await this.stripeClient.checkout.sessions.create({
|
|
128
140
|
...checkoutSessionDto.stripeFields,
|
|
@@ -190,13 +202,13 @@ import {
|
|
|
190
202
|
} from "@forklaunch/internal";
|
|
191
203
|
var StripePaymentLinkService = class {
|
|
192
204
|
constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
205
|
+
this.options = options;
|
|
193
206
|
this.stripeClient = stripeClient;
|
|
194
207
|
this.em = em;
|
|
195
208
|
this.cache = cache;
|
|
196
209
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
197
210
|
this.schemaValidator = schemaValidator;
|
|
198
211
|
this.mappers = mappers;
|
|
199
|
-
this.options = options;
|
|
200
212
|
this._mappers = transformIntoInternalMapper3(mappers, schemaValidator);
|
|
201
213
|
this.basePaymentLinkService = new BasePaymentLinkService(
|
|
202
214
|
em,
|
|
@@ -213,6 +225,12 @@ var StripePaymentLinkService = class {
|
|
|
213
225
|
}
|
|
214
226
|
basePaymentLinkService;
|
|
215
227
|
_mappers;
|
|
228
|
+
stripeClient;
|
|
229
|
+
em;
|
|
230
|
+
cache;
|
|
231
|
+
openTelemetryCollector;
|
|
232
|
+
schemaValidator;
|
|
233
|
+
mappers;
|
|
216
234
|
async createPaymentLink(paymentLinkDto) {
|
|
217
235
|
const session = await this.stripeClient.paymentLinks.create({
|
|
218
236
|
...paymentLinkDto.stripeFields,
|
|
@@ -324,12 +342,12 @@ import {
|
|
|
324
342
|
} from "@forklaunch/internal";
|
|
325
343
|
var StripePlanService = class {
|
|
326
344
|
constructor(stripeClient, em, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
345
|
+
this.options = options;
|
|
327
346
|
this.stripeClient = stripeClient;
|
|
328
347
|
this.em = em;
|
|
329
348
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
330
349
|
this.schemaValidator = schemaValidator;
|
|
331
350
|
this.mappers = mappers;
|
|
332
|
-
this.options = options;
|
|
333
351
|
this._mappers = transformIntoInternalMapper4(mappers, schemaValidator);
|
|
334
352
|
this.basePlanService = new BasePlanService(
|
|
335
353
|
em,
|
|
@@ -345,6 +363,11 @@ var StripePlanService = class {
|
|
|
345
363
|
}
|
|
346
364
|
basePlanService;
|
|
347
365
|
_mappers;
|
|
366
|
+
stripeClient;
|
|
367
|
+
em;
|
|
368
|
+
openTelemetryCollector;
|
|
369
|
+
schemaValidator;
|
|
370
|
+
mappers;
|
|
348
371
|
async createPlan(planDto, em) {
|
|
349
372
|
const plan = await this.stripeClient.plans.create({
|
|
350
373
|
...planDto.stripeFields,
|
|
@@ -441,12 +464,12 @@ import {
|
|
|
441
464
|
} from "@forklaunch/internal";
|
|
442
465
|
var StripeSubscriptionService = class {
|
|
443
466
|
constructor(stripe, em, openTelemetryCollector, schemaValidator, mappers, options) {
|
|
467
|
+
this.options = options;
|
|
444
468
|
this.stripe = stripe;
|
|
445
469
|
this.em = em;
|
|
446
470
|
this.openTelemetryCollector = openTelemetryCollector;
|
|
447
471
|
this.schemaValidator = schemaValidator;
|
|
448
472
|
this.mappers = mappers;
|
|
449
|
-
this.options = options;
|
|
450
473
|
this._mappers = transformIntoInternalMapper5(mappers, schemaValidator);
|
|
451
474
|
this.baseSubscriptionService = new BaseSubscriptionService(
|
|
452
475
|
em,
|
|
@@ -462,6 +485,11 @@ var StripeSubscriptionService = class {
|
|
|
462
485
|
}
|
|
463
486
|
baseSubscriptionService;
|
|
464
487
|
_mappers;
|
|
488
|
+
stripe;
|
|
489
|
+
em;
|
|
490
|
+
openTelemetryCollector;
|
|
491
|
+
schemaValidator;
|
|
492
|
+
mappers;
|
|
465
493
|
async createSubscription(subscriptionDto, em) {
|
|
466
494
|
const subscription = await this.stripe.subscriptions.create({
|
|
467
495
|
...subscriptionDto.stripeFields,
|
|
@@ -598,6 +626,15 @@ var BillingProviderEnum = {
|
|
|
598
626
|
|
|
599
627
|
// services/webhook.service.ts
|
|
600
628
|
var StripeWebhookService = class {
|
|
629
|
+
stripeClient;
|
|
630
|
+
em;
|
|
631
|
+
schemaValidator;
|
|
632
|
+
openTelemetryCollector;
|
|
633
|
+
billingPortalService;
|
|
634
|
+
checkoutSessionService;
|
|
635
|
+
paymentLinkService;
|
|
636
|
+
planService;
|
|
637
|
+
subscriptionService;
|
|
601
638
|
constructor(stripeClient, em, schemaValidator, openTelemetryCollector, billingPortalService, checkoutSessionService, paymentLinkService, planService, subscriptionService) {
|
|
602
639
|
this.stripeClient = stripeClient;
|
|
603
640
|
this.em = em;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-billing-stripe",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Stripe implementation for forklaunch billing",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"lib/**"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@forklaunch/common": "^0.4.
|
|
46
|
-
"@forklaunch/core": "^0.
|
|
47
|
-
"@forklaunch/internal": "^0.1.
|
|
48
|
-
"@forklaunch/validator": "^0.
|
|
45
|
+
"@forklaunch/common": "^0.4.6",
|
|
46
|
+
"@forklaunch/core": "^0.12.0",
|
|
47
|
+
"@forklaunch/internal": "^0.1.9",
|
|
48
|
+
"@forklaunch/validator": "^0.8.0",
|
|
49
49
|
"@mikro-orm/core": "^6.4.16",
|
|
50
|
-
"@sinclair/typebox": "^0.34.
|
|
50
|
+
"@sinclair/typebox": "^0.34.38",
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
|
-
"stripe": "^18.
|
|
53
|
-
"zod": "^4.0.
|
|
54
|
-
"@forklaunch/implementation-billing-base": "0.
|
|
55
|
-
"@forklaunch/interfaces-billing": "0.
|
|
52
|
+
"stripe": "^18.4.0",
|
|
53
|
+
"zod": "^4.0.14",
|
|
54
|
+
"@forklaunch/implementation-billing-base": "0.5.1",
|
|
55
|
+
"@forklaunch/interfaces-billing": "0.5.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
58
|
+
"@typescript/native-preview": "7.0.0-dev.20250803.1",
|
|
59
59
|
"depcheck": "^1.4.7",
|
|
60
60
|
"prettier": "^3.6.2",
|
|
61
|
-
"typedoc": "^0.28.
|
|
61
|
+
"typedoc": "^0.28.9"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsc --noEmit && tsup domain/schemas/index.ts services/index.ts domain/enum/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|