@forklaunch/implementation-billing-stripe 0.6.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  export * from './billingProvider.enum';
2
2
  export * from './currency.enum';
3
+ export * from './party.enum';
3
4
  export * from './paymentMethod.enum';
4
5
  export * from './planCadence.enum';
@@ -0,0 +1,5 @@
1
+ export const PartyEnum = {
2
+ USER: 'user',
3
+ ORGANIZATION: 'organization'
4
+ } as const;
5
+ export type PartyEnum = (typeof PartyEnum)[keyof typeof PartyEnum];
@@ -81,21 +81,21 @@ export type StripePlanEntities = {
81
81
  '~entity': (typeof Plan)['~entity'] & {
82
82
  cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
83
83
  currency: CurrencyEnum[keyof CurrencyEnum];
84
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
84
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
85
85
  };
86
86
  };
87
87
  CreatePlanMapper: {
88
88
  '~entity': (typeof Plan)['~entity'] & {
89
89
  cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
90
90
  currency: CurrencyEnum[keyof CurrencyEnum];
91
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
91
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
92
92
  };
93
93
  };
94
94
  UpdatePlanMapper: {
95
95
  '~entity': (typeof Plan)['~entity'] & {
96
96
  cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
97
97
  currency: CurrencyEnum[keyof CurrencyEnum];
98
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
98
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
99
99
  };
100
100
  };
101
101
  };
@@ -105,19 +105,19 @@ export type StripeSubscriptionEntities<PartyTypeEnum> = {
105
105
  SubscriptionMapper: {
106
106
  '~entity': (typeof Subscription)['~entity'] & {
107
107
  partyType: PartyTypeEnum[keyof PartyTypeEnum];
108
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
108
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
109
109
  };
110
110
  };
111
111
  CreateSubscriptionMapper: {
112
112
  '~entity': (typeof Subscription)['~entity'] & {
113
113
  partyType: PartyTypeEnum[keyof PartyTypeEnum];
114
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
114
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
115
115
  };
116
116
  };
117
117
  UpdateSubscriptionMapper: {
118
118
  '~entity': (typeof Subscription)['~entity'] & {
119
119
  partyType: PartyTypeEnum[keyof PartyTypeEnum];
120
- billingProvider: BillingProviderEnum[keyof BillingProviderEnum] | null;
120
+ billingProvider: BillingProviderEnum[keyof BillingProviderEnum];
121
121
  };
122
122
  };
123
123
  };
@@ -24,18 +24,20 @@ export class StripeCheckoutSessionService<
24
24
  SchemaValidator extends AnySchemaValidator,
25
25
  StatusEnum,
26
26
  MapperEntities extends StripeCheckoutSessionEntities<StatusEnum>,
