@forklaunch/implementation-billing-stripe 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,121 +1,280 @@
1
- import { BillingPortalDto, CreateBillingPortalDto, UpdateBillingPortalDto, CheckoutSessionDto, CreateCheckoutSessionDto, UpdateCheckoutSessionDto, PaymentLinkDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, PlanDto, CreatePlanDto, UpdatePlanDto, SubscriptionDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
1
+ import {
2
+ BillingPortalDto,
3
+ CreateBillingPortalDto,
4
+ UpdateBillingPortalDto,
5
+ CheckoutSessionDto,
6
+ CreateCheckoutSessionDto,
7
+ UpdateCheckoutSessionDto,
8
+ PaymentLinkDto,
9
+ CreatePaymentLinkDto,
10
+ UpdatePaymentLinkDto,
11
+ PlanDto,
12
+ CreatePlanDto,
13
+ UpdatePlanDto,
14
+ SubscriptionDto,
15
+ CreateSubscriptionDto,
16
+ UpdateSubscriptionDto
17
+ } from '@forklaunch/interfaces-billing/types';
2
18
  import Stripe__default from 'stripe';
3
- import { PaymentMethodEnum, CurrencyEnum, PlanCadenceEnum, BillingProviderEnum } from '../enum/index.mjs';
19
+ import {
20
+ PaymentMethodEnum,
21
+ CurrencyEnum,
22
+ PlanCadenceEnum,
23
+ BillingProviderEnum
24
+ } from '../enum/index.mjs';
4
25
 
5
26
  type BillingPortalOmissions = 'customer';
6
- type StripeCreateBillingPortalDto = Omit<CreateBillingPortalDto, 'providerFields'> & {
7
- stripeFields: Omit<Stripe__default.BillingPortal.SessionCreateParams, BillingPortalOmissions>;
27
+ type StripeCreateBillingPortalDto = Omit<
28
+ CreateBillingPortalDto,
29
+ 'providerFields'
30
+ > & {
31
+ stripeFields: Omit<
32
+ Stripe__default.BillingPortal.SessionCreateParams,
33
+ BillingPortalOmissions
34
+ >;
8
35
  };
9
- type StripeUpdateBillingPortalDto = Omit<UpdateBillingPortalDto, 'providerFields'> & {
10
- stripeFields?: Omit<Stripe__default.BillingPortal.SessionCreateParams, BillingPortalOmissions>;
36
+ type StripeUpdateBillingPortalDto = Omit<
37
+ UpdateBillingPortalDto,
38
+ 'providerFields'
39
+ > & {
40
+ stripeFields?: Omit<
41
+ Stripe__default.BillingPortal.SessionCreateParams,
42
+ BillingPortalOmissions
43
+ >;
11
44
  };
12
45
  type StripeBillingPortalDto = Omit<BillingPortalDto, 'providerFields'> & {
13
- stripeFields: Stripe__default.BillingPortal.Session;
46
+ stripeFields: Stripe__default.BillingPortal.Session;
14
47
  };
15
48
  type StripeBillingPortalDtos = {
16
- BillingPortalMapper: StripeBillingPortalDto;
17
- CreateBillingPortalMapper: StripeCreateBillingPortalDto;
18
- UpdateBillingPortalMapper: StripeUpdateBillingPortalDto;
49
+ BillingPortalMapper: StripeBillingPortalDto;
50
+ CreateBillingPortalMapper: StripeCreateBillingPortalDto;
51
+ UpdateBillingPortalMapper: StripeUpdateBillingPortalDto;
19
52
  };
20
- type CheckoutSessionOmissions = 'payment_method_types' | 'currency' | 'success_url' | 'cancel_url';
21
- type StripeCreateCheckoutSessionDto<StatusEnum> = Omit<CreateCheckoutSessionDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
22
- stripeFields: Omit<Stripe__default.Checkout.SessionCreateParams, CheckoutSessionOmissions>;
53
+ type CheckoutSessionOmissions =
54
+ | 'payment_method_types'
55
+ | 'currency'
56
+ | 'success_url'
57
+ | 'cancel_url';
58
+ type StripeCreateCheckoutSessionDto<StatusEnum> = Omit<
59
+ CreateCheckoutSessionDto<
60
+ typeof PaymentMethodEnum,
61
+ typeof CurrencyEnum,
62
+ StatusEnum
63
+ >,
64
+ 'providerFields'
65
+ > & {
66
+ stripeFields: Omit<
67
+ Stripe__default.Checkout.SessionCreateParams,
68
+ CheckoutSessionOmissions
69
+ >;
23
70
  };
24
- type StripeUpdateCheckoutSessionDto<StatusEnum> = Omit<UpdateCheckoutSessionDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
25
- stripeFields?: Omit<Stripe__default.Checkout.SessionCreateParams, CheckoutSessionOmissions>;
71
+ type StripeUpdateCheckoutSessionDto<StatusEnum> = Omit<
72
+ UpdateCheckoutSessionDto<
73
+ typeof PaymentMethodEnum,
74
+ typeof CurrencyEnum,
75
+ StatusEnum
76
+ >,
77
+ 'providerFields'
78
+ > & {
79
+ stripeFields?: Omit<
80
+ Stripe__default.Checkout.SessionCreateParams,
81
+ CheckoutSessionOmissions
82
+ >;
26
83
  };
27
- type StripeCheckoutSessionDto<StatusEnum> = Omit<CheckoutSessionDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
28
- stripeFields: Stripe__default.Checkout.Session;
84
+ type StripeCheckoutSessionDto<StatusEnum> = Omit<
85
+ CheckoutSessionDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>,
86
+ 'providerFields'
87
+ > & {
88
+ stripeFields: Stripe__default.Checkout.Session;
29
89
  };
30
90
  type StripeCheckoutSessionDtos<StatusEnum> = {
31
- CheckoutSessionMapper: StripeCheckoutSessionDto<StatusEnum>;
32
- CreateCheckoutSessionMapper: StripeCreateCheckoutSessionDto<StatusEnum>;
33
- UpdateCheckoutSessionMapper: StripeUpdateCheckoutSessionDto<StatusEnum>;
91
+ CheckoutSessionMapper: StripeCheckoutSessionDto<StatusEnum>;
92
+ CreateCheckoutSessionMapper: StripeCreateCheckoutSessionDto<StatusEnum>;
93
+ UpdateCheckoutSessionMapper: StripeUpdateCheckoutSessionDto<StatusEnum>;
34
94
  };
35
- type StripeCreatePaymentLinkDto<StatusEnum> = Omit<CreatePaymentLinkDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
36
- stripeFields: Stripe__default.PaymentLinkCreateParams;
95
+ type StripeCreatePaymentLinkDto<StatusEnum> = Omit<
96
+ CreatePaymentLinkDto<
97
+ typeof PaymentMethodEnum,
98
+ typeof CurrencyEnum,
99
+ StatusEnum
100
+ >,
101
+ 'providerFields'
102
+ > & {
103
+ stripeFields: Stripe__default.PaymentLinkCreateParams;
37
104
  };
38
- type StripeUpdatePaymentLinkDto<StatusEnum> = Omit<UpdatePaymentLinkDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
39
- stripeFields?: Stripe__default.PaymentLinkUpdateParams;
105
+ type StripeUpdatePaymentLinkDto<StatusEnum> = Omit<
106
+ UpdatePaymentLinkDto<
107
+ typeof PaymentMethodEnum,
108
+ typeof CurrencyEnum,
109
+ StatusEnum
110
+ >,
111
+ 'providerFields'
112
+ > & {
113
+ stripeFields?: Stripe__default.PaymentLinkUpdateParams;
40
114
  };
41
- type StripePaymentLinkDto<StatusEnum> = Omit<PaymentLinkDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>, 'providerFields'> & {
42
- stripeFields: Stripe__default.PaymentLink;
115
+ type StripePaymentLinkDto<StatusEnum> = Omit<
116
+ PaymentLinkDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum>,
117
+ 'providerFields'
118
+ > & {
119
+ stripeFields: Stripe__default.PaymentLink;
43
120
  };
44
121
  type StripePaymentLinkDtos<StatusEnum> = {
45
- PaymentLinkMapper: StripePaymentLinkDto<StatusEnum>;
46
- CreatePaymentLinkMapper: StripeCreatePaymentLinkDto<StatusEnum>;
47
- UpdatePaymentLinkMapper: StripeUpdatePaymentLinkDto<StatusEnum>;
122
+ PaymentLinkMapper: StripePaymentLinkDto<StatusEnum>;
123
+ CreatePaymentLinkMapper: StripeCreatePaymentLinkDto<StatusEnum>;
124
+ UpdatePaymentLinkMapper: StripeUpdatePaymentLinkDto<StatusEnum>;
48
125
  };
49
126
  type PlanOmissions = 'product' | 'interval' | 'currency';
50
- type StripeCreatePlanDto = Omit<CreatePlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum>, 'providerFields'> & {
51
- stripeFields: Omit<Stripe__default.PlanCreateParams, PlanOmissions>;
127
+ type StripeCreatePlanDto = Omit<
128
+ CreatePlanDto<
129
+ typeof PlanCadenceEnum,
130
+ typeof CurrencyEnum,
131
+ typeof BillingProviderEnum
132
+ >,
133
+ 'providerFields'
134
+ > & {
135
+ stripeFields: Omit<Stripe__default.PlanCreateParams, PlanOmissions>;
52
136
  };
53
- type StripeUpdatePlanDto = Omit<UpdatePlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum>, 'providerFields'> & {
54
- stripeFields?: Omit<Stripe__default.PlanUpdateParams, PlanOmissions>;
137
+ type StripeUpdatePlanDto = Omit<
138
+ UpdatePlanDto<
139
+ typeof PlanCadenceEnum,
140
+ typeof CurrencyEnum,
141
+ typeof BillingProviderEnum
142
+ >,
143
+ 'providerFields'
144
+ > & {
145
+ stripeFields?: Omit<Stripe__default.PlanUpdateParams, PlanOmissions>;
55
146
  };
56
- type StripePlanDto = Omit<PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum>, 'providerFields'> & {
57
- stripeFields: Stripe__default.Plan;
147
+ type StripePlanDto = Omit<
148
+ PlanDto<
149
+ typeof PlanCadenceEnum,
150
+ typeof CurrencyEnum,
151
+ typeof BillingProviderEnum
152
+ >,
153
+ 'providerFields'
154
+ > & {
155
+ stripeFields: Stripe__default.Plan;
58
156
  };
59
157
  type StripePlanDtos = {
60
- PlanMapper: StripePlanDto;
61
- CreatePlanMapper: StripeCreatePlanDto;
62
- UpdatePlanMapper: StripeUpdatePlanDto;
158
+ PlanMapper: StripePlanDto;
159
+ CreatePlanMapper: StripeCreatePlanDto;
160
+ UpdatePlanMapper: StripeUpdatePlanDto;
63
161
  };
64
162
  type SubscriptionOmissions = 'items' | 'customer';
65
- type StripeCreateSubscriptionDto<PartyType> = Omit<CreateSubscriptionDto<PartyType, typeof BillingProviderEnum>, 'providerFields'> & {
66
- stripeFields: Omit<Stripe__default.SubscriptionCreateParams, SubscriptionOmissions>;
163
+ type StripeCreateSubscriptionDto<PartyType> = Omit<
164
+ CreateSubscriptionDto<PartyType, typeof BillingProviderEnum>,
165
+ 'providerFields'
166
+ > & {
167
+ stripeFields: Omit<
168
+ Stripe__default.SubscriptionCreateParams,
169
+ SubscriptionOmissions
170
+ >;
67
171
  };
68
- type StripeUpdateSubscriptionDto<PartyType> = Omit<UpdateSubscriptionDto<PartyType, typeof BillingProviderEnum>, 'providerFields'> & {
69
- stripeFields?: Omit<Stripe__default.SubscriptionUpdateParams, SubscriptionOmissions>;
172
+ type StripeUpdateSubscriptionDto<PartyType> = Omit<
173
+ UpdateSubscriptionDto<PartyType, typeof BillingProviderEnum>,
174
+ 'providerFields'
175
+ > & {
176
+ stripeFields?: Omit<
177
+ Stripe__default.SubscriptionUpdateParams,
178
+ SubscriptionOmissions
179
+ >;
70
180
  };
71
- type StripeSubscriptionDto<PartyType> = Omit<SubscriptionDto<PartyType, typeof BillingProviderEnum>, 'providerFields'> & {
72
- stripeFields: Stripe__default.Subscription;
181
+ type StripeSubscriptionDto<PartyType> = Omit<
182
+ SubscriptionDto<PartyType, typeof BillingProviderEnum>,
183
+ 'providerFields'
184
+ > & {
185
+ stripeFields: Stripe__default.Subscription;
73
186
  };
74
187
  type StripeSubscriptionDtos<PartyType> = {
75
- SubscriptionMapper: StripeSubscriptionDto<PartyType>;
76
- CreateSubscriptionMapper: StripeCreateSubscriptionDto<PartyType>;
77
- UpdateSubscriptionMapper: StripeUpdateSubscriptionDto<PartyType>;
188
+ SubscriptionMapper: StripeSubscriptionDto<PartyType>;
189
+ CreateSubscriptionMapper: StripeCreateSubscriptionDto<PartyType>;
190
+ UpdateSubscriptionMapper: StripeUpdateSubscriptionDto<PartyType>;
78
191
  };
79
192
 
80
193
  type StripeBillingPortalEntity = BillingPortalDto & {
81
- providerFields: Stripe__default.BillingPortal.Session;
194
+ providerFields: Stripe__default.BillingPortal.Session;
82
195
  };
83
196
  type StripeBillingPortalEntities = {
84
- BillingPortalMapper: StripeBillingPortalEntity;
85
- CreateBillingPortalMapper: StripeBillingPortalEntity;
86
- UpdateBillingPortalMapper: StripeBillingPortalEntity;
197
+ BillingPortalMapper: StripeBillingPortalEntity;
198
+ CreateBillingPortalMapper: StripeBillingPortalEntity;
199
+ UpdateBillingPortalMapper: StripeBillingPortalEntity;
87
200
  };
88
- type StripeCheckoutSessionEntity<StatusEnum> = CheckoutSessionDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum> & {
89
- providerFields: Stripe__default.Checkout.Session;
201
+ type StripeCheckoutSessionEntity<StatusEnum> = CheckoutSessionDto<
202
+ typeof PaymentMethodEnum,
203
+ typeof CurrencyEnum,
204
+ StatusEnum
205
+ > & {
206
+ providerFields: Stripe__default.Checkout.Session;
90
207
  };
91
208
  type StripeCheckoutSessionEntities<StatusEnum> = {
92
- CheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
93
- CreateCheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
94
- UpdateCheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
209
+ CheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
210
+ CreateCheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
211
+ UpdateCheckoutSessionMapper: StripeCheckoutSessionEntity<StatusEnum>;
95
212
  };
96
- type StripePaymentLinkEntity<StatusEnum> = PaymentLinkDto<typeof PaymentMethodEnum, typeof CurrencyEnum, StatusEnum> & {
97
- providerFields: Stripe__default.PaymentLink;
213
+ type StripePaymentLinkEntity<StatusEnum> = PaymentLinkDto<
214
+ typeof PaymentMethodEnum,
215
+ typeof CurrencyEnum,
216
+ StatusEnum
217
+ > & {
218
+ providerFields: Stripe__default.PaymentLink;
98
219
  };
99
220
  type StripePaymentLinkEntities<StatusEnum> = {
100
- PaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
101
- CreatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
102
- UpdatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
221
+ PaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
222
+ CreatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
223
+ UpdatePaymentLinkMapper: StripePaymentLinkEntity<StatusEnum>;
103
224
  };
104
- type StripePlanEntity = PlanDto<typeof PlanCadenceEnum, typeof CurrencyEnum, typeof BillingProviderEnum> & {
105
- providerFields: Stripe__default.Plan;
225
+ type StripePlanEntity = PlanDto<
226
+ typeof PlanCadenceEnum,
227
+ typeof CurrencyEnum,
228
+ typeof BillingProviderEnum
229
+ > & {
230
+ providerFields: Stripe__default.Plan;
106
231
  };
107
232
  type StripePlanEntities = {
108
- PlanMapper: StripePlanEntity;
109
- CreatePlanMapper: StripePlanEntity;
110
- UpdatePlanMapper: StripePlanEntity;
233
+ PlanMapper: StripePlanEntity;
234
+ CreatePlanMapper: StripePlanEntity;
235
+ UpdatePlanMapper: StripePlanEntity;
111
236
  };
112
- type StripeSubscriptionEntity<PartyType> = SubscriptionDto<PartyType, typeof BillingProviderEnum> & {
113
- providerFields: Stripe__default.Subscription;
237
+ type StripeSubscriptionEntity<PartyType> = SubscriptionDto<
238
+ PartyType,
239
+ typeof BillingProviderEnum
240
+ > & {
241
+ providerFields: Stripe__default.Subscription;
114
242
  };
115
243
  type StripeSubscriptionEntities<PartyType> = {
116
- SubscriptionMapper: StripeSubscriptionEntity<PartyType>;
117
- CreateSubscriptionMapper: StripeSubscriptionEntity<PartyType>;
118
- UpdateSubscriptionMapper: StripeSubscriptionEntity<PartyType>;
244
+ SubscriptionMapper: StripeSubscriptionEntity<PartyType>;
245
+ CreateSubscriptionMapper: StripeSubscriptionEntity<PartyType>;
246
+ UpdateSubscriptionMapper: StripeSubscriptionEntity<PartyType>;
119
247
  };
120
248
 
121
- export type { StripeBillingPortalDto, StripeBillingPortalDtos, StripeBillingPortalEntities, StripeBillingPortalEntity, StripeCheckoutSessionDto, StripeCheckoutSessionDtos, StripeCheckoutSessionEntities, StripeCheckoutSessionEntity, StripeCreateBillingPortalDto, StripeCreateCheckoutSessionDto, StripeCreatePaymentLinkDto, StripeCreatePlanDto, StripeCreateSubscriptionDto, StripePaymentLinkDto, StripePaymentLinkDtos, StripePaymentLinkEntities, StripePaymentLinkEntity, StripePlanDto, StripePlanDtos, StripePlanEntities, StripePlanEntity, StripeSubscriptionDto, StripeSubscriptionDtos, StripeSubscriptionEntities, StripeSubscriptionEntity, StripeUpdateBillingPortalDto, StripeUpdateCheckoutSessionDto, StripeUpdatePaymentLinkDto, StripeUpdatePlanDto, StripeUpdateSubscriptionDto };
249
+ export type {
250
+ StripeBillingPortalDto,
251
+ StripeBillingPortalDtos,
252
+ StripeBillingPortalEntities,
253
+ StripeBillingPortalEntity,
254
+ StripeCheckoutSessionDto,
255
+ StripeCheckoutSessionDtos,
256
+ StripeCheckoutSessionEntities,
257
+ StripeCheckoutSessionEntity,
258
+ StripeCreateBillingPortalDto,
259
+ StripeCreateCheckoutSessionDto,
260
+ StripeCreatePaymentLinkDto,
261
+ StripeCreatePlanDto,
262
+ StripeCreateSubscriptionDto,
263
+ StripePaymentLinkDto,
264
+ StripePaymentLinkDtos,
265
+ StripePaymentLinkEntities,
266
+ StripePaymentLinkEntity,
267
+ StripePlanDto,
268
+ StripePlanDtos,
269
+ StripePlanEntities,
270
+ StripePlanEntity,
271
+ StripeSubscriptionDto,
272
+ StripeSubscriptionDtos,
273
+ StripeSubscriptionEntities,
274
+ StripeSubscriptionEntity,
275
+ StripeUpdateBillingPortalDto,
276
+ StripeUpdateCheckoutSessionDto,
277
+ StripeUpdatePaymentLinkDto,
278
+ StripeUpdatePlanDto,
279
+ StripeUpdateSubscriptionDto
280
+ };