@forklaunch/interfaces-billing 0.1.12 → 0.1.14
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/billingPortal.service.interface.ts +18 -0
- package/lib/eject/domain/interfaces/checkoutSession.service.interface.ts +19 -0
- package/lib/eject/domain/interfaces/index.ts +5 -0
- package/lib/eject/domain/interfaces/paymentLink.service.interface.ts +27 -0
- package/lib/eject/domain/interfaces/plan.service.interface.ts +29 -0
- package/lib/eject/domain/interfaces/subscription.service.interface.ts +49 -0
- package/lib/eject/domain/types/billingPortal.service.types.ts +19 -0
- package/lib/eject/domain/types/checkoutSession.service.types.ts +21 -0
- package/lib/eject/domain/types/index.ts +5 -0
- package/lib/eject/domain/types/paymentLink.service.types.ts +23 -0
- package/lib/eject/domain/types/plan.service.types.ts +26 -0
- package/lib/eject/domain/types/subscription.service.types.ts +28 -0
- package/lib/interfaces/billingPortal.service.interface.d.ts +16 -0
- package/lib/interfaces/billingPortal.service.interface.d.ts.map +1 -0
- package/lib/interfaces/billingPortal.service.interface.js +1 -0
- package/lib/interfaces/checkoutSession.service.interface.d.ts +17 -0
- package/lib/interfaces/checkoutSession.service.interface.d.ts.map +1 -0
- package/lib/interfaces/checkoutSession.service.interface.js +1 -0
- package/lib/interfaces/index.d.ts +6 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/lib/interfaces/index.js +5 -0
- package/lib/interfaces/paymentLink.service.interface.d.ts +21 -0
- package/lib/interfaces/paymentLink.service.interface.d.ts.map +1 -0
- package/lib/interfaces/paymentLink.service.interface.js +1 -0
- package/lib/interfaces/plan.service.interface.d.ts +29 -0
- package/lib/interfaces/plan.service.interface.d.ts.map +1 -0
- package/lib/interfaces/plan.service.interface.js +1 -0
- package/lib/interfaces/subscription.service.interface.d.ts +48 -0
- package/lib/interfaces/subscription.service.interface.d.ts.map +1 -0
- package/lib/interfaces/subscription.service.interface.js +1 -0
- package/lib/jest.config.d.ts +4 -0
- package/lib/jest.config.d.ts.map +1 -0
- package/lib/jest.config.js +19 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/billingPortal.service.types.d.ts +18 -0
- package/lib/types/billingPortal.service.types.d.ts.map +1 -0
- package/lib/types/billingPortal.service.types.js +1 -0
- package/lib/types/checkoutSession.service.types.d.ts +20 -0
- package/lib/types/checkoutSession.service.types.d.ts.map +1 -0
- package/lib/types/checkoutSession.service.types.js +1 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +5 -0
- package/lib/types/paymentLink.service.types.d.ts +22 -0
- package/lib/types/paymentLink.service.types.d.ts.map +1 -0
- package/lib/types/paymentLink.service.types.js +1 -0
- package/lib/types/plan.service.types.d.ts +25 -0
- package/lib/types/plan.service.types.d.ts.map +1 -0
- package/lib/types/plan.service.types.js +1 -0
- package/lib/types/subscription.service.types.d.ts +27 -0
- package/lib/types/subscription.service.types.d.ts.map +1 -0
- package/lib/types/subscription.service.types.js +1 -0
- package/lib/vitest.config.d.ts +3 -0
- package/lib/vitest.config.d.ts.map +1 -0
- package/lib/vitest.config.js +7 -0
- package/package.json +4 -4
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BillingPortalServiceParameters } from '../types/billingPortal.service.types';
|
|
2
|
+
export interface BillingPortalService<
|
|
3
|
+
Params extends BillingPortalServiceParameters = BillingPortalServiceParameters
|
|
4
|
+
> {
|
|
5
|
+
createBillingPortalSession: (
|
|
6
|
+
billingPortalDto: Params['CreateBillingPortalDto']
|
|
7
|
+
) => Promise<Params['BillingPortalDto']>;
|
|
8
|
+
getBillingPortalSession: (
|
|
9
|
+
idDto: Params['IdDto']
|
|
10
|
+
) => Promise<Params['BillingPortalDto']>;
|
|
11
|
+
updateBillingPortalSession: (
|
|
12
|
+
billingPortalDto: Params['UpdateBillingPortalDto']
|
|
13
|
+
) => Promise<Params['BillingPortalDto']>;
|
|
14
|
+
expireBillingPortalSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=billingPortal.service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billingPortal.service.interface.d.ts","sourceRoot":"","sources":["../../interfaces/billingPortal.service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAEtF,MAAM,WAAW,oBAAoB,CACnC,MAAM,SAAS,8BAA8B,GAAG,8BAA8B;IAI9E,0BAA0B,EAAE,CAC1B,gBAAgB,EAAE,MAAM,CAAC,wBAAwB,CAAC,KAC/C,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzC,uBAAuB,EAAE,CACvB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KACnB,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzC,0BAA0B,EAAE,CAC1B,gBAAgB,EAAE,MAAM,CAAC,wBAAwB,CAAC,KAC/C,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACzC,0BAA0B,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CheckoutSessionServiceParameters } from '../types/checkoutSession.service.types';
|
|
2
|
+
export interface CheckoutSessionService<
|
|
3
|
+
PaymentMethodEnum,
|
|
4
|
+
Params extends
|
|
5
|
+
CheckoutSessionServiceParameters<PaymentMethodEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum>
|
|
6
|
+
> {
|
|
7
|
+
createCheckoutSession: (
|
|
8
|
+
checkoutSessionDto: Params['CreateCheckoutSessionDto']
|
|
9
|
+
) => Promise<Params['CheckoutSessionDto']>;
|
|
10
|
+
getCheckoutSession: (
|
|
11
|
+
idDto: Params['IdDto']
|
|
12
|
+
) => Promise<Params['CheckoutSessionDto']>;
|
|
13
|
+
expireCheckoutSession: (idDto: Params['IdDto']) => Promise<void>;
|
|
14
|
+
handleCheckoutSuccess: (idDto: Params['IdDto']) => Promise<void>;
|
|
15
|
+
handleCheckoutFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=checkoutSession.service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkoutSession.service.interface.d.ts","sourceRoot":"","sources":["../../interfaces/checkoutSession.service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAC1F,MAAM,WAAW,sBAAsB,CACrC,iBAAiB,EACjB,MAAM,SACJ,gCAAgC,CAAC,iBAAiB,CAAC,GAAG,gCAAgC,CAAC,iBAAiB,CAAC;IAI3G,qBAAqB,EAAE,CACrB,kBAAkB,EAAE,MAAM,CAAC,0BAA0B,CAAC,KACnD,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC3C,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KACnB,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC3C,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './billingPortal.service.interface';
|
|
2
|
+
export * from './checkoutSession.service.interface';
|
|
3
|
+
export * from './paymentLink.service.interface';
|
|
4
|
+
export * from './plan.service.interface';
|
|
5
|
+
export * from './subscription.service.interface';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PaymentLinkServiceParameters } from '../types/paymentLink.service.types';
|
|
2
|
+
export interface PaymentLinkService<
|
|
3
|
+
CurrencyEnum,
|
|
4
|
+
Params extends
|
|
5
|
+
PaymentLinkServiceParameters<CurrencyEnum> = PaymentLinkServiceParameters<CurrencyEnum>
|
|
6
|
+
> {
|
|
7
|
+
createPaymentLink: (
|
|
8
|
+
paymentLink: Params['CreatePaymentLinkDto']
|
|
9
|
+
) => Promise<Params['PaymentLinkDto']>;
|
|
10
|
+
updatePaymentLink: (
|
|
11
|
+
paymentLink: Params['UpdatePaymentLinkDto']
|
|
12
|
+
) => Promise<Params['PaymentLinkDto']>;
|
|
13
|
+
getPaymentLink: (idDto: Params['IdDto']) => Promise<Params['PaymentLinkDto']>;
|
|
14
|
+
expirePaymentLink: (idDto: Params['IdDto']) => Promise<void>;
|
|
15
|
+
handlePaymentSuccess: (idDto: Params['IdDto']) => Promise<void>;
|
|
16
|
+
handlePaymentFailure: (idDto: Params['IdDto']) => Promise<void>;
|
|
17
|
+
listPaymentLinks: (
|
|
18
|
+
idsDto?: Params['IdsDto']
|
|
19
|
+
) => Promise<Params['PaymentLinkDto'][]>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=paymentLink.service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentLink.service.interface.d.ts","sourceRoot":"","sources":["../../interfaces/paymentLink.service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,MAAM,WAAW,kBAAkB,CACjC,YAAY,EACZ,MAAM,SACJ,4BAA4B,CAAC,YAAY,CAAC,GAAG,4BAA4B,CAAC,YAAY,CAAC;IAKzF,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,CAAC,sBAAsB,CAAC,KACxC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvC,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,CAAC,sBAAsB,CAAC,KACxC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9E,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7D,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAGhE,gBAAgB,EAAE,CAChB,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KACtB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EntityManager } from '@mikro-orm/core';
|
|
2
|
+
import { PlanServiceParameters } from '../types/plan.service.types';
|
|
3
|
+
export interface PlanService<
|
|
4
|
+
PlanCadenceEnum,
|
|
5
|
+
BillingProviderEnum,
|
|
6
|
+
Params extends PlanServiceParameters<
|
|
7
|
+
PlanCadenceEnum,
|
|
8
|
+
BillingProviderEnum
|
|
9
|
+
> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>
|
|
10
|
+
> {
|
|
11
|
+
createPlan: (
|
|
12
|
+
planDto: Params['CreatePlanDto'],
|
|
13
|
+
em?: EntityManager
|
|
14
|
+
) => Promise<Params['PlanDto']>;
|
|
15
|
+
getPlan: (
|
|
16
|
+
idDto: Params['IdDto'],
|
|
17
|
+
em?: EntityManager
|
|
18
|
+
) => Promise<Params['PlanDto']>;
|
|
19
|
+
updatePlan: (
|
|
20
|
+
planDto: Params['UpdatePlanDto'],
|
|
21
|
+
em?: EntityManager
|
|
22
|
+
) => Promise<Params['PlanDto']>;
|
|
23
|
+
deletePlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<void>;
|
|
24
|
+
listPlans: (
|
|
25
|
+
idsDto?: Params['IdsDto'],
|
|
26
|
+
em?: EntityManager
|
|
27
|
+
) => Promise<Params['PlanDto'][]>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=plan.service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.service.interface.d.ts","sourceRoot":"","sources":["../../interfaces/plan.service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,WAAW,WAAW,CAC1B,eAAe,EACf,mBAAmB,EACnB,MAAM,SAAS,qBAAqB,CAClC,eAAe,EACf,mBAAmB,CACpB,GAAG,qBAAqB,CAAC,eAAe,EAAE,mBAAmB,CAAC;IAE/D,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC,EAChC,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,OAAO,EAAE,CACP,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,UAAU,EAAE,CACV,OAAO,EAAE,MAAM,CAAC,eAAe,CAAC,EAChC,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAChC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,SAAS,EAAE,CACT,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,EACzB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EntityManager } from '@mikro-orm/core';
|
|
2
|
+
import { SubscriptionServiceParameters } from '../types/subscription.service.types';
|
|
3
|
+
export interface SubscriptionService<
|
|
4
|
+
PartyType,
|
|
5
|
+
BillingProviderType,
|
|
6
|
+
Params extends SubscriptionServiceParameters<
|
|
7
|
+
PartyType,
|
|
8
|
+
BillingProviderType
|
|
9
|
+
> = SubscriptionServiceParameters<PartyType, BillingProviderType>
|
|
10
|
+
> {
|
|
11
|
+
createSubscription: (
|
|
12
|
+
subscriptionDto: Params['CreateSubscriptionDto'],
|
|
13
|
+
em?: EntityManager
|
|
14
|
+
) => Promise<Params['SubscriptionDto']>;
|
|
15
|
+
getSubscription: (
|
|
16
|
+
idDto: Params['IdDto'],
|
|
17
|
+
em?: EntityManager
|
|
18
|
+
) => Promise<Params['SubscriptionDto']>;
|
|
19
|
+
getUserSubscription: (
|
|
20
|
+
idDto: Params['IdDto'],
|
|
21
|
+
em?: EntityManager
|
|
22
|
+
) => Promise<Params['SubscriptionDto']>;
|
|
23
|
+
getOrganizationSubscription: (
|
|
24
|
+
idDto: Params['IdDto'],
|
|
25
|
+
em?: EntityManager
|
|
26
|
+
) => Promise<Params['SubscriptionDto']>;
|
|
27
|
+
updateSubscription: (
|
|
28
|
+
subscriptionDto: Params['UpdateSubscriptionDto'],
|
|
29
|
+
em?: EntityManager
|
|
30
|
+
) => Promise<Params['SubscriptionDto']>;
|
|
31
|
+
deleteSubscription: (
|
|
32
|
+
id: Params['IdDto'],
|
|
33
|
+
em?: EntityManager
|
|
34
|
+
) => Promise<void>;
|
|
35
|
+
listSubscriptions: (
|
|
36
|
+
idsDto: Params['IdsDto'],
|
|
37
|
+
em?: EntityManager
|
|
38
|
+
) => Promise<Params['SubscriptionDto'][]>;
|
|
39
|
+
cancelSubscription: (
|
|
40
|
+
idDto: Params['IdDto'],
|
|
41
|
+
em?: EntityManager
|
|
42
|
+
) => Promise<void>;
|
|
43
|
+
resumeSubscription: (
|
|
44
|
+
idDto: Params['IdDto'],
|
|
45
|
+
em?: EntityManager
|
|
46
|
+
) => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=subscription.service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.service.interface.d.ts","sourceRoot":"","sources":["../../interfaces/subscription.service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AAEpF,MAAM,WAAW,mBAAmB,CAClC,SAAS,EACT,mBAAmB,EACnB,MAAM,SAAS,6BAA6B,CAC1C,SAAS,EACT,mBAAmB,CACpB,GAAG,6BAA6B,CAAC,SAAS,EAAE,mBAAmB,CAAC;IAGjE,kBAAkB,EAAE,CAClB,eAAe,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAChD,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACxC,eAAe,EAAE,CACf,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACxC,mBAAmB,EAAE,CACnB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACxC,2BAA2B,EAAE,CAC3B,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAClB,eAAe,EAAE,MAAM,CAAC,uBAAuB,CAAC,EAChD,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAClB,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,EACnB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,iBAAiB,EAAE,CACjB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,EACxB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAC1C,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,EAAE,CAAC,EAAE,aAAa,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAiBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const jestConfig = {
|
|
2
|
+
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
3
|
+
moduleNameMapper: {
|
|
4
|
+
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
5
|
+
},
|
|
6
|
+
transform: {
|
|
7
|
+
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
|
|
8
|
+
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
|
|
9
|
+
'^.+\\.[tj]sx?$': [
|
|
10
|
+
'ts-jest',
|
|
11
|
+
{
|
|
12
|
+
useESM: true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
'^.+\\.js$': 'babel-jest'
|
|
16
|
+
},
|
|
17
|
+
testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
|
|
18
|
+
};
|
|
19
|
+
export default jestConfig;
|