27
- Dto extends StripeCheckoutSessionDtos<StatusEnum> =
28
- StripeCheckoutSessionDtos<StatusEnum>
29
- > implements CheckoutSessionService<
30
- typeof PaymentMethodEnum,
31
- typeof CurrencyEnum,
32
- StatusEnum,
33
- {
34
- CreateCheckoutSessionDto: Dto['CreateCheckoutSessionMapper'];
35
- CheckoutSessionDto: Dto['CheckoutSessionMapper'];
36
- IdDto: IdDto;
37
- }
38
- > {
27
+ Dto extends
28
+ StripeCheckoutSessionDtos<StatusEnum> = StripeCheckoutSessionDtos<StatusEnum>
29
+ > implements
30
+ CheckoutSessionService<
31
+ typeof PaymentMethodEnum,
32
+ typeof CurrencyEnum,
33
+ StatusEnum,
34
+ {
35
+ CreateCheckoutSessionDto: Dto['CreateCheckoutSessionMapper'];
36
+ CheckoutSessionDto: Dto['CheckoutSessionMapper'];
37
+ IdDto: IdDto;
38
+ }
39
+ >
40
+ {
39
41
  baseCheckoutSessionService: BaseCheckoutSessionService<
40
42
  SchemaValidator,
41
43
  PaymentMethodEnum,
@@ -25,20 +25,22 @@ export class StripePaymentLinkService<
25
25
  SchemaValidator extends AnySchemaValidator,
26
26
  StatusEnum,
27
27
  Entities extends StripePaymentLinkEntities<StatusEnum>,
28
- Dto extends StripePaymentLinkDtos<StatusEnum> =
29
- StripePaymentLinkDtos<StatusEnum>
30
- > implements PaymentLinkService<
31
- PaymentMethodEnum,
32
- typeof CurrencyEnum,
33
- StatusEnum,
34
- {
35
- CreatePaymentLinkDto: StripeCreatePaymentLinkDto<StatusEnum>;
36
- UpdatePaymentLinkDto: StripeUpdatePaymentLinkDto<StatusEnum>;
37
- PaymentLinkDto: StripePaymentLinkDto<StatusEnum>;
38
- IdDto: IdDto;
39
- IdsDto: IdsDto;
40
- }
41
- > {
28
+ Dto extends
29
+ StripePaymentLinkDtos<StatusEnum> = StripePaymentLinkDtos<StatusEnum>
30
+ > implements
31
+ PaymentLinkService<
32
+ PaymentMethodEnum,
33
+ typeof CurrencyEnum,
34
+ StatusEnum,
35
+ {
36
+ CreatePaymentLinkDto: StripeCreatePaymentLinkDto<StatusEnum>;
37
+ UpdatePaymentLinkDto: StripeUpdatePaymentLinkDto<StatusEnum>;
38
+ PaymentLinkDto: StripePaymentLinkDto<StatusEnum>;
39
+ IdDto: IdDto;
40
+ IdsDto: IdsDto;
41
+ }
42
+ >
43
+ {
42
44
  basePaymentLinkService: BasePaymentLinkService<
43
45
  SchemaValidator,
44
46
  PaymentMethodEnum,
@@ -5,8 +5,8 @@ import {
5
5
  import { AnySchemaValidator } from '@forklaunch/validator';
6
6
  import { EntityManager } from '@mikro-orm/core';
7
7
  import Stripe from 'stripe';
8
- import { PartyEnum } from '../../../../billing-base/domain/enum/party.enum';
9
- import { StripeWebhookEvent } from '../../../../billing-stripe/persistence/entities/stripeWebhookEvent.entity';
8
+ import { PartyEnum } from '../domain/enum/party.enum';
9
+ import { StripeWebhookEvent } from '../persistence/entities';
10
10
  import { BillingProviderEnum } from '../domain/enum/billingProvider.enum';
11
11
  import { CurrencyEnum } from '../domain/enum/currency.enum';
12
12
  import { PaymentMethodEnum } from '../domain/enum/paymentMethod.enum';
@@ -28,15 +28,15 @@ export class StripeWebhookService<
28
28
  SchemaValidator extends AnySchemaValidator,
29
29
  StatusEnum,
30
30
  PartyEnum,
31
- BillingPortalEntities extends StripeBillingPortalEntities =
32
- StripeBillingPortalEntities,
33
- CheckoutSessionEntities extends StripeCheckoutSessionEntities<StatusEnum> =
34
- StripeCheckoutSessionEntities<StatusEnum>,
35
- PaymentLinkEntities extends StripePaymentLinkEntities<StatusEnum> =
36
- StripePaymentLinkEntities<StatusEnum>,
31
+ BillingPortalEntities extends
32
+ StripeBillingPortalEntities = StripeBillingPortalEntities,
33
+ CheckoutSessionEntities extends
34
+ StripeCheckoutSessionEntities<StatusEnum> = StripeCheckoutSessionEntities<StatusEnum>,
35
+ PaymentLinkEntities extends
36
+ StripePaymentLinkEntities<StatusEnum> = StripePaymentLinkEntities<StatusEnum>,
37
37
  PlanEntities extends StripePlanEntities = StripePlanEntities,
38
- SubscriptionEntities extends StripeSubscriptionEntities<PartyEnum> =
39
- StripeSubscriptionEntities<PartyEnum>
38
+ SubscriptionEntities extends
39
+ StripeSubscriptionEntities<PartyEnum> = StripeSubscriptionEntities<PartyEnum>
40
40
  > {
41
41
  protected readonly stripeClient: Stripe;
42
42
  protected readonly em: EntityManager;
@@ -0,0 +1,126 @@
1
+ declare const BillingProviderEnum: {
2
+ readonly STRIPE: "stripe";
3
+ };
4
+ type BillingProviderEnum = (typeof BillingProviderEnum)[keyof typeof BillingProviderEnum];
5
+
6
+ declare const CurrencyEnum: {
7
+ readonly USD: "USD";
8
+ readonly EUR: "EUR";
9
+ readonly JPY: "JPY";
10
+ readonly GBP: "GBP";
11
+ readonly AUD: "AUD";
12
+ readonly CAD: "CAD";
13
+ readonly CHF: "CHF";
14
+ readonly CNY: "CNY";
15
+ readonly AED: "AED";
16
+ readonly ARS: "ARS";
17
+ readonly BAM: "BAM";
18
+ readonly BDT: "BDT";
19
+ readonly BGN: "BGN";
20
+ readonly BOB: "BOB";
21
+ readonly BRL: "BRL";
22
+ readonly CLP: "CLP";
23
+ readonly COP: "COP";
24
+ readonly CRC: "CRC";
25
+ readonly CZK: "CZK";
26
+ readonly DKK: "DKK";
27
+ readonly DZD: "DZD";
28
+ readonly EGP: "EGP";
29
+ readonly ETB: "ETB";
30
+ readonly GEL: "GEL";
31
+ readonly GTQ: "GTQ";
32
+ readonly HKD: "HKD";
33
+ readonly HUF: "HUF";
34
+ readonly IDR: "IDR";
35
+ readonly ILS: "ILS";
36
+ readonly INR: "INR";
37
+ readonly ISK: "ISK";
38
+ readonly JMD: "JMD";
39
+ readonly KES: "KES";
40
+ readonly KHR: "KHR";
41
+ readonly KRW: "KRW";
42
+ readonly KZT: "KZT";
43
+ readonly LAK: "LAK";
44
+ readonly LKR: "LKR";
45
+ readonly MAD: "MAD";
46
+ readonly MMK: "MMK";
47
+ readonly MXN: "MXN";
48
+ readonly MYR: "MYR";
49
+ readonly NGN: "NGN";
50
+ readonly NOK: "NOK";
51
+ readonly NPR: "NPR";
52
+ readonly NZD: "NZD";
53
+ readonly PEN: "PEN";
54
+ readonly PHP: "PHP";
55
+ readonly PKR: "PKR";
56
+ readonly PLN: "PLN";
57
+ readonly PYG: "PYG";
58
+ readonly QAR: "QAR";
59
+ readonly RON: "RON";
60
+ readonly RSD: "RSD";
61
+ readonly RUB: "RUB";
62
+ readonly SAR: "SAR";
63
+ readonly SEK: "SEK";
64
+ readonly SGD: "SGD";
65
+ readonly THB: "THB";
66
+ readonly TRY: "TRY";
67
+ readonly TWD: "TWD";
68
+ readonly TZS: "TZS";
69
+ readonly UAH: "UAH";
70
+ readonly UGX: "UGX";
71
+ readonly UYU: "UYU";
72
+ readonly VND: "VND";
73
+ readonly ZAR: "ZAR";
74
+ readonly ZMW: "ZMW";
75
+ };
76
+ type CurrencyEnum = (typeof CurrencyEnum)[keyof typeof CurrencyEnum];
77
+
78
+ declare const PaymentMethodEnum: {
79
+ readonly AFFIRM: "affirm";
80
+ readonly AFTERPAY_CLEARPAY: "afterpay_clearpay";
81
+ readonly ALIPAY: "alipay";
82
+ readonly ALMA: "alma";
83
+ readonly AU_BECS_DEBIT: "au_becs_debit";
84
+ readonly BACS_DEBIT: "bacs_debit";
85
+ readonly BANCONTACT: "bancontact";
86
+ readonly BILLIE: "billie";
87
+ readonly BLIK: "blik";
88
+ readonly BOLETO: "boleto";
89
+ readonly CARD: "card";
90
+ readonly CASHAPP: "cashapp";
91
+ readonly EPS: "eps";
92
+ readonly FPX: "fpx";
93
+ readonly GIROPAY: "giropay";
94
+ readonly GRABPAY: "grabpay";
95
+ readonly IDEAL: "ideal";
96
+ readonly KLARNA: "klarna";
97
+ readonly KONBINI: "konbini";
98
+ readonly LINK: "link";
99
+ readonly MOBILEPAY: "mobilepay";
100
+ readonly MULTIBANCO: "multibanco";
101
+ readonly OXXO: "oxxo";
102
+ readonly P24: "p24";
103
+ readonly PAY_BY_BANK: "pay_by_bank";
104
+ readonly PAYNOW: "paynow";
105
+ readonly PAYPAL: "paypal";
106
+ readonly PIX: "pix";
107
+ readonly PROMPTPAY: "promptpay";
108
+ readonly SATISPAY: "satispay";
109
+ readonly SEPA_DEBIT: "sepa_debit";
110
+ readonly SOFORT: "sofort";
111
+ readonly SWISH: "swish";
112
+ readonly TWINT: "twint";
113
+ readonly US_BANK_ACCOUNT: "us_bank_account";
114
+ readonly WECHAT_PAY: "wechat_pay";
115
+ readonly ZIP: "zip";
116
+ };
117
+ type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];
118
+
119
+ declare const PlanCadenceEnum: {
120
+ readonly WEEKLY: "week";
121
+ readonly MONTHLY: "month";
122
+ readonly ANNUALLY: "year";
123
+ };
124
+ type PlanCadenceEnum = (typeof PlanCadenceEnum)[keyof typeof PlanCadenceEnum];
125
+
126
+ export { BillingProviderEnum as B, CurrencyEnum as C, PaymentMethodEnum as P, PlanCadenceEnum as a };
@@ -0,0 +1,126 @@
1
+ declare const BillingProviderEnum: {
2
+ readonly STRIPE: "stripe";
3
+ };
4
+ type BillingProviderEnum = (typeof BillingProviderEnum)[keyof typeof BillingProviderEnum];
5
+
6
+ declare const CurrencyEnum: {
7
+ readonly USD: "USD";
8
+ readonly EUR: "EUR";
9
+ readonly JPY: "JPY";
10
+ readonly GBP: "GBP";
11
+ readonly AUD: "AUD";
12
+ readonly CAD: "CAD";
13
+ readonly CHF: "CHF";
14
+ readonly CNY: "CNY";
15
+ readonly AED: "AED";
16
+ readonly ARS: "ARS";
17
+ readonly BAM: "BAM";
18
+ readonly BDT: "BDT";
19
+ readonly BGN: "BGN";
20
+ readonly BOB: "BOB";
21
+ readonly BRL: "BRL";
22
+ readonly CLP: "CLP";
23
+ readonly COP: "COP";
24
+ readonly CRC: "CRC";
25
+ readonly CZK: "CZK";
26
+ readonly DKK: "DKK";
27
+ readonly DZD: "DZD";
28
+ readonly EGP: "EGP";
29
+ readonly ETB: "ETB";
30
+ readonly GEL: "GEL";
31
+ readonly GTQ: "GTQ";
32
+ readonly HKD: "HKD";
33
+ readonly HUF: "HUF";
34
+ readonly IDR: "IDR";
35
+ readonly ILS: "ILS";
36
+ readonly INR: "INR";
37
+ readonly ISK: "ISK";
38
+ readonly JMD: "JMD";
39
+ readonly KES: "KES";
40
+ readonly KHR: "KHR";
41
+ readonly KRW: "KRW";
42
+ readonly KZT: "KZT";
43
+ readonly LAK: "LAK";
44
+ readonly LKR: "LKR";
45
+ readonly MAD: "MAD";
46
+ readonly MMK: "MMK";
47
+ readonly MXN: "MXN";
48
+ readonly MYR: "MYR";
49
+ readonly NGN: "NGN";
50
+ readonly NOK: "NOK";
51
+ readonly NPR: "NPR";
52
+ readonly NZD: "NZD";
53
+ readonly PEN: "PEN";
54
+ readonly PHP: "PHP";
55
+ readonly PKR: "PKR";
56
+ readonly PLN: "PLN";
57
+ readonly PYG: "PYG";
58
+ readonly QAR: "QAR";
59
+ readonly RON: "RON";
60
+ readonly RSD: "RSD";
61
+ readonly RUB: "RUB";
62
+ readonly SAR: "SAR";
63
+ readonly SEK: "SEK";
64
+ readonly SGD: "SGD";
65
+ readonly THB: "THB";
66
+ readonly TRY: "TRY";
67
+ readonly TWD: "TWD";
68
+ readonly TZS: "TZS";
69
+ readonly UAH: "UAH";
70
+ readonly UGX: "UGX";
71
+ readonly UYU: "UYU";
72
+ readonly VND: "VND";
73
+ readonly ZAR: "ZAR";
74
+ readonly ZMW: "ZMW";
75
+ };
76
+ type CurrencyEnum = (typeof CurrencyEnum)[keyof typeof CurrencyEnum];
77
+
78
+ declare const PaymentMethodEnum: {
79
+ readonly AFFIRM: "affirm";
80
+ readonly AFTERPAY_CLEARPAY: "afterpay_clearpay";
81
+ readonly ALIPAY: "alipay";
82
+ readonly ALMA: "alma";
83
+ readonly AU_BECS_DEBIT: "au_becs_debit";
84
+ readonly BACS_DEBIT: "bacs_debit";
85
+ readonly BANCONTACT: "bancontact";
86
+ readonly BILLIE: "billie";
87
+ readonly BLIK: "blik";
88
+ readonly BOLETO: "boleto";
89
+ readonly CARD: "card";
90
+ readonly CASHAPP: "cashapp";
91
+ readonly EPS: "eps";
92
+ readonly FPX: "fpx";
93
+ readonly GIROPAY: "giropay";
94
+ readonly GRABPAY: "grabpay";
95
+ readonly IDEAL: "ideal";
96
+ readonly KLARNA: "klarna";
97
+ readonly KONBINI: "konbini";
98
+ readonly LINK: "link";
99
+ readonly MOBILEPAY: "mobilepay";
100
+ readonly MULTIBANCO: "multibanco";
101
+ readonly OXXO: "oxxo";
102
+ readonly P24: "p24";
103
+ readonly PAY_BY_BANK: "pay_by_bank";
104
+ readonly PAYNOW: "paynow";
105
+ readonly PAYPAL: "paypal";
106
+ readonly PIX: "pix";
107
+ readonly PROMPTPAY: "promptpay";
108
+ readonly SATISPAY: "satispay";
109
+ readonly SEPA_DEBIT: "sepa_debit";
110
+ readonly SOFORT: "sofort";
111
+ readonly SWISH: "swish";
112
+ readonly TWINT: "twint";
113
+ readonly US_BANK_ACCOUNT: "us_bank_account";
114
+ readonly WECHAT_PAY: "wechat_pay";
115
+ readonly ZIP: "zip";
116
+ };
117
+ type PaymentMethodEnum = (typeof PaymentMethodEnum)[keyof typeof PaymentMethodEnum];
118
+
119
+ declare const PlanCadenceEnum: {
120
+ readonly WEEKLY: "week";
121
+ readonly MONTHLY: "month";
122
+ readonly ANNUALLY: "year";
123
+ };
124
+ type PlanCadenceEnum = (typeof PlanCadenceEnum)[keyof typeof PlanCadenceEnum];
125
+
126
+ export { BillingProviderEnum as B, CurrencyEnum as C, PaymentMethodEnum as P, PlanCadenceEnum as a };
@@ -8,8 +8,9 @@ import { AnySchemaValidator } from '@forklaunch/validator';
8
8
  import { EntityManager } from '@mikro-orm/core';
9
9
  import Stripe__default from 'stripe';
10
10
  import { StripeBillingPortalEntities, StripeBillingPortalDtos, StripeBillingPortalMappers, StripeCreateBillingPortalDto, StripeUpdateBillingPortalDto, StripeCheckoutSessionEntities, StripeCheckoutSessionDtos, StripeCheckoutSessionMappers, StripeCreateCheckoutSessionDto, StripePaymentLinkEntities, StripePaymentLinkDtos, StripeCreatePaymentLinkDto, StripeUpdatePaymentLinkDto, StripePaymentLinkDto, StripePaymentLinkMappers, StripePlanEntities, StripePlanDtos, StripeCreatePlanDto, StripeUpdatePlanDto, StripePlanDto, StripePlanMappers, StripeSubscriptionEntities, StripeSubscriptionDtos, StripeCreateSubscriptionDto, StripeUpdateSubscriptionDto, StripeSubscriptionDto, StripeSubscriptionMappers } from '../domain/types/index.mjs';
11
- import { PaymentMethodEnum, CurrencyEnum, PlanCadenceEnum, BillingProviderEnum } from '../domain/enum/index.mjs';
11
+ import { P as PaymentMethodEnum, C as CurrencyEnum, a as PlanCadenceEnum, B as BillingProviderEnum } from '../planCadence.enum-BKHaW1xa.mjs';
12
12
  export * from '@forklaunch/interfaces-billing/types';
13
+ import '@forklaunch/core/persistence';
13
14
 
14
15
  declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValidator, Entities extends StripeBillingPortalEntities, Dto extends StripeBillingPortalDtos = StripeBillingPortalDtos> implements BillingPortalService<{
15
16
  CreateBillingPortalDto: Dto['CreateBillingPortalMapper'];
@@ -8,8 +8,9 @@ import { AnySchemaValidator } from '@forklaunch/validator';
8
8
  import { EntityManager } from '@mikro-orm/core';
9
9
  import Stripe__default from 'stripe';
10
10
  import { StripeBillingPortalEntities, StripeBillingPortalDtos, StripeBillingPortalMappers, StripeCreateBillingPortalDto, StripeUpdateBillingPortalDto, StripeCheckoutSessionEntities, StripeCheckoutSessionDtos, StripeCheckoutSessionMappers, StripeCreateCheckoutSessionDto, StripePaymentLinkEntities, StripePaymentLinkDtos, StripeCreatePaymentLinkDto, StripeUpdatePaymentLinkDto, StripePaymentLinkDto, StripePaymentLinkMappers, StripePlanEntities, StripePlanDtos, StripeCreatePlanDto, StripeUpdatePlanDto, StripePlanDto, StripePlanMappers, StripeSubscriptionEntities, StripeSubscriptionDtos, StripeCreateSubscriptionDto, StripeUpdateSubscriptionDto, StripeSubscriptionDto, StripeSubscriptionMappers } from '../domain/types/index.js';
11
- import { PaymentMethodEnum, CurrencyEnum, PlanCadenceEnum, BillingProviderEnum } from '../domain/enum/index.js';
11
+ import { P as PaymentMethodEnum, C as CurrencyEnum, a as PlanCadenceEnum, B as BillingProviderEnum } from '../planCadence.enum-BKHaW1xa.js';
12
12
  export * from '@forklaunch/interfaces-billing/types';
13
+ import '@forklaunch/core/persistence';
13
14
 
14
15
  declare class StripeBillingPortalService<SchemaValidator extends AnySchemaValidator, Entities extends StripeBillingPortalEntities, Dto extends StripeBillingPortalDtos = StripeBillingPortalDtos> implements BillingPortalService<{
15
16
  CreateBillingPortalDto: Dto['CreateBillingPortalMapper'];