@forklaunch/interfaces-billing 0.1.4 → 0.1.6
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -5
- package/lib/eject/interfaces/interfaces/billingPortal.service.interface.ts +0 -18
- package/lib/eject/interfaces/interfaces/checkoutSession.service.interface.ts +0 -19
- package/lib/eject/interfaces/interfaces/index.ts +0 -5
- package/lib/eject/interfaces/interfaces/paymentLink.service.interface.ts +0 -27
- package/lib/eject/interfaces/interfaces/plan.service.interface.ts +0 -29
- package/lib/eject/interfaces/interfaces/subscription.service.interface.ts +0 -49
- package/lib/eject/types/types/billingPortal.service.types.ts +0 -19
- package/lib/eject/types/types/checkoutSession.service.types.ts +0 -21
- package/lib/eject/types/types/index.ts +0 -5
- package/lib/eject/types/types/paymentLink.service.types.ts +0 -23
- package/lib/eject/types/types/plan.service.types.ts +0 -26
- package/lib/eject/types/types/subscription.service.types.ts +0 -28
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/interfaces-billing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Billing interfaces for forklaunch",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -12,17 +12,27 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Forklift Technologies, Inc.",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./interfaces": {
|
|
17
|
+
"types": "./lib/interfaces/index.d.ts",
|
|
18
|
+
"import": "./lib/interfaces/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./types": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"import": "./lib/types/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
15
25
|
"files": [
|
|
16
26
|
"lib/**"
|
|
17
27
|
],
|
|
18
28
|
"dependencies": {
|
|
19
|
-
"@forklaunch/common": "^0.2.
|
|
20
|
-
"@mikro-orm/core": "^6.4.
|
|
29
|
+
"@forklaunch/common": "^0.2.6",
|
|
30
|
+
"@mikro-orm/core": "^6.4.12"
|
|
21
31
|
},
|
|
22
32
|
"devDependencies": {
|
|
23
33
|
"depcheck": "^1.4.7",
|
|
24
34
|
"prettier": "^3.5.3",
|
|
25
|
-
"typedoc": "^0.28.
|
|
35
|
+
"typedoc": "^0.28.2"
|
|
26
36
|
},
|
|
27
37
|
"scripts": {
|
|
28
38
|
"build": "tsc && pnpm package:eject",
|
|
@@ -31,7 +41,8 @@
|
|
|
31
41
|
"format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
|
|
32
42
|
"lint": "eslint . -c eslint.config.mjs",
|
|
33
43
|
"lint:fix": "eslint . -c eslint.config.mjs --fix",
|
|
34
|
-
"package:eject": "mkdir -p lib/eject && cp -r interfaces lib/eject/interfaces && cp -r types lib/eject/types",
|
|
44
|
+
"package:eject": "rm -rf lib/eject && mkdir -p lib/eject && cp -r interfaces lib/eject/interfaces && cp -r types lib/eject/types",
|
|
45
|
+
"publish:package": "./publish-package.bash",
|
|
35
46
|
"test": "vitest --passWithNoTests"
|
|
36
47
|
}
|
|
37
48
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BillingPortalServiceParameters } from '../types/billingPortal.service.types';
|
|
2
|
-
|
|
3
|
-
export interface BillingPortalService<
|
|
4
|
-
Params extends BillingPortalServiceParameters = BillingPortalServiceParameters
|
|
5
|
-
> {
|
|
6
|
-
// for generating external links
|
|
7
|
-
// store in cache, for permissions
|
|
8
|
-
createBillingPortalSession: (
|
|
9
|
-
billingPortalDto: Params['CreateBillingPortalDto']
|
|
10
|
-
) => Promise<Params['BillingPortalDto']>;
|
|
11
|
-
getBillingPortalSession: (
|
|
12
|
-
idDto: Params['IdDto']
|
|
13
|
-
) => Promise<Params['BillingPortalDto']>;
|
|
14
|
-
updateBillingPortalSession: (
|
|
15
|
-
billingPortalDto: Params['UpdateBillingPortalDto']
|
|
16
|
-
) => Promise<Params['BillingPortalDto']>;
|
|
17
|
-
expireBillingPortalSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CheckoutSessionServiceParameters } from '../types/checkoutSession.service.types';
|
|
2
|
-
export interface CheckoutSessionService<
|
|
3
|
-
PaymentMethodEnum,
|
|
4
|
-
Params extends
|
|
5
|
-
CheckoutSessionServiceParameters<PaymentMethodEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum>
|
|
6
|
-
> {
|
|
7
|
-
// for generating external links
|
|
8
|
-
// store in cache, for permissions
|
|
9
|
-
createCheckoutSession: (
|
|
10
|
-
checkoutSessionDto: Params['CreateCheckoutSessionDto']
|
|
11
|
-
) => Promise<Params['CheckoutSessionDto']>;
|
|
12
|
-
getCheckoutSession: (
|
|
13
|
-
idDto: Params['IdDto']
|
|
14
|
-
) => Promise<Params['CheckoutSessionDto']>;
|
|
15
|
-
expireCheckoutSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
16
|
-
|
|
17
|
-
handleCheckoutSuccess: (idDto: Params['IdDto']) => Promise<void>;
|
|
18
|
-
handleCheckoutFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PaymentLinkServiceParameters } from '../types/paymentLink.service.types';
|
|
2
|
-
|
|
3
|
-
export interface PaymentLinkService<
|
|
4
|
-
CurrencyEnum,
|
|
5
|
-
Params extends
|
|
6
|
-
PaymentLinkServiceParameters<CurrencyEnum> = PaymentLinkServiceParameters<CurrencyEnum>
|
|
7
|
-
> {
|
|
8
|
-
// for one off products that are not part of a subscription
|
|
9
|
-
// think about how permissions work on payment links, but these should be ephemeral
|
|
10
|
-
// store in cache, for permissions
|
|
11
|
-
createPaymentLink: (
|
|
12
|
-
paymentLink: Params['CreatePaymentLinkDto']
|
|
13
|
-
) => Promise<Params['PaymentLinkDto']>;
|
|
14
|
-
updatePaymentLink: (
|
|
15
|
-
paymentLink: Params['UpdatePaymentLinkDto']
|
|
16
|
-
) => Promise<Params['PaymentLinkDto']>;
|
|
17
|
-
getPaymentLink: (idDto: Params['IdDto']) => Promise<Params['PaymentLinkDto']>;
|
|
18
|
-
expirePaymentLink: (idDto: Params['IdDto']) => Promise<void>;
|
|
19
|
-
|
|
20
|
-
handlePaymentSuccess: (idDto: Params['IdDto']) => Promise<void>;
|
|
21
|
-
handlePaymentFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
22
|
-
|
|
23
|
-
// admin API, make sure that permissions are correct here
|
|
24
|
-
listPaymentLinks: (
|
|
25
|
-
idsDto?: Params['IdsDto']
|
|
26
|
-
) => Promise<Params['PaymentLinkDto'][]>;
|
|
27
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { EntityManager } from '@mikro-orm/core';
|
|
2
|
-
import { PlanServiceParameters } from '../types/plan.service.types';
|
|
3
|
-
|
|
4
|
-
export interface PlanService<
|
|
5
|
-
PlanCadenceEnum,
|
|
6
|
-
BillingProviderEnum,
|
|
7
|
-
Params extends PlanServiceParameters<
|
|
8
|
-
PlanCadenceEnum,
|
|
9
|
-
BillingProviderEnum
|
|
10
|
-
> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>
|
|
11
|
-
> {
|
|
12
|
-
createPlan: (
|
|
13
|
-
planDto: Params['CreatePlanDto'],
|
|
14
|
-
em?: EntityManager
|
|
15
|
-
) => Promise<Params['PlanDto']>;
|
|
16
|
-
getPlan: (
|
|
17
|
-
idDto: Params['IdDto'],
|
|
18
|
-
em?: EntityManager
|
|
19
|
-
) => Promise<Params['PlanDto']>;
|
|
20
|
-
updatePlan: (
|
|
21
|
-
planDto: Params['UpdatePlanDto'],
|
|
22
|
-
em?: EntityManager
|
|
23
|
-
) => Promise<Params['PlanDto']>;
|
|
24
|
-
deletePlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<void>;
|
|
25
|
-
listPlans: (
|
|
26
|
-
idsDto?: Params['IdsDto'],
|
|
27
|
-
em?: EntityManager
|
|
28
|
-
) => Promise<Params['PlanDto'][]>;
|
|
29
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { EntityManager } from '@mikro-orm/core';
|
|
2
|
-
import { SubscriptionServiceParameters } from '../types/subscription.service.types';
|
|
3
|
-
|
|
4
|
-
export interface SubscriptionService<
|
|
5
|
-
PartyType,
|
|
6
|
-
BillingProviderType,
|
|
7
|
-
Params extends SubscriptionServiceParameters<
|
|
8
|
-
PartyType,
|
|
9
|
-
BillingProviderType
|
|
10
|
-
> = SubscriptionServiceParameters<PartyType, BillingProviderType>
|
|
11
|
-
> {
|
|
12
|
-
// store this in a table
|
|
13
|
-
createSubscription: (
|
|
14
|
-
subscriptionDto: Params['CreateSubscriptionDto'],
|
|
15
|
-
em?: EntityManager
|
|
16
|
-
) => Promise<Params['SubscriptionDto']>;
|
|
17
|
-
getSubscription: (
|
|
18
|
-
idDto: Params['IdDto'],
|
|
19
|
-
em?: EntityManager
|
|
20
|
-
) => Promise<Params['SubscriptionDto']>;
|
|
21
|
-
getUserSubscription: (
|
|
22
|
-
idDto: Params['IdDto'],
|
|
23
|
-
em?: EntityManager
|
|
24
|
-
) => Promise<Params['SubscriptionDto']>;
|
|
25
|
-
getOrganizationSubscription: (
|
|
26
|
-
idDto: Params['IdDto'],
|
|
27
|
-
em?: EntityManager
|
|
28
|
-
) => Promise<Params['SubscriptionDto']>;
|
|
29
|
-
updateSubscription: (
|
|
30
|
-
subscriptionDto: Params['UpdateSubscriptionDto'],
|
|
31
|
-
em?: EntityManager
|
|
32
|
-
) => Promise<Params['SubscriptionDto']>;
|
|
33
|
-
deleteSubscription: (
|
|
34
|
-
id: Params['IdDto'],
|
|
35
|
-
em?: EntityManager
|
|
36
|
-
) => Promise<void>;
|
|
37
|
-
listSubscriptions: (
|
|
38
|
-
idsDto: Params['IdsDto'],
|
|
39
|
-
em?: EntityManager
|
|
40
|
-
) => Promise<Params['SubscriptionDto'][]>;
|
|
41
|
-
cancelSubscription: (
|
|
42
|
-
idDto: Params['IdDto'],
|
|
43
|
-
em?: EntityManager
|
|
44
|
-
) => Promise<void>;
|
|
45
|
-
resumeSubscription: (
|
|
46
|
-
idDto: Params['IdDto'],
|
|
47
|
-
em?: EntityManager
|
|
48
|
-
) => Promise<void>;
|
|
49
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IdDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
|
-
|
|
3
|
-
export type CreateBillingPortalDto = {
|
|
4
|
-
customerId: string;
|
|
5
|
-
uri: string;
|
|
6
|
-
expiresAt: Date;
|
|
7
|
-
extraFields?: unknown;
|
|
8
|
-
};
|
|
9
|
-
export type UpdateBillingPortalDto = IdDto & Partial<CreateBillingPortalDto>;
|
|
10
|
-
export type BillingPortalDto = IdDto &
|
|
11
|
-
CreateBillingPortalDto &
|
|
12
|
-
Partial<RecordTimingDto>;
|
|
13
|
-
|
|
14
|
-
export type BillingPortalServiceParameters = {
|
|
15
|
-
CreateBillingPortalDto: CreateBillingPortalDto;
|
|
16
|
-
UpdateBillingPortalDto: UpdateBillingPortalDto;
|
|
17
|
-
BillingPortalDto: BillingPortalDto;
|
|
18
|
-
IdDto: IdDto;
|
|
19
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IdDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
|
-
|
|
3
|
-
export type CreateCheckoutSessionDto<PaymentMethodEnum> = {
|
|
4
|
-
customerId: string;
|
|
5
|
-
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
6
|
-
metadata?: unknown;
|
|
7
|
-
successRedirectUri: string;
|
|
8
|
-
cancelRedirectUri: string;
|
|
9
|
-
extraFields?: unknown;
|
|
10
|
-
};
|
|
11
|
-
export type UpdateCheckoutSessionDto<PaymentMethodEnum> = IdDto &
|
|
12
|
-
Partial<CreateCheckoutSessionDto<PaymentMethodEnum>>;
|
|
13
|
-
export type CheckoutSessionDto<PaymentMethodEnum> = IdDto &
|
|
14
|
-
CreateCheckoutSessionDto<PaymentMethodEnum> &
|
|
15
|
-
Partial<RecordTimingDto>;
|
|
16
|
-
|
|
17
|
-
export type CheckoutSessionServiceParameters<PaymentMethodEnum> = {
|
|
18
|
-
CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum>;
|
|
19
|
-
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum>;
|
|
20
|
-
IdDto: IdDto;
|
|
21
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
|
-
|
|
3
|
-
export type CreatePaymentLinkDto<CurrencyEnum> = {
|
|
4
|
-
amount: number;
|
|
5
|
-
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
6
|
-
metadata?: unknown;
|
|
7
|
-
successRedirectUri: string;
|
|
8
|
-
cancelRedirectUri: string;
|
|
9
|
-
extraFields?: unknown;
|
|
10
|
-
};
|
|
11
|
-
export type UpdatePaymentLinkDto<CurrencyEnum> = IdDto &
|
|
12
|
-
Partial<CreatePaymentLinkDto<CurrencyEnum>>;
|
|
13
|
-
export type PaymentLinkDto<CurrencyEnum> = IdDto &
|
|
14
|
-
CreatePaymentLinkDto<CurrencyEnum> &
|
|
15
|
-
Partial<RecordTimingDto>;
|
|
16
|
-
|
|
17
|
-
export type PaymentLinkServiceParameters<CurrencyEnum> = {
|
|
18
|
-
CreatePaymentLinkDto: CreatePaymentLinkDto<CurrencyEnum>;
|
|
19
|
-
UpdatePaymentLinkDto: UpdatePaymentLinkDto<CurrencyEnum>;
|
|
20
|
-
PaymentLinkDto: PaymentLinkDto<CurrencyEnum>;
|
|
21
|
-
IdDto: IdDto;
|
|
22
|
-
IdsDto: IdsDto;
|
|
23
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
|
-
|
|
3
|
-
export type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> = {
|
|
4
|
-
active: boolean;
|
|
5
|
-
name: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
price: number;
|
|
8
|
-
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
9
|
-
features?: string[];
|
|
10
|
-
extraFields?: unknown;
|
|
11
|
-
externalId: string;
|
|
12
|
-
billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
|
|
13
|
-
};
|
|
14
|
-
export type UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
|
|
15
|
-
Partial<CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>>;
|
|
16
|
-
export type PlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
|
|
17
|
-
CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> &
|
|
18
|
-
Partial<RecordTimingDto>;
|
|
19
|
-
|
|
20
|
-
export type PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = {
|
|
21
|
-
CreatePlanDto: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
22
|
-
UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
23
|
-
PlanDto: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
24
|
-
IdDto: IdDto;
|
|
25
|
-
IdsDto: IdsDto;
|
|
26
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
|
-
|
|
3
|
-
export type CreateSubscriptionDto<PartyType, BillingProviderType> = {
|
|
4
|
-
partyId: string;
|
|
5
|
-
partyType: PartyType[keyof PartyType];
|
|
6
|
-
description?: string;
|
|
7
|
-
active: boolean;
|
|
8
|
-
productId: string;
|
|
9
|
-
extraFields?: unknown;
|
|
10
|
-
externalId: string;
|
|
11
|
-
billingProvider?: BillingProviderType[keyof BillingProviderType];
|
|
12
|
-
startDate: Date;
|
|
13
|
-
endDate: Date;
|
|
14
|
-
status: string;
|
|
15
|
-
};
|
|
16
|
-
export type UpdateSubscriptionDto<PartyType, BillingProviderType> = IdDto &
|
|
17
|
-
Partial<CreateSubscriptionDto<PartyType, BillingProviderType>>;
|
|
18
|
-
export type SubscriptionDto<PartyType, BillingProviderType> = IdDto &
|
|
19
|
-
CreateSubscriptionDto<PartyType, BillingProviderType> &
|
|
20
|
-
Partial<RecordTimingDto>;
|
|
21
|
-
|
|
22
|
-
export type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
|
|
23
|
-
CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
|
|
24
|
-
UpdateSubscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>;
|
|
25
|
-
SubscriptionDto: SubscriptionDto<PartyType, BillingProviderType>;
|
|
26
|
-
IdDto: IdDto;
|
|
27
|
-
IdsDto: IdsDto;
|
|
28
|
-
};
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/lib/index.js
DELETED