@forklaunch/interfaces-billing 0.3.0 → 0.3.3
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/domain/interfaces/checkoutSession.service.interface.ts +7 -1
- package/lib/eject/domain/interfaces/paymentLink.service.interface.ts +3 -1
- package/lib/eject/domain/interfaces/plan.service.interface.ts +3 -1
- package/lib/eject/domain/types/billingPortal.service.types.ts +6 -6
- package/lib/eject/domain/types/checkoutSession.service.types.ts +32 -12
- package/lib/eject/domain/types/paymentLink.service.types.ts +31 -19
- package/lib/eject/domain/types/plan.service.types.ts +36 -20
- package/lib/eject/domain/types/subscription.service.types.ts +21 -17
- package/lib/interfaces/index.d.mts +3 -3
- package/lib/interfaces/index.d.ts +3 -3
- package/lib/types/index.d.mts +38 -40
- package/lib/types/index.d.ts +38 -40
- package/package.json +5 -5
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { CheckoutSessionServiceParameters } from '../types/checkoutSession.service.types';
|
|
2
2
|
export interface CheckoutSessionService<
|
|
3
3
|
PaymentMethodEnum,
|
|
4
|
+
CurrencyEnum,
|
|
4
5
|
StatusEnum,
|
|
5
6
|
Params extends CheckoutSessionServiceParameters<
|
|
6
7
|
PaymentMethodEnum,
|
|
8
|
+
CurrencyEnum,
|
|
7
9
|
StatusEnum
|
|
8
|
-
> = CheckoutSessionServiceParameters<
|
|
10
|
+
> = CheckoutSessionServiceParameters<
|
|
11
|
+
PaymentMethodEnum,
|
|
12
|
+
CurrencyEnum,
|
|
13
|
+
StatusEnum
|
|
14
|
+
>
|
|
9
15
|
> {
|
|
10
16
|
// for generating external links
|
|
11
17
|
// store in cache, for permissions
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { PaymentLinkServiceParameters } from '../types/paymentLink.service.types';
|
|
2
2
|
|
|
3
3
|
export interface PaymentLinkService<
|
|
4
|
+
PaymentMethodEnum,
|
|
4
5
|
CurrencyEnum,
|
|
5
6
|
StatusEnum,
|
|
6
7
|
Params extends PaymentLinkServiceParameters<
|
|
8
|
+
PaymentMethodEnum,
|
|
7
9
|
CurrencyEnum,
|
|
8
10
|
StatusEnum
|
|
9
|
-
> = PaymentLinkServiceParameters<CurrencyEnum, StatusEnum>
|
|
11
|
+
> = PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
10
12
|
> {
|
|
11
13
|
// for one off products that are not part of a subscription
|
|
12
14
|
// think about how permissions work on payment links, but these should be ephemeral
|
|
@@ -3,11 +3,13 @@ import { PlanServiceParameters } from '../types/plan.service.types';
|
|
|
3
3
|
|
|
4
4
|
export interface PlanService<
|
|
5
5
|
PlanCadenceEnum,
|
|
6
|
+
CurrencyEnum,
|
|
6
7
|
BillingProviderEnum,
|
|
7
8
|
Params extends PlanServiceParameters<
|
|
8
9
|
PlanCadenceEnum,
|
|
10
|
+
CurrencyEnum,
|
|
9
11
|
BillingProviderEnum
|
|
10
|
-
> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>
|
|
12
|
+
> = PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>
|
|
11
13
|
> {
|
|
12
14
|
createPlan: (
|
|
13
15
|
planDto: Params['CreatePlanDto'],
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IdDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
export type CreateBillingPortalDto = {
|
|
3
|
+
export type CreateBillingPortalDto = Partial<IdDto> & {
|
|
4
4
|
customerId: string;
|
|
5
|
-
uri
|
|
5
|
+
uri?: string;
|
|
6
6
|
expiresAt: Date;
|
|
7
|
-
|
|
7
|
+
providerFields?: unknown;
|
|
8
8
|
};
|
|
9
|
-
export type UpdateBillingPortalDto =
|
|
10
|
-
export type BillingPortalDto =
|
|
11
|
-
|
|
9
|
+
export type UpdateBillingPortalDto = Partial<CreateBillingPortalDto> & IdDto;
|
|
10
|
+
export type BillingPortalDto = CreateBillingPortalDto &
|
|
11
|
+
IdDto &
|
|
12
12
|
Partial<RecordTimingDto>;
|
|
13
13
|
|
|
14
14
|
export type BillingPortalServiceParameters = {
|
|
@@ -1,26 +1,46 @@
|
|
|
1
1
|
import { IdDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
export type CreateCheckoutSessionDto<
|
|
3
|
+
export type CreateCheckoutSessionDto<
|
|
4
|
+
PaymentMethodEnum,
|
|
5
|
+
CurrencyEnum,
|
|
6
|
+
StatusEnum
|
|
7
|
+
> = Partial<IdDto> & {
|
|
4
8
|
customerId: string;
|
|
5
9
|
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
6
|
-
|
|
7
|
-
successRedirectUri
|
|
8
|
-
cancelRedirectUri
|
|
10
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
11
|
+
successRedirectUri?: string;
|
|
12
|
+
cancelRedirectUri?: string;
|
|
9
13
|
expiresAt: Date;
|
|
10
14
|
status: StatusEnum[keyof StatusEnum];
|
|
11
|
-
|
|
15
|
+
providerFields?: unknown;
|
|
12
16
|
};
|
|
13
|
-
export type UpdateCheckoutSessionDto<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export type UpdateCheckoutSessionDto<
|
|
18
|
+
PaymentMethodEnum,
|
|
19
|
+
CurrencyEnum,
|
|
20
|
+
StatusEnum
|
|
21
|
+
> = Partial<
|
|
22
|
+
CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>
|
|
23
|
+
> &
|
|
24
|
+
IdDto;
|
|
25
|
+
export type CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
|
|
26
|
+
CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> &
|
|
27
|
+
IdDto &
|
|
28
|
+
Partial<RecordTimingDto>;
|
|
18
29
|
|
|
19
|
-
export type CheckoutSessionServiceParameters<
|
|
30
|
+
export type CheckoutSessionServiceParameters<
|
|
31
|
+
PaymentMethodEnum,
|
|
32
|
+
CurrencyEnum,
|
|
33
|
+
StatusEnum
|
|
34
|
+
> = {
|
|
20
35
|
CreateCheckoutSessionDto: CreateCheckoutSessionDto<
|
|
21
36
|
PaymentMethodEnum,
|
|
37
|
+
CurrencyEnum,
|
|
38
|
+
StatusEnum
|
|
39
|
+
>;
|
|
40
|
+
CheckoutSessionDto: CheckoutSessionDto<
|
|
41
|
+
PaymentMethodEnum,
|
|
42
|
+
CurrencyEnum,
|
|
22
43
|
StatusEnum
|
|
23
44
|
>;
|
|
24
|
-
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
|
|
25
45
|
IdDto: IdDto;
|
|
26
46
|
};
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
export type CreatePaymentLinkDto<CurrencyEnum, StatusEnum> =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
export type CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
|
|
4
|
+
Partial<IdDto> & {
|
|
5
|
+
amount: number;
|
|
6
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
7
|
+
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
8
|
+
status: StatusEnum[keyof StatusEnum];
|
|
9
|
+
providerFields?: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
|
|
12
|
+
Partial<CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>> &
|
|
13
|
+
IdDto;
|
|
14
|
+
export type PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
|
|
15
|
+
CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> &
|
|
16
|
+
IdDto &
|
|
17
|
+
Partial<RecordTimingDto>;
|
|
18
18
|
|
|
19
|
-
export type PaymentLinkServiceParameters<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
export type PaymentLinkServiceParameters<
|
|
20
|
+
PaymentMethodEnum,
|
|
21
|
+
CurrencyEnum,
|
|
22
|
+
StatusEnum
|
|
23
|
+
> = {
|
|
24
|
+
CreatePaymentLinkDto: CreatePaymentLinkDto<
|
|
25
|
+
PaymentMethodEnum,
|
|
26
|
+
CurrencyEnum,
|
|
27
|
+
StatusEnum
|
|
28
|
+
>;
|
|
29
|
+
UpdatePaymentLinkDto: UpdatePaymentLinkDto<
|
|
30
|
+
PaymentMethodEnum,
|
|
31
|
+
CurrencyEnum,
|
|
32
|
+
StatusEnum
|
|
33
|
+
>;
|
|
34
|
+
PaymentLinkDto: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
23
35
|
IdDto: IdDto;
|
|
24
36
|
IdsDto: IdsDto;
|
|
25
37
|
};
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
export type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export type
|
|
17
|
-
CreatePlanDto<PlanCadenceEnum, BillingProviderEnum
|
|
18
|
-
|
|
3
|
+
export type CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> =
|
|
4
|
+
Partial<IdDto> & {
|
|
5
|
+
active: boolean;
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
price: number;
|
|
9
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
10
|
+
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
11
|
+
features?: string[];
|
|
12
|
+
providerFields?: unknown;
|
|
13
|
+
externalId: string;
|
|
14
|
+
billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
|
|
15
|
+
};
|
|
16
|
+
export type UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> =
|
|
17
|
+
Partial<CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> &
|
|
18
|
+
IdDto;
|
|
19
|
+
export type PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> =
|
|
20
|
+
CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> &
|
|
21
|
+
IdDto &
|
|
22
|
+
Partial<RecordTimingDto>;
|
|
19
23
|
|
|
20
|
-
export type PlanServiceParameters<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
export type PlanServiceParameters<
|
|
25
|
+
PlanCadenceEnum,
|
|
26
|
+
CurrencyEnum,
|
|
27
|
+
BillingProviderEnum
|
|
28
|
+
> = {
|
|
29
|
+
CreatePlanDto: CreatePlanDto<
|
|
30
|
+
PlanCadenceEnum,
|
|
31
|
+
CurrencyEnum,
|
|
32
|
+
BillingProviderEnum
|
|
33
|
+
>;
|
|
34
|
+
UpdatePlanDto: UpdatePlanDto<
|
|
35
|
+
PlanCadenceEnum,
|
|
36
|
+
CurrencyEnum,
|
|
37
|
+
BillingProviderEnum
|
|
38
|
+
>;
|
|
39
|
+
PlanDto: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
24
40
|
IdDto: IdDto;
|
|
25
41
|
IdsDto: IdsDto;
|
|
26
42
|
};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
export type CreateSubscriptionDto<PartyType, BillingProviderType> =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
export type CreateSubscriptionDto<PartyType, BillingProviderType> =
|
|
4
|
+
Partial<IdDto> & {
|
|
5
|
+
partyId: string;
|
|
6
|
+
partyType: PartyType[keyof PartyType];
|
|
7
|
+
description?: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
productId: string;
|
|
10
|
+
providerFields?: unknown;
|
|
11
|
+
externalId: string;
|
|
12
|
+
billingProvider?: BillingProviderType[keyof BillingProviderType];
|
|
13
|
+
startDate: Date;
|
|
14
|
+
endDate?: Date;
|
|
15
|
+
status: string;
|
|
16
|
+
};
|
|
17
|
+
export type UpdateSubscriptionDto<PartyType, BillingProviderType> = Partial<
|
|
18
|
+
CreateSubscriptionDto<PartyType, BillingProviderType>
|
|
19
|
+
> &
|
|
20
|
+
IdDto;
|
|
21
|
+
export type SubscriptionDto<PartyType, BillingProviderType> =
|
|
19
22
|
CreateSubscriptionDto<PartyType, BillingProviderType> &
|
|
20
|
-
|
|
23
|
+
IdDto &
|
|
24
|
+
Partial<RecordTimingDto>;
|
|
21
25
|
|
|
22
26
|
export type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
|
|
23
27
|
CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
|
|
@@ -9,7 +9,7 @@ interface BillingPortalService<Params extends BillingPortalServiceParameters = B
|
|
|
9
9
|
expireBillingPortalSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
interface CheckoutSessionService<PaymentMethodEnum, StatusEnum, Params extends CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum>> {
|
|
12
|
+
interface CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum, Params extends CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum>> {
|
|
13
13
|
createCheckoutSession: (checkoutSessionDto: Params['CreateCheckoutSessionDto']) => Promise<Params['CheckoutSessionDto']>;
|
|
14
14
|
getCheckoutSession: (idDto: Params['IdDto']) => Promise<Params['CheckoutSessionDto']>;
|
|
15
15
|
expireCheckoutSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
@@ -17,7 +17,7 @@ interface CheckoutSessionService<PaymentMethodEnum, StatusEnum, Params extends C
|
|
|
17
17
|
handleCheckoutFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface PaymentLinkService<CurrencyEnum, StatusEnum, Params extends PaymentLinkServiceParameters<CurrencyEnum, StatusEnum> = PaymentLinkServiceParameters<CurrencyEnum, StatusEnum>> {
|
|
20
|
+
interface PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum, Params extends PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum>> {
|
|
21
21
|
createPaymentLink: (paymentLink: Params['CreatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
|
|
22
22
|
updatePaymentLink: (paymentLink: Params['UpdatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
|
|
23
23
|
getPaymentLink: (idDto: Params['IdDto']) => Promise<Params['PaymentLinkDto']>;
|
|
@@ -27,7 +27,7 @@ interface PaymentLinkService<CurrencyEnum, StatusEnum, Params extends PaymentLin
|
|
|
27
27
|
listPaymentLinks: (idsDto?: Params['IdsDto']) => Promise<Params['PaymentLinkDto'][]>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
interface PlanService<PlanCadenceEnum, BillingProviderEnum, Params extends PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>> {
|
|
30
|
+
interface PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, Params extends PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> {
|
|
31
31
|
createPlan: (planDto: Params['CreatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
|
32
32
|
getPlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
|
33
33
|
updatePlan: (planDto: Params['UpdatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
|
@@ -9,7 +9,7 @@ interface BillingPortalService<Params extends BillingPortalServiceParameters = B
|
|
|
9
9
|
expireBillingPortalSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
interface CheckoutSessionService<PaymentMethodEnum, StatusEnum, Params extends CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum>> {
|
|
12
|
+
interface CheckoutSessionService<PaymentMethodEnum, CurrencyEnum, StatusEnum, Params extends CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum>> {
|
|
13
13
|
createCheckoutSession: (checkoutSessionDto: Params['CreateCheckoutSessionDto']) => Promise<Params['CheckoutSessionDto']>;
|
|
14
14
|
getCheckoutSession: (idDto: Params['IdDto']) => Promise<Params['CheckoutSessionDto']>;
|
|
15
15
|
expireCheckoutSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
@@ -17,7 +17,7 @@ interface CheckoutSessionService<PaymentMethodEnum, StatusEnum, Params extends C
|
|
|
17
17
|
handleCheckoutFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface PaymentLinkService<CurrencyEnum, StatusEnum, Params extends PaymentLinkServiceParameters<CurrencyEnum, StatusEnum> = PaymentLinkServiceParameters<CurrencyEnum, StatusEnum>> {
|
|
20
|
+
interface PaymentLinkService<PaymentMethodEnum, CurrencyEnum, StatusEnum, Params extends PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum>> {
|
|
21
21
|
createPaymentLink: (paymentLink: Params['CreatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
|
|
22
22
|
updatePaymentLink: (paymentLink: Params['UpdatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
|
|
23
23
|
getPaymentLink: (idDto: Params['IdDto']) => Promise<Params['PaymentLinkDto']>;
|
|
@@ -27,7 +27,7 @@ interface PaymentLinkService<CurrencyEnum, StatusEnum, Params extends PaymentLin
|
|
|
27
27
|
listPaymentLinks: (idsDto?: Params['IdsDto']) => Promise<Params['PaymentLinkDto'][]>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
interface PlanService<PlanCadenceEnum, BillingProviderEnum, Params extends PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>> {
|
|
30
|
+
interface PlanService<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, Params extends PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> {
|
|
31
31
|
createPlan: (planDto: Params['CreatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
|
32
32
|
getPlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
|
33
33
|
updatePlan: (planDto: Params['UpdatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
|
package/lib/types/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IdDto, RecordTimingDto, IdsDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
type CreateBillingPortalDto = {
|
|
3
|
+
type CreateBillingPortalDto = Partial<IdDto> & {
|
|
4
4
|
customerId: string;
|
|
5
|
-
uri
|
|
5
|
+
uri?: string;
|
|
6
6
|
expiresAt: Date;
|
|
7
|
-
|
|
7
|
+
providerFields?: unknown;
|
|
8
8
|
};
|
|
9
|
-
type UpdateBillingPortalDto =
|
|
10
|
-
type BillingPortalDto =
|
|
9
|
+
type UpdateBillingPortalDto = Partial<CreateBillingPortalDto> & IdDto;
|
|
10
|
+
type BillingPortalDto = CreateBillingPortalDto & IdDto & Partial<RecordTimingDto>;
|
|
11
11
|
type BillingPortalServiceParameters = {
|
|
12
12
|
CreateBillingPortalDto: CreateBillingPortalDto;
|
|
13
13
|
UpdateBillingPortalDto: UpdateBillingPortalDto;
|
|
@@ -15,80 +15,78 @@ type BillingPortalServiceParameters = {
|
|
|
15
15
|
IdDto: IdDto;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum> = {
|
|
18
|
+
type CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<IdDto> & {
|
|
19
19
|
customerId: string;
|
|
20
20
|
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
21
|
-
|
|
22
|
-
successRedirectUri
|
|
23
|
-
cancelRedirectUri
|
|
21
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
22
|
+
successRedirectUri?: string;
|
|
23
|
+
cancelRedirectUri?: string;
|
|
24
24
|
expiresAt: Date;
|
|
25
25
|
status: StatusEnum[keyof StatusEnum];
|
|
26
|
-
|
|
26
|
+
providerFields?: unknown;
|
|
27
27
|
};
|
|
28
|
-
type UpdateCheckoutSessionDto<PaymentMethodEnum, StatusEnum> =
|
|
29
|
-
type CheckoutSessionDto<PaymentMethodEnum, StatusEnum> =
|
|
30
|
-
type CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum> = {
|
|
31
|
-
CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
|
|
32
|
-
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
|
|
28
|
+
type UpdateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>> & IdDto;
|
|
29
|
+
type CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> & IdDto & Partial<RecordTimingDto>;
|
|
30
|
+
type CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
31
|
+
CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
32
|
+
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
33
33
|
IdDto: IdDto;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
type CreatePaymentLinkDto<CurrencyEnum, StatusEnum> = {
|
|
36
|
+
type CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<IdDto> & {
|
|
37
37
|
amount: number;
|
|
38
38
|
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
39
|
-
|
|
40
|
-
successRedirectUri: string;
|
|
41
|
-
cancelRedirectUri: string;
|
|
42
|
-
expiresAt: Date;
|
|
39
|
+
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
43
40
|
status: StatusEnum[keyof StatusEnum];
|
|
44
|
-
|
|
41
|
+
providerFields?: unknown;
|
|
45
42
|
};
|
|
46
|
-
type UpdatePaymentLinkDto<CurrencyEnum, StatusEnum> =
|
|
47
|
-
type PaymentLinkDto<CurrencyEnum, StatusEnum> =
|
|
48
|
-
type PaymentLinkServiceParameters<CurrencyEnum, StatusEnum> = {
|
|
49
|
-
CreatePaymentLinkDto: CreatePaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
50
|
-
UpdatePaymentLinkDto: UpdatePaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
51
|
-
PaymentLinkDto: PaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
43
|
+
type UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>> & IdDto;
|
|
44
|
+
type PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> & IdDto & Partial<RecordTimingDto>;
|
|
45
|
+
type PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
46
|
+
CreatePaymentLinkDto: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
47
|
+
UpdatePaymentLinkDto: UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
48
|
+
PaymentLinkDto: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
52
49
|
IdDto: IdDto;
|
|
53
50
|
IdsDto: IdsDto;
|
|
54
51
|
};
|
|
55
52
|
|
|
56
|
-
type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> = {
|
|
53
|
+
type CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = Partial<IdDto> & {
|
|
57
54
|
active: boolean;
|
|
58
55
|
name: string;
|
|
59
56
|
description?: string;
|
|
60
57
|
price: number;
|
|
58
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
61
59
|
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
62
60
|
features?: string[];
|
|
63
|
-
|
|
61
|
+
providerFields?: unknown;
|
|
64
62
|
externalId: string;
|
|
65
63
|
billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
|
|
66
64
|
};
|
|
67
|
-
type UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum> =
|
|
68
|
-
type PlanDto<PlanCadenceEnum, BillingProviderEnum> =
|
|
69
|
-
type PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = {
|
|
70
|
-
CreatePlanDto: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
71
|
-
UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
72
|
-
PlanDto: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
65
|
+
type UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = Partial<CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> & IdDto;
|
|
66
|
+
type PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> & IdDto & Partial<RecordTimingDto>;
|
|
67
|
+
type PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
|
|
68
|
+
CreatePlanDto: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
69
|
+
UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
70
|
+
PlanDto: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
73
71
|
IdDto: IdDto;
|
|
74
72
|
IdsDto: IdsDto;
|
|
75
73
|
};
|
|
76
74
|
|
|
77
|
-
type CreateSubscriptionDto<PartyType, BillingProviderType> = {
|
|
75
|
+
type CreateSubscriptionDto<PartyType, BillingProviderType> = Partial<IdDto> & {
|
|
78
76
|
partyId: string;
|
|
79
77
|
partyType: PartyType[keyof PartyType];
|
|
80
78
|
description?: string;
|
|
81
79
|
active: boolean;
|
|
82
80
|
productId: string;
|
|
83
|
-
|
|
81
|
+
providerFields?: unknown;
|
|
84
82
|
externalId: string;
|
|
85
83
|
billingProvider?: BillingProviderType[keyof BillingProviderType];
|
|
86
84
|
startDate: Date;
|
|
87
|
-
endDate
|
|
85
|
+
endDate?: Date;
|
|
88
86
|
status: string;
|
|
89
87
|
};
|
|
90
|
-
type UpdateSubscriptionDto<PartyType, BillingProviderType> =
|
|
91
|
-
type SubscriptionDto<PartyType, BillingProviderType> =
|
|
88
|
+
type UpdateSubscriptionDto<PartyType, BillingProviderType> = Partial<CreateSubscriptionDto<PartyType, BillingProviderType>> & IdDto;
|
|
89
|
+
type SubscriptionDto<PartyType, BillingProviderType> = CreateSubscriptionDto<PartyType, BillingProviderType> & IdDto & Partial<RecordTimingDto>;
|
|
92
90
|
type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
|
|
93
91
|
CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
|
|
94
92
|
UpdateSubscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IdDto, RecordTimingDto, IdsDto } from '@forklaunch/common';
|
|
2
2
|
|
|
3
|
-
type CreateBillingPortalDto = {
|
|
3
|
+
type CreateBillingPortalDto = Partial<IdDto> & {
|
|
4
4
|
customerId: string;
|
|
5
|
-
uri
|
|
5
|
+
uri?: string;
|
|
6
6
|
expiresAt: Date;
|
|
7
|
-
|
|
7
|
+
providerFields?: unknown;
|
|
8
8
|
};
|
|
9
|
-
type UpdateBillingPortalDto =
|
|
10
|
-
type BillingPortalDto =
|
|
9
|
+
type UpdateBillingPortalDto = Partial<CreateBillingPortalDto> & IdDto;
|
|
10
|
+
type BillingPortalDto = CreateBillingPortalDto & IdDto & Partial<RecordTimingDto>;
|
|
11
11
|
type BillingPortalServiceParameters = {
|
|
12
12
|
CreateBillingPortalDto: CreateBillingPortalDto;
|
|
13
13
|
UpdateBillingPortalDto: UpdateBillingPortalDto;
|
|
@@ -15,80 +15,78 @@ type BillingPortalServiceParameters = {
|
|
|
15
15
|
IdDto: IdDto;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum> = {
|
|
18
|
+
type CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<IdDto> & {
|
|
19
19
|
customerId: string;
|
|
20
20
|
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
21
|
-
|
|
22
|
-
successRedirectUri
|
|
23
|
-
cancelRedirectUri
|
|
21
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
22
|
+
successRedirectUri?: string;
|
|
23
|
+
cancelRedirectUri?: string;
|
|
24
24
|
expiresAt: Date;
|
|
25
25
|
status: StatusEnum[keyof StatusEnum];
|
|
26
|
-
|
|
26
|
+
providerFields?: unknown;
|
|
27
27
|
};
|
|
28
|
-
type UpdateCheckoutSessionDto<PaymentMethodEnum, StatusEnum> =
|
|
29
|
-
type CheckoutSessionDto<PaymentMethodEnum, StatusEnum> =
|
|
30
|
-
type CheckoutSessionServiceParameters<PaymentMethodEnum, StatusEnum> = {
|
|
31
|
-
CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
|
|
32
|
-
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum, StatusEnum>;
|
|
28
|
+
type UpdateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>> & IdDto;
|
|
29
|
+
type CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> & IdDto & Partial<RecordTimingDto>;
|
|
30
|
+
type CheckoutSessionServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
31
|
+
CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
32
|
+
CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
33
33
|
IdDto: IdDto;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
type CreatePaymentLinkDto<CurrencyEnum, StatusEnum> = {
|
|
36
|
+
type CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<IdDto> & {
|
|
37
37
|
amount: number;
|
|
38
38
|
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
39
|
-
|
|
40
|
-
successRedirectUri: string;
|
|
41
|
-
cancelRedirectUri: string;
|
|
42
|
-
expiresAt: Date;
|
|
39
|
+
paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
|
|
43
40
|
status: StatusEnum[keyof StatusEnum];
|
|
44
|
-
|
|
41
|
+
providerFields?: unknown;
|
|
45
42
|
};
|
|
46
|
-
type UpdatePaymentLinkDto<CurrencyEnum, StatusEnum> =
|
|
47
|
-
type PaymentLinkDto<CurrencyEnum, StatusEnum> =
|
|
48
|
-
type PaymentLinkServiceParameters<CurrencyEnum, StatusEnum> = {
|
|
49
|
-
CreatePaymentLinkDto: CreatePaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
50
|
-
UpdatePaymentLinkDto: UpdatePaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
51
|
-
PaymentLinkDto: PaymentLinkDto<CurrencyEnum, StatusEnum>;
|
|
43
|
+
type UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = Partial<CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>> & IdDto;
|
|
44
|
+
type PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> = CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum> & IdDto & Partial<RecordTimingDto>;
|
|
45
|
+
type PaymentLinkServiceParameters<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
46
|
+
CreatePaymentLinkDto: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
47
|
+
UpdatePaymentLinkDto: UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
48
|
+
PaymentLinkDto: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
52
49
|
IdDto: IdDto;
|
|
53
50
|
IdsDto: IdsDto;
|
|
54
51
|
};
|
|
55
52
|
|
|
56
|
-
type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> = {
|
|
53
|
+
type CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = Partial<IdDto> & {
|
|
57
54
|
active: boolean;
|
|
58
55
|
name: string;
|
|
59
56
|
description?: string;
|
|
60
57
|
price: number;
|
|
58
|
+
currency: CurrencyEnum[keyof CurrencyEnum];
|
|
61
59
|
cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
|
|
62
60
|
features?: string[];
|
|
63
|
-
|
|
61
|
+
providerFields?: unknown;
|
|
64
62
|
externalId: string;
|
|
65
63
|
billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
|
|
66
64
|
};
|
|
67
|
-
type UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum> =
|
|
68
|
-
type PlanDto<PlanCadenceEnum, BillingProviderEnum> =
|
|
69
|
-
type PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = {
|
|
70
|
-
CreatePlanDto: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
71
|
-
UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
72
|
-
PlanDto: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
|
|
65
|
+
type UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = Partial<CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> & IdDto;
|
|
66
|
+
type PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> & IdDto & Partial<RecordTimingDto>;
|
|
67
|
+
type PlanServiceParameters<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
|
|
68
|
+
CreatePlanDto: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
69
|
+
UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
70
|
+
PlanDto: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
73
71
|
IdDto: IdDto;
|
|
74
72
|
IdsDto: IdsDto;
|
|
75
73
|
};
|
|
76
74
|
|
|
77
|
-
type CreateSubscriptionDto<PartyType, BillingProviderType> = {
|
|
75
|
+
type CreateSubscriptionDto<PartyType, BillingProviderType> = Partial<IdDto> & {
|
|
78
76
|
partyId: string;
|
|
79
77
|
partyType: PartyType[keyof PartyType];
|
|
80
78
|
description?: string;
|
|
81
79
|
active: boolean;
|
|
82
80
|
productId: string;
|
|
83
|
-
|
|
81
|
+
providerFields?: unknown;
|
|
84
82
|
externalId: string;
|
|
85
83
|
billingProvider?: BillingProviderType[keyof BillingProviderType];
|
|
86
84
|
startDate: Date;
|
|
87
|
-
endDate
|
|
85
|
+
endDate?: Date;
|
|
88
86
|
status: string;
|
|
89
87
|
};
|
|
90
|
-
type UpdateSubscriptionDto<PartyType, BillingProviderType> =
|
|
91
|
-
type SubscriptionDto<PartyType, BillingProviderType> =
|
|
88
|
+
type UpdateSubscriptionDto<PartyType, BillingProviderType> = Partial<CreateSubscriptionDto<PartyType, BillingProviderType>> & IdDto;
|
|
89
|
+
type SubscriptionDto<PartyType, BillingProviderType> = CreateSubscriptionDto<PartyType, BillingProviderType> & IdDto & Partial<RecordTimingDto>;
|
|
92
90
|
type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
|
|
93
91
|
CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
|
|
94
92
|
UpdateSubscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/interfaces-billing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Billing interfaces for forklaunch",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"lib/**"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@forklaunch/common": "^0.
|
|
34
|
+
"@forklaunch/common": "^0.4.2",
|
|
35
35
|
"@mikro-orm/core": "^6.4.16"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
38
|
+
"@typescript/native-preview": "7.0.0-dev.20250703.1",
|
|
39
39
|
"depcheck": "^1.4.7",
|
|
40
|
-
"prettier": "^3.
|
|
41
|
-
"typedoc": "^0.28.
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
|
+
"typedoc": "^0.28.7"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsgo --noEmit && tsup interfaces/index.ts 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",
|