@forklaunch/interfaces-billing 0.1.2 → 0.1.4

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.
Files changed (72) hide show
  1. package/lib/eject/interfaces/interfaces/billingPortal.service.interface.ts +18 -0
  2. package/lib/eject/interfaces/interfaces/checkoutSession.service.interface.ts +19 -0
  3. package/lib/eject/interfaces/interfaces/index.ts +5 -0
  4. package/lib/eject/interfaces/paymentLink.service.interface.ts +27 -0
  5. package/lib/eject/interfaces/plan.service.interface.ts +29 -0
  6. package/lib/eject/interfaces/subscription.service.interface.ts +49 -0
  7. package/lib/eject/types/types/billingPortal.service.types.ts +19 -0
  8. package/lib/eject/types/types/checkoutSession.service.types.ts +21 -0
  9. package/lib/eject/types/types/index.ts +5 -0
  10. package/lib/eject/types/types/paymentLink.service.types.ts +23 -0
  11. package/lib/eject/types/types/plan.service.types.ts +26 -0
  12. package/lib/eject/types/types/subscription.service.types.ts +28 -0
  13. package/lib/index.d.ts +3 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/interfaces/billingPortal.service.interface.d.ts +8 -0
  16. package/lib/interfaces/billingPortal.service.interface.d.ts.map +1 -0
  17. package/lib/interfaces/billingPortal.service.interface.js +1 -0
  18. package/lib/interfaces/checkoutSession.service.interface.d.ts +9 -0
  19. package/lib/interfaces/checkoutSession.service.interface.d.ts.map +1 -0
  20. package/lib/interfaces/checkoutSession.service.interface.js +1 -0
  21. package/lib/interfaces/index.d.ts +6 -0
  22. package/lib/interfaces/index.d.ts.map +1 -0
  23. package/lib/interfaces/index.js +5 -0
  24. package/lib/interfaces/paymentLink.service.interface.d.ts +11 -0
  25. package/lib/interfaces/paymentLink.service.interface.d.ts.map +1 -0
  26. package/lib/interfaces/paymentLink.service.interface.js +1 -0
  27. package/lib/interfaces/plan.service.interface.d.ts +10 -0
  28. package/lib/interfaces/plan.service.interface.d.ts.map +1 -0
  29. package/lib/interfaces/plan.service.interface.js +1 -0
  30. package/lib/interfaces/subscription.service.interface.d.ts +14 -0
  31. package/lib/interfaces/subscription.service.interface.d.ts.map +1 -0
  32. package/lib/interfaces/subscription.service.interface.js +1 -0
  33. package/lib/jest.config.d.ts +4 -0
  34. package/lib/jest.config.d.ts.map +1 -0
  35. package/lib/jest.config.js +19 -0
  36. package/lib/tsconfig.tsbuildinfo +1 -0
  37. package/lib/types/billingPortal.service.types.d.ts +16 -0
  38. package/lib/types/billingPortal.service.types.d.ts.map +1 -0
  39. package/lib/types/billingPortal.service.types.js +1 -0
  40. package/lib/types/checkoutSession.service.types.d.ts +17 -0
  41. package/lib/types/checkoutSession.service.types.d.ts.map +1 -0
  42. package/lib/types/checkoutSession.service.types.js +1 -0
  43. package/lib/types/index.d.ts +6 -0
  44. package/lib/types/index.d.ts.map +1 -0
  45. package/lib/types/index.js +5 -0
  46. package/lib/types/paymentLink.service.types.d.ts +19 -0
  47. package/lib/types/paymentLink.service.types.d.ts.map +1 -0
  48. package/lib/types/paymentLink.service.types.js +1 -0
  49. package/lib/types/plan.service.types.d.ts +22 -0
  50. package/lib/types/plan.service.types.d.ts.map +1 -0
  51. package/lib/types/plan.service.types.js +1 -0
  52. package/lib/types/subscription.service.types.d.ts +24 -0
  53. package/lib/types/subscription.service.types.d.ts.map +1 -0
  54. package/lib/types/subscription.service.types.js +1 -0
  55. package/lib/vitest.config.d.ts +3 -0
  56. package/lib/vitest.config.d.ts.map +1 -0
  57. package/lib/vitest.config.js +7 -0
  58. package/package.json +4 -2
  59. package/tsconfig.json +0 -7
  60. /package/{interfaces → lib/eject/interfaces}/billingPortal.service.interface.ts +0 -0
  61. /package/{interfaces → lib/eject/interfaces}/checkoutSession.service.interface.ts +0 -0
  62. /package/{interfaces → lib/eject/interfaces}/index.ts +0 -0
  63. /package/{interfaces → lib/eject/interfaces/interfaces}/paymentLink.service.interface.ts +0 -0
  64. /package/{interfaces → lib/eject/interfaces/interfaces}/plan.service.interface.ts +0 -0
  65. /package/{interfaces → lib/eject/interfaces/interfaces}/subscription.service.interface.ts +0 -0
  66. /package/{types → lib/eject/types}/billingPortal.service.types.ts +0 -0
  67. /package/{types → lib/eject/types}/checkoutSession.service.types.ts +0 -0
  68. /package/{types → lib/eject/types}/index.ts +0 -0
  69. /package/{types → lib/eject/types}/paymentLink.service.types.ts +0 -0
  70. /package/{types → lib/eject/types}/plan.service.types.ts +0 -0
  71. /package/{types → lib/eject/types}/subscription.service.types.ts +0 -0
  72. /package/{index.ts → lib/index.js} +0 -0
