@forklaunch/implementation-billing-stripe 0.5.11 → 0.5.12
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 +2 -2
- package/lib/domain/schemas/index.d.ts +2 -2
- package/lib/domain/types/index.d.mts +4 -4
- package/lib/domain/types/index.d.ts +4 -4
- package/lib/eject/domain/types/plan.mapper.types.ts +2 -2
- package/lib/eject/domain/types/stripe.dto.types.ts +1 -1
- package/lib/eject/domain/types/stripe.entity.types.ts +1 -1
- package/lib/eject/services/plan.service.ts +25 -8
- package/lib/services/index.js +22 -8
- package/lib/services/index.mjs +22 -8
- package/package.json +3 -3
|
@@ -233,7 +233,7 @@ declare const StripePlanServiceSchemas: <SchemaValidator extends _forklaunch_val
|
|
|
233
233
|
cadence: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"week"> | _sinclair_typebox.TLiteral<"month"> | _sinclair_typebox.TLiteral<"year">]>;
|
|
234
234
|
currency: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"USD"> | _sinclair_typebox.TLiteral<"EUR"> | _sinclair_typebox.TLiteral<"JPY"> | _sinclair_typebox.TLiteral<"GBP"> | _sinclair_typebox.TLiteral<"AUD"> | _sinclair_typebox.TLiteral<"CAD"> | _sinclair_typebox.TLiteral<"CHF"> | _sinclair_typebox.TLiteral<"CNY"> | _sinclair_typebox.TLiteral<"AED"> | _sinclair_typebox.TLiteral<"ARS"> | _sinclair_typebox.TLiteral<"BAM"> | _sinclair_typebox.TLiteral<"BDT"> | _sinclair_typebox.TLiteral<"BGN"> | _sinclair_typebox.TLiteral<"BOB"> | _sinclair_typebox.TLiteral<"BRL"> | _sinclair_typebox.TLiteral<"CLP"> | _sinclair_typebox.TLiteral<"COP"> | _sinclair_typebox.TLiteral<"CRC"> | _sinclair_typebox.TLiteral<"CZK"> | _sinclair_typebox.TLiteral<"DKK"> | _sinclair_typebox.TLiteral<"DZD"> | _sinclair_typebox.TLiteral<"EGP"> | _sinclair_typebox.TLiteral<"ETB"> | _sinclair_typebox.TLiteral<"GEL"> | _sinclair_typebox.TLiteral<"GTQ"> | _sinclair_typebox.TLiteral<"HKD"> | _sinclair_typebox.TLiteral<"HUF"> | _sinclair_typebox.TLiteral<"IDR"> | _sinclair_typebox.TLiteral<"ILS"> | _sinclair_typebox.TLiteral<"INR"> | _sinclair_typebox.TLiteral<"ISK"> | _sinclair_typebox.TLiteral<"JMD"> | _sinclair_typebox.TLiteral<"KES"> | _sinclair_typebox.TLiteral<"KHR"> | _sinclair_typebox.TLiteral<"KRW"> | _sinclair_typebox.TLiteral<"KZT"> | _sinclair_typebox.TLiteral<"LAK"> | _sinclair_typebox.TLiteral<"LKR"> | _sinclair_typebox.TLiteral<"MAD"> | _sinclair_typebox.TLiteral<"MMK"> | _sinclair_typebox.TLiteral<"MXN"> | _sinclair_typebox.TLiteral<"MYR"> | _sinclair_typebox.TLiteral<"NGN"> | _sinclair_typebox.TLiteral<"NOK"> | _sinclair_typebox.TLiteral<"NPR"> | _sinclair_typebox.TLiteral<"NZD"> | _sinclair_typebox.TLiteral<"PEN"> | _sinclair_typebox.TLiteral<"PHP"> | _sinclair_typebox.TLiteral<"PKR"> | _sinclair_typebox.TLiteral<"PLN"> | _sinclair_typebox.TLiteral<"PYG"> | _sinclair_typebox.TLiteral<"QAR"> | _sinclair_typebox.TLiteral<"RON"> | _sinclair_typebox.TLiteral<"RSD"> | _sinclair_typebox.TLiteral<"RUB"> | _sinclair_typebox.TLiteral<"SAR"> | _sinclair_typebox.TLiteral<"SEK"> | _sinclair_typebox.TLiteral<"SGD"> | _sinclair_typebox.TLiteral<"THB"> | _sinclair_typebox.TLiteral<"TRY"> | _sinclair_typebox.TLiteral<"TWD"> | _sinclair_typebox.TLiteral<"TZS"> | _sinclair_typebox.TLiteral<"UAH"> | _sinclair_typebox.TLiteral<"UGX"> | _sinclair_typebox.TLiteral<"UYU"> | _sinclair_typebox.TLiteral<"VND"> | _sinclair_typebox.TLiteral<"ZAR"> | _sinclair_typebox.TLiteral<"ZMW">]>;
|
|
235
235
|
features: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
|
|
236
|
-
stripeFields: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, stripe.Stripe.
|
|
236
|
+
stripeFields: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, stripe.Stripe.Product>;
|
|
237
237
|
externalId: _sinclair_typebox.TString;
|
|
238
238
|
billingProvider: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"stripe">]>>;
|
|
239
239
|
active: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TString]>, boolean>;
|
|
@@ -275,7 +275,7 @@ declare const StripePlanServiceSchemas: <SchemaValidator extends _forklaunch_val
|
|
|
275
275
|
cadence: zod_v3.ZodUnion<[zod_v3.ZodLiteral<"week"> | zod_v3.ZodLiteral<"month"> | zod_v3.ZodLiteral<"year">]>;
|
|
276
276
|
currency: zod_v3.ZodUnion<[zod_v3.ZodLiteral<"USD"> | zod_v3.ZodLiteral<"EUR"> | zod_v3.ZodLiteral<"JPY"> | zod_v3.ZodLiteral<"GBP"> | zod_v3.ZodLiteral<"AUD"> | zod_v3.ZodLiteral<"CAD"> | zod_v3.ZodLiteral<"CHF"> | zod_v3.ZodLiteral<"CNY"> | zod_v3.ZodLiteral<"AED"> | zod_v3.ZodLiteral<"ARS"> | zod_v3.ZodLiteral<"BAM"> | zod_v3.ZodLiteral<"BDT"> | zod_v3.ZodLiteral<"BGN"> | zod_v3.ZodLiteral<"BOB"> | zod_v3.ZodLiteral<"BRL"> | zod_v3.ZodLiteral<"CLP"> | zod_v3.ZodLiteral<"COP"> | zod_v3.ZodLiteral<"CRC"> | zod_v3.ZodLiteral<"CZK"> | zod_v3.ZodLiteral<"DKK"> | zod_v3.ZodLiteral<"DZD"> | zod_v3.ZodLiteral<"EGP"> | zod_v3.ZodLiteral<"ETB"> | zod_v3.ZodLiteral<"GEL"> | zod_v3.ZodLiteral<"GTQ"> | zod_v3.ZodLiteral<"HKD"> | zod_v3.ZodLiteral<"HUF"> | zod_v3.ZodLiteral<"IDR"> | zod_v3.ZodLiteral<"ILS"> | zod_v3.ZodLiteral<"INR"> | zod_v3.ZodLiteral<"ISK"> | zod_v3.ZodLiteral<"JMD"> | zod_v3.ZodLiteral<"KES"> | zod_v3.ZodLiteral<"KHR"> | zod_v3.ZodLiteral<"KRW"> | zod_v3.ZodLiteral<"KZT"> | zod_v3.ZodLiteral<"LAK"> | zod_v3.ZodLiteral<"LKR"> | zod_v3.ZodLiteral<"MAD"> | zod_v3.ZodLiteral<"MMK"> | zod_v3.ZodLiteral<"MXN"> | zod_v3.ZodLiteral<"MYR"> | zod_v3.ZodLiteral<"NGN"> | zod_v3.ZodLiteral<"NOK"> | zod_v3.ZodLiteral<"NPR"> | zod_v3.ZodLiteral<"NZD"> | zod_v3.ZodLiteral<"PEN"> | zod_v3.ZodLiteral<"PHP"> | zod_v3.ZodLiteral<"PKR"> | zod_v3.ZodLiteral<"PLN"> | zod_v3.ZodLiteral<"PYG"> | zod_v3.ZodLiteral<"QAR"> | zod_v3.ZodLiteral<"RON"> | zod_v3.ZodLiteral<"RSD"> | zod_v3.ZodLiteral<"RUB"> | zod_v3.ZodLiteral<"SAR"> | zod_v3.ZodLiteral<"SEK"> | zod_v3.ZodLiteral<"SGD"> | zod_v3.ZodLiteral<"THB"> | zod_v3.ZodLiteral<"TRY"> | zod_v3.ZodLiteral<"TWD"> | zod_v3.ZodLiteral<"TZS"> | zod_v3.ZodLiteral<"UAH"> | zod_v3.ZodLiteral<"UGX"> | zod_v3.ZodLiteral<"UYU"> | zod_v3.ZodLiteral<"VND"> | zod_v3.ZodLiteral<"ZAR"> | zod_v3.ZodLiteral<"ZMW">]>;
|
|
277
277
|
features: zod_v3.ZodOptional<zod_v3.ZodArray<zod_v3.ZodString, "many">>;
|
|
278
|
-
stripeFields: zod_v3.ZodType<stripe.Stripe.
|
|
278
|
+
stripeFields: zod_v3.ZodType<stripe.Stripe.Product, zod_v3.ZodTypeDef, stripe.Stripe.Product>;
|
|
279
279
|
externalId: zod_v3.ZodString;
|
|
280
280
|
billingProvider: zod_v3.ZodOptional<zod_v3.ZodUnion<[zod_v3.ZodLiteral<"stripe">]>>;
|
|
281
281
|
active: zod_v3.ZodEffects<zod_v3.ZodBoolean, boolean, unknown>;
|
|
@@ -233,7 +233,7 @@ declare const StripePlanServiceSchemas: <SchemaValidator extends _forklaunch_val
|
|
|
233
233
|
cadence: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"week"> | _sinclair_typebox.TLiteral<"month"> | _sinclair_typebox.TLiteral<"year">]>;
|
|
234
234
|
currency: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"USD"> | _sinclair_typebox.TLiteral<"EUR"> | _sinclair_typebox.TLiteral<"JPY"> | _sinclair_typebox.TLiteral<"GBP"> | _sinclair_typebox.TLiteral<"AUD"> | _sinclair_typebox.TLiteral<"CAD"> | _sinclair_typebox.TLiteral<"CHF"> | _sinclair_typebox.TLiteral<"CNY"> | _sinclair_typebox.TLiteral<"AED"> | _sinclair_typebox.TLiteral<"ARS"> | _sinclair_typebox.TLiteral<"BAM"> | _sinclair_typebox.TLiteral<"BDT"> | _sinclair_typebox.TLiteral<"BGN"> | _sinclair_typebox.TLiteral<"BOB"> | _sinclair_typebox.TLiteral<"BRL"> | _sinclair_typebox.TLiteral<"CLP"> | _sinclair_typebox.TLiteral<"COP"> | _sinclair_typebox.TLiteral<"CRC"> | _sinclair_typebox.TLiteral<"CZK"> | _sinclair_typebox.TLiteral<"DKK"> | _sinclair_typebox.TLiteral<"DZD"> | _sinclair_typebox.TLiteral<"EGP"> | _sinclair_typebox.TLiteral<"ETB"> | _sinclair_typebox.TLiteral<"GEL"> | _sinclair_typebox.TLiteral<"GTQ"> | _sinclair_typebox.TLiteral<"HKD"> | _sinclair_typebox.TLiteral<"HUF"> | _sinclair_typebox.TLiteral<"IDR"> | _sinclair_typebox.TLiteral<"ILS"> | _sinclair_typebox.TLiteral<"INR"> | _sinclair_typebox.TLiteral<"ISK"> | _sinclair_typebox.TLiteral<"JMD"> | _sinclair_typebox.TLiteral<"KES"> | _sinclair_typebox.TLiteral<"KHR"> | _sinclair_typebox.TLiteral<"KRW"> | _sinclair_typebox.TLiteral<"KZT"> | _sinclair_typebox.TLiteral<"LAK"> | _sinclair_typebox.TLiteral<"LKR"> | _sinclair_typebox.TLiteral<"MAD"> | _sinclair_typebox.TLiteral<"MMK"> | _sinclair_typebox.TLiteral<"MXN"> | _sinclair_typebox.TLiteral<"MYR"> | _sinclair_typebox.TLiteral<"NGN"> | _sinclair_typebox.TLiteral<"NOK"> | _sinclair_typebox.TLiteral<"NPR"> | _sinclair_typebox.TLiteral<"NZD"> | _sinclair_typebox.TLiteral<"PEN"> | _sinclair_typebox.TLiteral<"PHP"> | _sinclair_typebox.TLiteral<"PKR"> | _sinclair_typebox.TLiteral<"PLN"> | _sinclair_typebox.TLiteral<"PYG"> | _sinclair_typebox.TLiteral<"QAR"> | _sinclair_typebox.TLiteral<"RON"> | _sinclair_typebox.TLiteral<"RSD"> | _sinclair_typebox.TLiteral<"RUB"> | _sinclair_typebox.TLiteral<"SAR"> | _sinclair_typebox.TLiteral<"SEK"> | _sinclair_typebox.TLiteral<"SGD"> | _sinclair_typebox.TLiteral<"THB"> | _sinclair_typebox.TLiteral<"TRY"> | _sinclair_typebox.TLiteral<"TWD"> | _sinclair_typebox.TLiteral<"TZS"> | _sinclair_typebox.TLiteral<"UAH"> | _sinclair_typebox.TLiteral<"UGX"> | _sinclair_typebox.TLiteral<"UYU"> | _sinclair_typebox.TLiteral<"VND"> | _sinclair_typebox.TLiteral<"ZAR"> | _sinclair_typebox.TLiteral<"ZMW">]>;
|
|
235
235
|
features: _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TString>>;
|
|
236
|
-
stripeFields: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, stripe.Stripe.
|
|
236
|
+
stripeFields: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, stripe.Stripe.Product>;
|
|
237
237
|
externalId: _sinclair_typebox.TString;
|
|
238
238
|
billingProvider: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"stripe">]>>;
|
|
239
239
|
active: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TString]>, boolean>;
|
|
@@ -275,7 +275,7 @@ declare const StripePlanServiceSchemas: <SchemaValidator extends _forklaunch_val
|
|
|
275
275
|
cadence: zod_v3.ZodUnion<[zod_v3.ZodLiteral<"week"> | zod_v3.ZodLiteral<"month"> | zod_v3.ZodLiteral<"year">]>;
|
|
276
276
|
currency: zod_v3.ZodUnion<[zod_v3.ZodLiteral<"USD"> | zod_v3.ZodLiteral<"EUR"> | zod_v3.ZodLiteral<"JPY"> | zod_v3.ZodLiteral<"GBP"> | zod_v3.ZodLiteral<"AUD"> | zod_v3.ZodLiteral<"CAD"> | zod_v3.ZodLiteral<"CHF"> | zod_v3.ZodLiteral<"CNY"> | zod_v3.ZodLiteral<"AED"> | zod_v3.ZodLiteral<"ARS"> | zod_v3.ZodLiteral<"BAM"> | zod_v3.ZodLiteral<"BDT"> | zod_v3.ZodLiteral<"BGN"> | zod_v3.ZodLiteral<"BOB"> | zod_v3.ZodLiteral<"BRL"> | zod_v3.ZodLiteral<"CLP"> | zod_v3.ZodLiteral<"COP"> | zod_v3.ZodLiteral<"CRC"> | zod_v3.ZodLiteral<"CZK"> | zod_v3.ZodLiteral<"DKK"> | zod_v3.ZodLiteral<"DZD"> | zod_v3.ZodLiteral<"EGP"> | zod_v3.ZodLiteral<"ETB"> | zod_v3.ZodLiteral<"GEL"> | zod_v3.ZodLiteral<"GTQ"> | zod_v3.ZodLiteral<"HKD"> | zod_v3.ZodLiteral<"HUF"> | zod_v3.ZodLiteral<"IDR"> | zod_v3.ZodLiteral<"ILS"> | zod_v3.ZodLiteral<"INR"> | zod_v3.ZodLiteral<"ISK"> | zod_v3.ZodLiteral<"JMD"> | zod_v3.ZodLiteral<"KES"> | zod_v3.ZodLiteral<"KHR"> | zod_v3.ZodLiteral<"KRW"> | zod_v3.ZodLiteral<"KZT"> | zod_v3.ZodLiteral<"LAK"> | zod_v3.ZodLiteral<"LKR"> | zod_v3.ZodLiteral<"MAD"> | zod_v3.ZodLiteral<"MMK"> | zod_v3.ZodLiteral<"MXN"> | zod_v3.ZodLiteral<"MYR"> | zod_v3.ZodLiteral<"NGN"> | zod_v3.ZodLiteral<"NOK"> | zod_v3.ZodLiteral<"NPR"> | zod_v3.ZodLiteral<"NZD"> | zod_v3.ZodLiteral<"PEN"> | zod_v3.ZodLiteral<"PHP"> | zod_v3.ZodLiteral<"PKR"> | zod_v3.ZodLiteral<"PLN"> | zod_v3.ZodLiteral<"PYG"> | zod_v3.ZodLiteral<"QAR"> | zod_v3.ZodLiteral<"RON"> | zod_v3.ZodLiteral<"RSD"> | zod_v3.ZodLiteral<"RUB"> | zod_v3.ZodLiteral<"SAR"> | zod_v3.ZodLiteral<"SEK"> | zod_v3.ZodLiteral<"SGD"> | zod_v3.ZodLiteral<"THB"> | zod_v3.ZodLiteral<"TRY"> | zod_v3.ZodLiteral<"TWD"> | zod_v3.ZodLiteral<"TZS"> | zod_v3.ZodLiteral<"UAH"> | zod_v3.ZodLiteral<"UGX"> | zod_v3.ZodLiteral<"UYU"> | zod_v3.ZodLiteral<"VND"> | zod_v3.ZodLiteral<"ZAR"> | zod_v3.ZodLiteral<"ZMW">]>;
|
|
277
277
|
features: zod_v3.ZodOptional<zod_v3.ZodArray<zod_v3.ZodString, "many">>;
|
|
278
|
-
stripeFields: zod_v3.ZodType<stripe.Stripe.
|
|
278
|
+
stripeFields: zod_v3.ZodType<stripe.Stripe.Product, zod_v3.ZodTypeDef, stripe.Stripe.Product>;
|
|
279
279
|
externalId: zod_v3.ZodString;
|
|
280
280
|
billingProvider: zod_v3.ZodOptional<zod_v3.ZodUnion<[zod_v3.ZodLiteral<"stripe">]>>;
|
|
281
281
|
active: zod_v3.ZodEffects<zod_v3.ZodBoolean, boolean, unknown>;
|
|
@@ -57,7 +57,7 @@ type StripeUpdatePlanDto = Omit<UpdatePlanDto<typeof PlanCadenceEnum, typeof Cur
|
|
|
57
57
|
stripeFields?: Omit<stripe__default.PlanUpdateParams, PlanOmissions>;
|
|
58
58
|
};
|
|
59
59
|
type StripePlanDto = Omit<PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum>, 'providerFields'> & {
|
|
60
|
-
stripeFields: stripe__default.
|
|
60
|
+
stripeFields: stripe__default.Product;
|
|
61
61
|
};
|
|
62
62
|
type StripePlanDtos = {
|
|
63
63
|
PlanMapper: StripePlanDto;
|
|
@@ -105,7 +105,7 @@ type StripePaymentLinkEntities<StatusEnum> = {
|
|
|
105
105
|
UpdatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
|
|
106
106
|
};
|
|
107
107
|
type StripePlanEntity = PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum> & {
|
|
108
|
-
providerFields: stripe__default.
|
|
108
|
+
providerFields: stripe__default.Product;
|
|
109
109
|
};
|
|
110
110
|
type StripePlanEntities = {
|
|
111
111
|
PlanMapper: StripePlanEntity;
|
|
@@ -162,10 +162,10 @@ type StripePlanMappers<Entities extends StripePlanEntities, Dto extends StripePl
|
|
|
162
162
|
toDto: (entity: Entities['PlanMapper']) => Promise<Dto['PlanMapper']>;
|
|
163
163
|
};
|
|
164
164
|
CreatePlanMapper: {
|
|
165
|
-
toEntity: (dto: Dto['CreatePlanMapper'], em: EntityManager, stripePlan: stripe__default.
|
|
165
|
+
toEntity: (dto: Dto['CreatePlanMapper'], em: EntityManager, stripePlan: stripe__default.Product, ...args: unknown[]) => Promise<Entities['CreatePlanMapper']>;
|
|
166
166
|
};
|
|
167
167
|
UpdatePlanMapper: {
|
|
168
|
-
toEntity: (dto: Dto['UpdatePlanMapper'], em: EntityManager, stripePlan: stripe__default.
|
|
168
|
+
toEntity: (dto: Dto['UpdatePlanMapper'], em: EntityManager, stripePlan: stripe__default.Product, ...args: unknown[]) => Promise<Entities['UpdatePlanMapper']>;
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
|
|
@@ -57,7 +57,7 @@ type StripeUpdatePlanDto = Omit<UpdatePlanDto<typeof PlanCadenceEnum, typeof Cur
|
|
|
57
57
|
stripeFields?: Omit<stripe__default.PlanUpdateParams, PlanOmissions>;
|
|
58
58
|
};
|
|
59
59
|
type StripePlanDto = Omit<PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum>, 'providerFields'> & {
|
|
60
|
-
stripeFields: stripe__default.
|
|
60
|
+
stripeFields: stripe__default.Product;
|
|
61
61
|
};
|
|
62
62
|
type StripePlanDtos = {
|
|
63
63
|
PlanMapper: StripePlanDto;
|
|
@@ -105,7 +105,7 @@ type StripePaymentLinkEntities<StatusEnum> = {
|
|
|
105
105
|
UpdatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
|
|
106
106
|
};
|
|
107
107
|
type StripePlanEntity = PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum> & {
|
|
108
|
-
providerFields: stripe__default.
|
|
108
|
+
providerFields: stripe__default.Product;
|
|
109
109
|
};
|
|
110
110
|
type StripePlanEntities = {
|
|
111
111
|
PlanMapper: StripePlanEntity;
|
|
@@ -162,10 +162,10 @@ type StripePlanMappers<Entities extends StripePlanEntities, Dto extends StripePl
|
|
|
162
162
|
toDto: (entity: Entities['PlanMapper']) => Promise<Dto['PlanMapper']>;
|
|
163
163
|
};
|
|
164
164
|
CreatePlanMapper: {
|
|
165
|
-
toEntity: (dto: Dto['CreatePlanMapper'], em: EntityManager, stripePlan: stripe__default.
|
|
165
|
+
toEntity: (dto: Dto['CreatePlanMapper'], em: EntityManager, stripePlan: stripe__default.Product, ...args: unknown[]) => Promise<Entities['CreatePlanMapper']>;
|
|
166
166
|
};
|
|
167
167
|
UpdatePlanMapper: {
|
|
168
|
-
toEntity: (dto: Dto['UpdatePlanMapper'], em: EntityManager, stripePlan: stripe__default.
|
|
168
|
+
toEntity: (dto: Dto['UpdatePlanMapper'], em: EntityManager, stripePlan: stripe__default.Product, ...args: unknown[]) => Promise<Entities['UpdatePlanMapper']>;
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
|
|
@@ -14,7 +14,7 @@ export type StripePlanMappers<
|
|
|
14
14
|
toEntity: (
|
|
15
15
|
dto: Dto['CreatePlanMapper'],
|
|
16
16
|
em: EntityManager,
|
|
17
|
-
stripePlan: Stripe.
|
|
17
|
+
stripePlan: Stripe.Product,
|
|
18
18
|
...args: unknown[]
|
|
19
19
|
) => Promise<Entities['CreatePlanMapper']>;
|
|
20
20
|
};
|
|
@@ -22,7 +22,7 @@ export type StripePlanMappers<
|
|
|
22
22
|
toEntity: (
|
|
23
23
|
dto: Dto['UpdatePlanMapper'],
|
|
24
24
|
em: EntityManager,
|
|
25
|
-
stripePlan: Stripe.
|
|
25
|
+
stripePlan: Stripe.Product,
|
|
26
26
|
...args: unknown[]
|
|
27
27
|
) => Promise<Entities['UpdatePlanMapper']>;
|
|
28
28
|
};
|
|
@@ -89,7 +89,7 @@ export class StripePlanService<
|
|
|
89
89
|
planDto: StripeCreatePlanDto,
|
|
90
90
|
em?: EntityManager
|
|
91
91
|
): Promise<Dto['PlanMapper']> {
|
|
92
|
-
|
|
92
|
+
let stripePlan = await this.stripeClient.plans.create({
|
|
93
93
|
...planDto.stripeFields,
|
|
94
94
|
amount: planDto.price,
|
|
95
95
|
interval: planDto.cadence,
|
|
@@ -97,6 +97,11 @@ export class StripePlanService<
|
|
|
97
97
|
currency: planDto.currency as string
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
+
// retrieve the plan with the product expanded
|
|
101
|
+
stripePlan = await this.stripeClient.plans.retrieve(stripePlan.id, {
|
|
102
|
+
expand: ['product']
|
|
103
|
+
});
|
|
104
|
+
|
|
100
105
|
const plan = await this.basePlanService.createPlan(
|
|
101
106
|
{
|
|
102
107
|
...planDto,
|
|
@@ -104,7 +109,7 @@ export class StripePlanService<
|
|
|
104
109
|
billingProvider: 'stripe'
|
|
105
110
|
},
|
|
106
111
|
em ?? this.em,
|
|
107
|
-
stripePlan
|
|
112
|
+
stripePlan.product as Stripe.Product
|
|
108
113
|
);
|
|
109
114
|
|
|
110
115
|
return plan;
|
|
@@ -115,8 +120,10 @@ export class StripePlanService<
|
|
|
115
120
|
if (!planEntity.externalId) {
|
|
116
121
|
throw new Error('Plan not found');
|
|
117
122
|
}
|
|
118
|
-
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId
|
|
119
|
-
|
|
123
|
+
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId, {
|
|
124
|
+
expand: ['product']
|
|
125
|
+
});
|
|
126
|
+
planEntity.stripeFields = plan.product as Stripe.Product;
|
|
120
127
|
return planEntity;
|
|
121
128
|
}
|
|
122
129
|
|
|
@@ -146,7 +153,7 @@ export class StripePlanService<
|
|
|
146
153
|
: existingProduct.id;
|
|
147
154
|
|
|
148
155
|
await this.stripeClient.plans.del(planEntity.externalId);
|
|
149
|
-
|
|
156
|
+
let updatedPlan = await this.stripeClient.plans.create({
|
|
150
157
|
...planDto.stripeFields,
|
|
151
158
|
interval: planDto.cadence ?? existingPlan.interval,
|
|
152
159
|
currency: planDto.currency ?? existingPlan.currency,
|
|
@@ -154,6 +161,10 @@ export class StripePlanService<
|
|
|
154
161
|
product: productId
|
|
155
162
|
});
|
|
156
163
|
|
|
164
|
+
updatedPlan = await this.stripeClient.plans.retrieve(updatedPlan.id, {
|
|
165
|
+
expand: ['product']
|
|
166
|
+
});
|
|
167
|
+
|
|
157
168
|
const updatedPlanEntity = await this.basePlanService.updatePlan(
|
|
158
169
|
{
|
|
159
170
|
...planDto,
|
|
@@ -162,10 +173,10 @@ export class StripePlanService<
|
|
|
162
173
|
billingProvider: 'stripe'
|
|
163
174
|
},
|
|
164
175
|
em,
|
|
165
|
-
updatedPlan
|
|
176
|
+
updatedPlan.product as Stripe.Product
|
|
166
177
|
);
|
|
167
178
|
|
|
168
|
-
updatedPlanEntity.stripeFields = updatedPlan;
|
|
179
|
+
updatedPlanEntity.stripeFields = updatedPlan.product as Stripe.Product;
|
|
169
180
|
|
|
170
181
|
return updatedPlanEntity;
|
|
171
182
|
}
|
|
@@ -192,7 +203,13 @@ export class StripePlanService<
|
|
|
192
203
|
const stripePlans = await Promise.all(
|
|
193
204
|
plans.map(async (plan) => {
|
|
194
205
|
try {
|
|
195
|
-
|
|
206
|
+
const fetchedPlan = await this.stripeClient.plans.retrieve(
|
|
207
|
+
plan.externalId,
|
|
208
|
+
{
|
|
209
|
+
expand: ['product']
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
return fetchedPlan.product as Stripe.Product;
|
|
196
213
|
} catch {
|
|
197
214
|
return null;
|
|
198
215
|
}
|
package/lib/services/index.js
CHANGED
|
@@ -336,13 +336,16 @@ var StripePlanService = class {
|
|
|
336
336
|
schemaValidator;
|
|
337
337
|
mappers;
|
|
338
338
|
async createPlan(planDto, em) {
|
|
339
|
-
|
|
339
|
+
let stripePlan = await this.stripeClient.plans.create({
|
|
340
340
|
...planDto.stripeFields,
|
|
341
341
|
amount: planDto.price,
|
|
342
342
|
interval: planDto.cadence,
|
|
343
343
|
product: planDto.name,
|
|
344
344
|
currency: planDto.currency
|
|
345
345
|
});
|
|
346
|
+
stripePlan = await this.stripeClient.plans.retrieve(stripePlan.id, {
|
|
347
|
+
expand: ["product"]
|
|
348
|
+
});
|
|
346
349
|
const plan = await this.basePlanService.createPlan(
|
|
347
350
|
{
|
|
348
351
|
...planDto,
|
|
@@ -350,7 +353,7 @@ var StripePlanService = class {
|
|
|
350
353
|
billingProvider: "stripe"
|
|
351
354
|
},
|
|
352
355
|
em ?? this.em,
|
|
353
|
-
stripePlan
|
|
356
|
+
stripePlan.product
|
|
354
357
|
);
|
|
355
358
|
return plan;
|
|
356
359
|
}
|
|
@@ -359,8 +362,10 @@ var StripePlanService = class {
|
|
|
359
362
|
if (!planEntity.externalId) {
|
|
360
363
|
throw new Error("Plan not found");
|
|
361
364
|
}
|
|
362
|
-
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId
|
|
363
|
-
|
|
365
|
+
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId, {
|
|
366
|
+
expand: ["product"]
|
|
367
|
+
});
|
|
368
|
+
planEntity.stripeFields = plan.product;
|
|
364
369
|
return planEntity;
|
|
365
370
|
}
|
|
366
371
|
async updatePlan(planDto, em) {
|
|
@@ -379,13 +384,16 @@ var StripePlanService = class {
|
|
|
379
384
|
}
|
|
380
385
|
const productId = typeof existingProduct === "string" ? existingProduct : existingProduct.id;
|
|
381
386
|
await this.stripeClient.plans.del(planEntity.externalId);
|
|
382
|
-
|
|
387
|
+
let updatedPlan = await this.stripeClient.plans.create({
|
|
383
388
|
...planDto.stripeFields,
|
|
384
389
|
interval: planDto.cadence ?? existingPlan.interval,
|
|
385
390
|
currency: planDto.currency ?? existingPlan.currency,
|
|
386
391
|
amount: planDto.price ?? existingPlan.amount ?? void 0,
|
|
387
392
|
product: productId
|
|
388
393
|
});
|
|
394
|
+
updatedPlan = await this.stripeClient.plans.retrieve(updatedPlan.id, {
|
|
395
|
+
expand: ["product"]
|
|
396
|
+
});
|
|
389
397
|
const updatedPlanEntity = await this.basePlanService.updatePlan(
|
|
390
398
|
{
|
|
391
399
|
...planDto,
|
|
@@ -394,9 +402,9 @@ var StripePlanService = class {
|
|
|
394
402
|
billingProvider: "stripe"
|
|
395
403
|
},
|
|
396
404
|
em,
|
|
397
|
-
updatedPlan
|
|
405
|
+
updatedPlan.product
|
|
398
406
|
);
|
|
399
|
-
updatedPlanEntity.stripeFields = updatedPlan;
|
|
407
|
+
updatedPlanEntity.stripeFields = updatedPlan.product;
|
|
400
408
|
return updatedPlanEntity;
|
|
401
409
|
}
|
|
402
410
|
async deletePlan(idDto, em) {
|
|
@@ -415,7 +423,13 @@ var StripePlanService = class {
|
|
|
415
423
|
const stripePlans = await Promise.all(
|
|
416
424
|
plans.map(async (plan) => {
|
|
417
425
|
try {
|
|
418
|
-
|
|
426
|
+
const fetchedPlan = await this.stripeClient.plans.retrieve(
|
|
427
|
+
plan.externalId,
|
|
428
|
+
{
|
|
429
|
+
expand: ["product"]
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
return fetchedPlan.product;
|
|
419
433
|
} catch {
|
|
420
434
|
return null;
|
|
421
435
|
}
|
package/lib/services/index.mjs
CHANGED
|
@@ -304,13 +304,16 @@ var StripePlanService = class {
|
|
|
304
304
|
schemaValidator;
|
|
305
305
|
mappers;
|
|
306
306
|
async createPlan(planDto, em) {
|
|
307
|
-
|
|
307
|
+
let stripePlan = await this.stripeClient.plans.create({
|
|
308
308
|
...planDto.stripeFields,
|
|
309
309
|
amount: planDto.price,
|
|
310
310
|
interval: planDto.cadence,
|
|
311
311
|
product: planDto.name,
|
|
312
312
|
currency: planDto.currency
|
|
313
313
|
});
|
|
314
|
+
stripePlan = await this.stripeClient.plans.retrieve(stripePlan.id, {
|
|
315
|
+
expand: ["product"]
|
|
316
|
+
});
|
|
314
317
|
const plan = await this.basePlanService.createPlan(
|
|
315
318
|
{
|
|
316
319
|
...planDto,
|
|
@@ -318,7 +321,7 @@ var StripePlanService = class {
|
|
|
318
321
|
billingProvider: "stripe"
|
|
319
322
|
},
|
|
320
323
|
em ?? this.em,
|
|
321
|
-
stripePlan
|
|
324
|
+
stripePlan.product
|
|
322
325
|
);
|
|
323
326
|
return plan;
|
|
324
327
|
}
|
|
@@ -327,8 +330,10 @@ var StripePlanService = class {
|
|
|
327
330
|
if (!planEntity.externalId) {
|
|
328
331
|
throw new Error("Plan not found");
|
|
329
332
|
}
|
|
330
|
-
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId
|
|
331
|
-
|
|
333
|
+
const plan = await this.stripeClient.plans.retrieve(planEntity.externalId, {
|
|
334
|
+
expand: ["product"]
|
|
335
|
+
});
|
|
336
|
+
planEntity.stripeFields = plan.product;
|
|
332
337
|
return planEntity;
|
|
333
338
|
}
|
|
334
339
|
async updatePlan(planDto, em) {
|
|
@@ -347,13 +352,16 @@ var StripePlanService = class {
|
|
|
347
352
|
}
|
|
348
353
|
const productId = typeof existingProduct === "string" ? existingProduct : existingProduct.id;
|
|
349
354
|
await this.stripeClient.plans.del(planEntity.externalId);
|
|
350
|
-
|
|
355
|
+
let updatedPlan = await this.stripeClient.plans.create({
|
|
351
356
|
...planDto.stripeFields,
|
|
352
357
|
interval: planDto.cadence ?? existingPlan.interval,
|
|
353
358
|
currency: planDto.currency ?? existingPlan.currency,
|
|
354
359
|
amount: planDto.price ?? existingPlan.amount ?? void 0,
|
|
355
360
|
product: productId
|
|
356
361
|
});
|
|
362
|
+
updatedPlan = await this.stripeClient.plans.retrieve(updatedPlan.id, {
|
|
363
|
+
expand: ["product"]
|
|
364
|
+
});
|
|
357
365
|
const updatedPlanEntity = await this.basePlanService.updatePlan(
|
|
358
366
|
{
|
|
359
367
|
...planDto,
|
|
@@ -362,9 +370,9 @@ var StripePlanService = class {
|
|
|
362
370
|
billingProvider: "stripe"
|
|
363
371
|
},
|
|
364
372
|
em,
|
|
365
|
-
updatedPlan
|
|
373
|
+
updatedPlan.product
|
|
366
374
|
);
|
|
367
|
-
updatedPlanEntity.stripeFields = updatedPlan;
|
|
375
|
+
updatedPlanEntity.stripeFields = updatedPlan.product;
|
|
368
376
|
return updatedPlanEntity;
|
|
369
377
|
}
|
|
370
378
|
async deletePlan(idDto, em) {
|
|
@@ -383,7 +391,13 @@ var StripePlanService = class {
|
|
|
383
391
|
const stripePlans = await Promise.all(
|
|
384
392
|
plans.map(async (plan) => {
|
|
385
393
|
try {
|
|
386
|
-
|
|
394
|
+
const fetchedPlan = await this.stripeClient.plans.retrieve(
|
|
395
|
+
plan.externalId,
|
|
396
|
+
{
|
|
397
|
+
expand: ["product"]
|
|
398
|
+
}
|
|
399
|
+
);
|
|
400
|
+
return fetchedPlan.product;
|
|
387
401
|
} catch {
|
|
388
402
|
return null;
|
|
389
403
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-billing-stripe",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "Stripe implementation for forklaunch billing",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
52
|
"stripe": "^20.3.0",
|
|
53
53
|
"zod": "^4.3.6",
|
|
54
|
-
"@forklaunch/implementation-billing-base": "0.8.
|
|
55
|
-
"@forklaunch/interfaces-billing": "0.8.
|
|
54
|
+
"@forklaunch/implementation-billing-base": "0.8.12",
|
|
55
|
+
"@forklaunch/interfaces-billing": "0.8.12"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@typescript/native-preview": "7.0.0-dev.20260204.1",
|