@forklaunch/implementation-billing-base 0.9.0 → 1.0.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/types/index.d.mts +295 -108
- package/lib/domain/types/index.d.ts +295 -108
- package/lib/eject/domain/types/baseBillingEntity.types.ts +6 -6
- package/lib/eject/services/billingPortal.service.ts +3 -6
- package/lib/eject/services/checkoutSession.service.ts +2 -5
- package/lib/eject/services/paymentLink.service.ts +2 -1
- package/lib/eject/services/plan.service.ts +2 -1
- package/lib/eject/services/subscription.service.ts +6 -3
- package/lib/services/index.d.mts +1 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.js +1 -3
- package/lib/services/index.mjs +1 -3
- package/package.json +9 -9
|
@@ -87,21 +87,21 @@ export type BasePlanEntities<
|
|
|
87
87
|
'~entity': (typeof Plan)['~entity'] & {
|
|
88
88
|
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
89
89
|
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
90
|
-
billingProvider: BillingProviderEnum[keyof BillingProviderEnum]
|
|
90
|
+
billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
CreatePlanMapper: {
|
|
94
94
|
'~entity': (typeof Plan)['~entity'] & {
|
|
95
95
|
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
96
96
|
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
97
|
-
billingProvider: BillingProviderEnum[keyof BillingProviderEnum]
|
|
97
|
+
billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
UpdatePlanMapper: {
|
|
101
101
|
'~entity': (typeof Plan)['~entity'] & {
|
|
102
102
|
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
103
103
|
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
104
|
-
billingProvider: BillingProviderEnum[keyof BillingProviderEnum]
|
|
104
|
+
billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
};
|
|
@@ -111,19 +111,19 @@ export type BaseSubscriptionEntities<PartyType, BillingProviderType> = {
|
|
|
111
111
|
SubscriptionMapper: {
|
|
112
112
|
'~entity': (typeof Subscription)['~entity'] & {
|
|
113
113
|
partyType: PartyType[keyof PartyType];
|
|
114
|
-
billingProvider: BillingProviderType[keyof BillingProviderType]
|
|
114
|
+
billingProvider: BillingProviderType[keyof BillingProviderType];
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
117
|
CreateSubscriptionMapper: {
|
|
118
118
|
'~entity': (typeof Subscription)['~entity'] & {
|
|
119
119
|
partyType: PartyType[keyof PartyType];
|
|
120
|
-
billingProvider: BillingProviderType[keyof BillingProviderType]
|
|
120
|
+
billingProvider: BillingProviderType[keyof BillingProviderType];
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
UpdateSubscriptionMapper: {
|
|
124
124
|
'~entity': (typeof Subscription)['~entity'] & {
|
|
125
125
|
partyType: PartyType[keyof PartyType];
|
|
126
|
-
billingProvider: BillingProviderType[keyof BillingProviderType]
|
|
126
|
+
billingProvider: BillingProviderType[keyof BillingProviderType];
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
};
|
|
@@ -21,7 +21,8 @@ export class BaseBillingPortalService<
|
|
|
21
21
|
SchemaValidator extends AnySchemaValidator,
|
|
22
22
|
MapperEntities extends BaseBillingEntities,
|
|
23
23
|
MapperDomains extends BaseBillingDtos = BaseBillingDtos
|
|
24
|
-
> implements BillingPortalService
|
|
24
|
+
> implements BillingPortalService
|
|
25
|
+
{
|
|
25
26
|
private evaluatedTelemetryOptions: {
|
|
26
27
|
logging?: boolean;
|
|
27
28
|
metrics?: boolean;
|
|
@@ -146,11 +147,7 @@ export class BaseBillingPortalService<
|
|
|
146
147
|
);
|
|
147
148
|
|
|
148
149
|
if (this.enableDatabaseBackup) {
|
|
149
|
-
await this.em
|
|
150
|
-
.persist({
|
|
151
|
-
billingPortal
|
|
152
|
-
})
|
|
153
|
-
.flush();
|
|
150
|
+
await this.em.persist(billingPortal).flush();
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
const updatedBillingPortalDto = {
|
|
@@ -30,11 +30,8 @@ export class BaseCheckoutSessionService<
|
|
|
30
30
|
CurrencyEnum,
|
|
31
31
|
StatusEnum
|
|
32
32
|
> = BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
33
|
-
> implements CheckoutSessionService<
|
|
34
|
-
|
|
35
|
-
CurrencyEnum,
|
|
36
|
-
StatusEnum
|
|
37
|
-
> {
|
|
33
|
+
> implements CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
34
|
+
{
|
|
38
35
|
private evaluatedTelemetryOptions: {
|
|
39
36
|
logging?: boolean;
|
|
40
37
|
metrics?: boolean;
|
|
@@ -33,7 +33,8 @@ export class BasePaymentLinkService<
|
|
|
33
33
|
CurrencyEnum,
|
|
34
34
|
StatusEnum
|
|
35
35
|
> = BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
36
|
-
> implements PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
36
|
+
> implements PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
37
|
+
{
|
|
37
38
|
private evaluatedTelemetryOptions: {
|
|
38
39
|
logging?: boolean;
|
|
39
40
|
metrics?: boolean;
|
|
@@ -32,7 +32,8 @@ export class BasePlanService<
|
|
|
32
32
|
CurrencyEnum,
|
|
33
33
|
BillingProviderEnum
|
|
34
34
|
> = BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
|
|
35
|
-
> implements PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
|
|
35
|
+
> implements PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
|
|
36
|
+
{
|
|
36
37
|
private evaluatedTelemetryOptions: {
|
|
37
38
|
logging?: boolean;
|
|
38
39
|
metrics?: boolean;
|
|
@@ -25,9 +25,12 @@ export class BaseSubscriptionService<
|
|
|
25
25
|
PartyType,
|
|
26
26
|
BillingProviderType
|
|
27
27
|
>,
|
|
28
|
-
Dto extends BaseSubscriptionDtos<
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
Dto extends BaseSubscriptionDtos<
|
|
29
|
+
PartyType,
|
|
30
|
+
BillingProviderType
|
|
31
|
+
> = BaseSubscriptionDtos<PartyType, BillingProviderType>
|
|
32
|
+
> implements SubscriptionService<PartyType, BillingProviderType>
|
|
33
|
+
{
|
|
31
34
|
protected evaluatedTelemetryOptions: {
|
|
32
35
|
logging?: boolean;
|
|
33
36
|
metrics?: boolean;
|
package/lib/services/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ export * from '@forklaunch/interfaces-billing/types';
|
|
|
8
8
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
9
9
|
import { EntityManager } from '@mikro-orm/core';
|
|
10
10
|
import { BaseBillingEntities, BaseBillingDtos, BillingPortalMappers, BaseCheckoutSessionEntities, BaseCheckoutSessionDtos, CheckoutSessionMappers, BasePaymentLinkEntities, BasePaymentLinkDtos, PaymentLinkMappers, BasePlanEntities, BasePlanDtos, PlanMappers, BaseSubscriptionEntities, BaseSubscriptionDtos, SubscriptionMappers } from '../domain/types/index.mjs';
|
|
11
|
+
import '@forklaunch/core/persistence';
|
|
11
12
|
|
|
12
13
|
declare class BaseBillingPortalService<SchemaValidator extends AnySchemaValidator, MapperEntities extends BaseBillingEntities, MapperDomains extends BaseBillingDtos = BaseBillingDtos> implements BillingPortalService {
|
|
13
14
|
private evaluatedTelemetryOptions;
|
package/lib/services/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from '@forklaunch/interfaces-billing/types';
|
|
|
8
8
|
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
9
9
|
import { EntityManager } from '@mikro-orm/core';
|
|
10
10
|
import { BaseBillingEntities, BaseBillingDtos, BillingPortalMappers, BaseCheckoutSessionEntities, BaseCheckoutSessionDtos, CheckoutSessionMappers, BasePaymentLinkEntities, BasePaymentLinkDtos, PaymentLinkMappers, BasePlanEntities, BasePlanDtos, PlanMappers, BaseSubscriptionEntities, BaseSubscriptionDtos, SubscriptionMappers } from '../domain/types/index.js';
|
|
11
|
+
import '@forklaunch/core/persistence';
|
|
11
12
|
|
|
12
13
|
declare class BaseBillingPortalService<SchemaValidator extends AnySchemaValidator, MapperEntities extends BaseBillingEntities, MapperDomains extends BaseBillingDtos = BaseBillingDtos> implements BillingPortalService {
|
|
13
14
|
private evaluatedTelemetryOptions;
|
package/lib/services/index.js
CHANGED
|
@@ -112,9 +112,7 @@ var BaseBillingPortalService = class {
|
|
|
112
112
|
...args[0] instanceof import_core.EntityManager ? args.slice(1) : args
|
|
113
113
|
);
|
|
114
114
|
if (this.enableDatabaseBackup) {
|
|
115
|
-
await this.em.persist(
|
|
116
|
-
billingPortal
|
|
117
|
-
}).flush();
|
|
115
|
+
await this.em.persist(billingPortal).flush();
|
|
118
116
|
}
|
|
119
117
|
const updatedBillingPortalDto = {
|
|
120
118
|
...existingBillingPortal,
|
package/lib/services/index.mjs
CHANGED
|
@@ -83,9 +83,7 @@ var BaseBillingPortalService = class {
|
|
|
83
83
|
...args[0] instanceof EntityManager ? args.slice(1) : args
|
|
84
84
|
);
|
|
85
85
|
if (this.enableDatabaseBackup) {
|
|
86
|
-
await this.em.persist(
|
|
87
|
-
billingPortal
|
|
88
|
-
}).flush();
|
|
86
|
+
await this.em.persist(billingPortal).flush();
|
|
89
87
|
}
|
|
90
88
|
const updatedBillingPortalDto = {
|
|
91
89
|
...existingBillingPortal,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-billing-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Billing basic implementation for forklaunch",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"lib/**"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@forklaunch/common": "^0.
|
|
40
|
-
"@forklaunch/core": "^0.
|
|
41
|
-
"@forklaunch/internal": "^0.
|
|
42
|
-
"@forklaunch/validator": "^0.
|
|
43
|
-
"@mikro-orm/core": "7.0.
|
|
39
|
+
"@forklaunch/common": "^1.0.13",
|
|
40
|
+
"@forklaunch/core": "^1.0.13",
|
|
41
|
+
"@forklaunch/internal": "^1.0.13",
|
|
42
|
+
"@forklaunch/validator": "^1.0.13",
|
|
43
|
+
"@mikro-orm/core": "7.0.5",
|
|
44
44
|
"@sinclair/typebox": "^0.34.48",
|
|
45
45
|
"ajv": "^8.18.0",
|
|
46
46
|
"zod": "^4.3.6",
|
|
47
|
-
"@forklaunch/interfaces-billing": "0.
|
|
47
|
+
"@forklaunch/interfaces-billing": "1.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
50
|
+
"@typescript/native-preview": "7.0.0-dev.20260301.1",
|
|
51
51
|
"depcheck": "^1.4.7",
|
|
52
52
|
"prettier": "^3.8.1",
|
|
53
|
-
"typedoc": "^0.28.
|
|
53
|
+
"typedoc": "^0.28.18"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsgo --noEmit && tsup domain/schemas/index.ts services/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",
|