@@ -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,5 @@
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';
@@ -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,5 @@
1
+ export * from './billingPortal.service.types';
2
+ export * from './checkoutSession.service.types';
3
+ export * from './paymentLink.service.types';
4
+ export * from './plan.service.types';
5
+ export * from './subscription.service.types';
@@ -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
+ };
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './interfaces';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { BillingPortalServiceParameters } from '../types/billingPortal.service.types';
2
+ export interface BillingPortalService<Params extends BillingPortalServiceParameters = BillingPortalServiceParameters> {
3
+ createBillingPortalSession: (billingPortalDto: Params['CreateBillingPortalDto']) => Promise<Params['BillingPortalDto']>;
4
+ getBillingPortalSession: (idDto: Params['IdDto']) => Promise<Params['BillingPortalDto']>;
5
+ updateBillingPortalSession: (billingPortalDto: Params['UpdateBillingPortalDto']) => Promise<Params['BillingPortalDto']>;
6
+ expireBillingPortalSession: (idDto: Params['IdDto']) => Promise<void>;
7
+ }
8
+ //# 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,9 @@
1
+ import { CheckoutSessionServiceParameters } from '../types/checkoutSession.service.types';
2
+ export interface CheckoutSessionService<PaymentMethodEnum, Params extends CheckoutSessionServiceParameters<PaymentMethodEnum> = CheckoutSessionServiceParameters<PaymentMethodEnum>> {
3
+ createCheckoutSession: (checkoutSessionDto: Params['CreateCheckoutSessionDto']) => Promise<Params['CheckoutSessionDto']>;
4
+ getCheckoutSession: (idDto: Params['IdDto']) => Promise<Params['CheckoutSessionDto']>;
5
+ expireCheckoutSession: (idDto: Params['IdDto']) => Promise<void>;
6
+ handleCheckoutSuccess: (idDto: Params['IdDto']) => Promise<void>;
7
+ handleCheckoutFailure: (idDto: Params['IdDto']) => Promise<void>;
8
+ }
9
+ //# 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,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,5 @@
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';
@@ -0,0 +1,11 @@
1
+ import { PaymentLinkServiceParameters } from '../types/paymentLink.service.types';
2
+ export interface PaymentLinkService<CurrencyEnum, Params extends PaymentLinkServiceParameters<CurrencyEnum> = PaymentLinkServiceParameters<CurrencyEnum>> {
3
+ createPaymentLink: (paymentLink: Params['CreatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
4
+ updatePaymentLink: (paymentLink: Params['UpdatePaymentLinkDto']) => Promise<Params['PaymentLinkDto']>;
5
+ getPaymentLink: (idDto: Params['IdDto']) => Promise<Params['PaymentLinkDto']>;
6
+ expirePaymentLink: (idDto: Params['IdDto']) => Promise<void>;
7
+ handlePaymentSuccess: (idDto: Params['IdDto']) => Promise<void>;
8
+ handlePaymentFailure: (idDto: Params['IdDto']) => Promise<void>;
9
+ listPaymentLinks: (idsDto?: Params['IdsDto']) => Promise<Params['PaymentLinkDto'][]>;
10
+ }
11
+ //# 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,10 @@
1
+ import { EntityManager } from '@mikro-orm/core';
2
+ import { PlanServiceParameters } from '../types/plan.service.types';
3
+ export interface PlanService<PlanCadenceEnum, BillingProviderEnum, Params extends PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum>> {
4
+ createPlan: (planDto: Params['CreatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
5
+ getPlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
6
+ updatePlan: (planDto: Params['UpdatePlanDto'], em?: EntityManager) => Promise<Params['PlanDto']>;
7
+ deletePlan: (idDto: Params['IdDto'], em?: EntityManager) => Promise<void>;
8
+ listPlans: (idsDto?: Params['IdsDto'], em?: EntityManager) => Promise<Params['PlanDto'][]>;
9
+ }
10
+ //# 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,14 @@
1
+ import { EntityManager } from '@mikro-orm/core';
2
+ import { SubscriptionServiceParameters } from '../types/subscription.service.types';
3
+ export interface SubscriptionService<PartyType, BillingProviderType, Params extends SubscriptionServiceParameters<PartyType, BillingProviderType> = SubscriptionServiceParameters<PartyType, BillingProviderType>> {
4
+ createSubscription: (subscriptionDto: Params['CreateSubscriptionDto'], em?: EntityManager) => Promise<Params['SubscriptionDto']>;
5
+ getSubscription: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['SubscriptionDto']>;
6
+ getUserSubscription: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['SubscriptionDto']>;
7
+ getOrganizationSubscription: (idDto: Params['IdDto'], em?: EntityManager) => Promise<Params['SubscriptionDto']>;
8
+ updateSubscription: (subscriptionDto: Params['UpdateSubscriptionDto'], em?: EntityManager) => Promise<Params['SubscriptionDto']>;
9
+ deleteSubscription: (id: Params['IdDto'], em?: EntityManager) => Promise<void>;
10
+ listSubscriptions: (idsDto: Params['IdsDto'], em?: EntityManager) => Promise<Params['SubscriptionDto'][]>;
11
+ cancelSubscription: (idDto: Params['IdDto'], em?: EntityManager) => Promise<void>;
12
+ resumeSubscription: (idDto: Params['IdDto'], em?: EntityManager) => Promise<void>;
13
+ }
14
+ //# 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,4 @@
1
+ import type { JestConfigWithTsJest } from 'ts-jest';
2
+ declare const jestConfig: JestConfigWithTsJest;
3
+ export default jestConfig;
4
+ //# sourceMappingURL=jest.config.d.ts.map
@@ -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;