@forklaunch/implementation-billing-stripe 0.3.0 → 0.3.2

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,15 +1,7 @@
1
1
  // services/billingPortal.service.ts
2
- import { BaseBillingPortalService } from '@forklaunch/implementation-billing-base/services';
2
+ import { BaseBillingPortalService } from "@forklaunch/implementation-billing-base/services";
3
3
  var StripeBillingPortalService = class {
4
- constructor(
5
- stripeClient,
6
- em,
7
- cache,
8
- openTelemetryCollector,
9
- schemaValidator,
10
- mappers,
11
- options
12
- ) {
4
+ constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
13
5
  this.options = options;
14
6
  this.stripeClient = stripeClient;
15
7
  this.em = em;
@@ -60,10 +52,9 @@ var StripeBillingPortalService = class {
60
52
  return this.baseBillingPortalService.expireBillingPortalSession(idDto);
61
53
  }
62
54
  async updateBillingPortalSession(billingPortalDto, ...args) {
63
- const existingSession =
64
- await this.baseBillingPortalService.getBillingPortalSession({
65
- id: billingPortalDto.id
66
- });
55
+ const existingSession = await this.baseBillingPortalService.getBillingPortalSession({
56
+ id: billingPortalDto.id
57
+ });
67
58
  const session = await this.stripeClient.billingPortal.sessions.create({
68
59
  ...billingPortalDto.stripeFields,
69
60
  customer: existingSession.customerId
@@ -85,17 +76,9 @@ var StripeBillingPortalService = class {
85
76
  };
86
77
 
87
78
  // services/checkoutSession.service.ts
88
- import { BaseCheckoutSessionService } from '@forklaunch/implementation-billing-base/services';
79
+ import { BaseCheckoutSessionService } from "@forklaunch/implementation-billing-base/services";
89
80
  var StripeCheckoutSessionService = class {
90
- constructor(
91
- stripeClient,
92
- em,
93
- cache,
94
- openTelemetryCollector,
95
- schemaValidator,
96
- mappers,
97
- options
98
- ) {
81
+ constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
99
82
  this.options = options;
100
83
  this.stripeClient = stripeClient;
101
84
  this.em = em;
@@ -144,8 +127,7 @@ var StripeCheckoutSessionService = class {
144
127
  const session = await this.stripeClient.checkout.sessions.retrieve(
145
128
  idDto.id
146
129
  );
147
- const databaseCheckoutSession =
148
- await this.baseCheckoutSessionService.getCheckoutSession(idDto);
130
+ const databaseCheckoutSession = await this.baseCheckoutSessionService.getCheckoutSession(idDto);
149
131
  databaseCheckoutSession.stripeFields = session;
150
132
  return databaseCheckoutSession;
151
133
  }
@@ -156,7 +138,7 @@ var StripeCheckoutSessionService = class {
156
138
  async handleCheckoutSuccess({ id }) {
157
139
  await this.stripeClient.checkout.sessions.update(id, {
158
140
  metadata: {
159
- status: 'SUCCESS'
141
+ status: "SUCCESS"
160
142
  }
161
143
  });
162
144
  await this.baseCheckoutSessionService.handleCheckoutSuccess({ id });
@@ -164,7 +146,7 @@ var StripeCheckoutSessionService = class {
164
146
  async handleCheckoutFailure({ id }) {
165
147
  await this.stripeClient.checkout.sessions.update(id, {
166
148
  metadata: {
167
- status: 'FAILED'
149
+ status: "FAILED"
168
150
  }
169
151
  });
170
152
  await this.baseCheckoutSessionService.handleCheckoutFailure({ id });
@@ -172,17 +154,9 @@ var StripeCheckoutSessionService = class {
172
154
  };
173
155
 
174
156
  // services/paymentLink.service.ts
175
- import { BasePaymentLinkService } from '@forklaunch/implementation-billing-base/services';
157
+ import { BasePaymentLinkService } from "@forklaunch/implementation-billing-base/services";
176
158
  var StripePaymentLinkService = class {
177
- constructor(
178
- stripeClient,
179
- em,
180
- cache,
181
- openTelemetryCollector,
182
- schemaValidator,
183
- mappers,
184
- options
185
- ) {
159
+ constructor(stripeClient, em, cache, openTelemetryCollector, schemaValidator, mappers, options) {
186
160
  this.options = options;
187
161
  this.stripeClient = stripeClient;
188
162
  this.em = em;
@@ -216,11 +190,10 @@ var StripePaymentLinkService = class {
216
190
  {
217
191
  ...paymentLinkDto,
218
192
  id: session.id,
219
- amount:
220
- session.line_items?.data.reduce(
221
- (total, item) => total + item.amount_total,
222
- 0
223
- ) ?? 0
193
+ amount: session.line_items?.data.reduce(
194
+ (total, item) => total + item.amount_total,
195
+ 0
196
+ ) ?? 0
224
197
  },
225
198
  this.em,
226
199
  session,
@@ -242,11 +215,10 @@ var StripePaymentLinkService = class {
242
215
  {
243
216
  ...paymentLinkDto,
244
217
  id: session.id,
245
- amount:
246
- session.line_items?.data.reduce(
247
- (total, item) => total + item.amount_total,
248
- 0
249
- ) ?? 0
218
+ amount: session.line_items?.data.reduce(
219
+ (total, item) => total + item.amount_total,
220
+ 0
221
+ ) ?? 0
250
222
  },
251
223
  this.em,
252
224
  session
@@ -258,15 +230,14 @@ var StripePaymentLinkService = class {
258
230
  }
259
231
  async getPaymentLink({ id }) {
260
232
  const stripePaymentLink = await this.stripeClient.paymentLinks.retrieve(id);
261
- const databasePaymentLink =
262
- await this.basePaymentLinkService.getPaymentLink({ id });
233
+ const databasePaymentLink = await this.basePaymentLinkService.getPaymentLink({ id });
263
234
  databasePaymentLink.stripeFields = stripePaymentLink;
264
235
  return databasePaymentLink;
265
236
  }
266
237
  async expirePaymentLink({ id }) {
267
238
  await this.stripeClient.paymentLinks.update(id, {
268
239
  metadata: {
269
- status: 'EXPIRED'
240
+ status: "EXPIRED"
270
241
  }
271
242
  });
272
243
  await this.basePaymentLinkService.expirePaymentLink({ id });
@@ -274,7 +245,7 @@ var StripePaymentLinkService = class {
274
245
  async handlePaymentSuccess({ id }) {
275
246
  await this.stripeClient.paymentLinks.update(id, {
276
247
  metadata: {
277
- status: 'COMPLETED'
248
+ status: "COMPLETED"
278
249
  }
279
250
  });
280
251
  await this.basePaymentLinkService.handlePaymentSuccess({ id });
@@ -282,7 +253,7 @@ var StripePaymentLinkService = class {
282
253
  async handlePaymentFailure({ id }) {
283
254
  await this.stripeClient.paymentLinks.update(id, {
284
255
  metadata: {
285
- status: 'FAILED'
256
+ status: "FAILED"
286
257
  }
287
258
  });
288
259
  await this.basePaymentLinkService.handlePaymentFailure({ id });
@@ -291,8 +262,7 @@ var StripePaymentLinkService = class {
291
262
  const stripePaymentLinks = await this.stripeClient.paymentLinks.list({
292
263
  active: true
293
264
  });
294
- const databasePaymentLinks =
295
- await this.basePaymentLinkService.listPaymentLinks(idsDto);
265
+ const databasePaymentLinks = await this.basePaymentLinkService.listPaymentLinks(idsDto);
296
266
  return await Promise.all(
297
267
  databasePaymentLinks.map(async (paymentLink) => {
298
268
  const stripePaymentLink = stripePaymentLinks.data.find(
@@ -311,16 +281,9 @@ var StripePaymentLinkService = class {
311
281
  };
312
282
 
313
283
  // services/plan.service.ts
314
- import { BasePlanService } from '@forklaunch/implementation-billing-base/services';
284
+ import { BasePlanService } from "@forklaunch/implementation-billing-base/services";
315
285
  var StripePlanService = class {
316
- constructor(
317
- stripeClient,
318
- em,
319
- openTelemetryCollector,
320
- schemaValidator,
321
- mappers,
322
- options
323
- ) {
286
+ constructor(stripeClient, em, openTelemetryCollector, schemaValidator, mappers, options) {
324
287
  this.options = options;
325
288
  this.stripeClient = stripeClient;
326
289
  this.em = em;
@@ -352,7 +315,7 @@ var StripePlanService = class {
352
315
  {
353
316
  ...planDto,
354
317
  externalId: stripePlan.id,
355
- billingProvider: 'stripe'
318
+ billingProvider: "stripe"
356
319
  },
357
320
  em ?? this.em,
358
321
  stripePlan
@@ -361,13 +324,12 @@ var StripePlanService = class {
361
324
  }
362
325
  async getPlan(idDto, em) {
363
326
  const plan = await this.stripeClient.plans.retrieve(idDto.id);
364
- const id = (
365
- await em?.findOne(this.options?.databaseTableName ?? 'plan', {
366
- externalId: idDto.id
367
- })
368
- )?.id;
327
+ const id = (await em?.findOne(
328
+ this.options?.databaseTableName ?? "plan",
329
+ { externalId: idDto.id }
330
+ ))?.id;
369
331
  if (!id) {
370
- throw new Error('Plan not found');
332
+ throw new Error("Plan not found");
371
333
  }
372
334
  const planEntity = await this.basePlanService.getPlan({ id }, em);
373
335
  planEntity.stripeFields = plan;
@@ -375,8 +337,8 @@ var StripePlanService = class {
375
337
  }
376
338
  async updatePlan(planDto, em) {
377
339
  const existingPlan = await this.stripeClient.plans.retrieve(planDto.id);
378
- const plan = await this.stripeClient.plans.del(planDto.id).then(() =>
379
- this.stripeClient.plans.create({
340
+ const plan = await this.stripeClient.plans.del(planDto.id).then(
341
+ () => this.stripeClient.plans.create({
380
342
  ...planDto.stripeFields,
381
343
  interval: planDto.cadence ?? existingPlan.interval,
382
344
  product: planDto.name,
@@ -388,7 +350,7 @@ var StripePlanService = class {
388
350
  {
389
351
  ...planDto,
390
352
  externalId: plan.id,
391
- billingProvider: 'stripe'
353
+ billingProvider: "stripe"
392
354
  },
393
355
  em ?? this.em,
394
356
  plan
@@ -406,15 +368,12 @@ var StripePlanService = class {
406
368
  const plans = await this.stripeClient.plans.list({
407
369
  active: true
408
370
  });
409
- const planIds = (
410
- await em?.findAll(this.options?.databaseTableName ?? 'plan', {
411
- where: { externalId: { $in: plans.data.map((plan) => plan.id) } }
412
- })
413
- )
414
- ?.filter((s) => idsDto?.ids?.includes(s.id))
415
- ?.map((s) => s.id);
371
+ const planIds = (await em?.findAll(
372
+ this.options?.databaseTableName ?? "plan",
373
+ { where: { externalId: { $in: plans.data.map((plan) => plan.id) } } }
374
+ ))?.filter((s) => idsDto?.ids?.includes(s.id))?.map((s) => s.id);
416
375
  if (!planIds) {
417
- throw new Error('Plans not found');
376
+ throw new Error("Plans not found");
418
377
  }
419
378
  return await Promise.all(
420
379
  (await this.basePlanService.listPlans({ ids: planIds }, em)).map(
@@ -430,16 +389,9 @@ var StripePlanService = class {
430
389
  };
431
390
 
432
391
  // services/subscription.service.ts
433
- import { BaseSubscriptionService } from '@forklaunch/implementation-billing-base/services';
392
+ import { BaseSubscriptionService } from "@forklaunch/implementation-billing-base/services";
434
393
  var StripeSubscriptionService = class {
435
- constructor(
436
- stripeClient,
437
- em,
438
- openTelemetryCollector,
439
- schemaValidator,
440
- mappers,
441
- options
442
- ) {
394
+ constructor(stripeClient, em, openTelemetryCollector, schemaValidator, mappers, options) {
443
395
  this.options = options;
444
396
  this.stripeClient = stripeClient;
445
397
  this.em = em;
@@ -474,15 +426,14 @@ var StripeSubscriptionService = class {
474
426
  {
475
427
  ...subscriptionDto,
476
428
  externalId: subscription.id,
477
- billingProvider: 'stripe'
429
+ billingProvider: "stripe"
478
430
  },
479
431
  em ?? this.em,
480
432
  subscription
481
433
  );
482
434
  }
483
435
  async getSubscription(idDto, em) {
484
- const subscriptionEntity =
485
- await this.baseSubscriptionService.getSubscription(idDto, em);
436
+ const subscriptionEntity = await this.baseSubscriptionService.getSubscription(idDto, em);
486
437
  const stripeSubscription = await this.stripeClient.subscriptions.retrieve(
487
438
  idDto.id
488
439
  );
@@ -490,8 +441,7 @@ var StripeSubscriptionService = class {
490
441
  return subscriptionEntity;
491
442
  }
492
443
  async getUserSubscription(idDto, em) {
493
- const subscriptionEntity =
494
- await this.baseSubscriptionService.getUserSubscription(idDto, em);
444
+ const subscriptionEntity = await this.baseSubscriptionService.getUserSubscription(idDto, em);
495
445
  const stripeSubscription = await this.stripeClient.subscriptions.retrieve(
496
446
  idDto.id
497
447
  );
@@ -499,19 +449,17 @@ var StripeSubscriptionService = class {
499
449
  return subscriptionEntity;
500
450
  }
501
451
  async getOrganizationSubscription(idDto, em) {
502
- const id = (
503
- await em?.findOne(this.options?.databaseTableName ?? 'subscription', {
504
- externalId: idDto.id
505
- })
506
- )?.id;
452
+ const id = (await em?.findOne(
453
+ this.options?.databaseTableName ?? "subscription",
454
+ { externalId: idDto.id }
455
+ ))?.id;
507
456
  if (!id) {
508
- throw new Error('Subscription not found');
457
+ throw new Error("Subscription not found");
509
458
  }
510
- const subscriptionEntity =
511
- await this.baseSubscriptionService.getOrganizationSubscription(
512
- { id },
513
- em
514
- );
459
+ const subscriptionEntity = await this.baseSubscriptionService.getOrganizationSubscription(
460
+ { id },
461
+ em
462
+ );
515
463
  const stripeSubscription = await this.stripeClient.subscriptions.retrieve(
516
464
  idDto.id
517
465
  );
@@ -534,7 +482,7 @@ var StripeSubscriptionService = class {
534
482
  {
535
483
  ...subscriptionDto,
536
484
  externalId: subscription.id,
537
- billingProvider: 'stripe',
485
+ billingProvider: "stripe",
538
486
  providerFields: subscription
539
487
  },
540
488
  em ?? this.em,
@@ -546,18 +494,15 @@ var StripeSubscriptionService = class {
546
494
  await this.baseSubscriptionService.deleteSubscription(idDto, em);
547
495
  }
548
496
  async listSubscriptions(idsDto, em) {
549
- const subscriptions = (
550
- await this.stripeClient.subscriptions.list({
551
- status: 'active'
552
- })
553
- ).data.filter((s) => idsDto.ids?.includes(s.id));
554
- const ids = (
555
- await em?.findAll(this.options?.databaseTableName ?? 'subscription', {
556
- where: { externalId: { $in: subscriptions.map((s) => s.id) } }
557
- })
558
- )?.map((s) => s.id);
497
+ const subscriptions = (await this.stripeClient.subscriptions.list({
498
+ status: "active"
499
+ })).data.filter((s) => idsDto.ids?.includes(s.id));
500
+ const ids = (await em?.findAll(
501
+ this.options?.databaseTableName ?? "subscription",
502
+ { where: { externalId: { $in: subscriptions.map((s) => s.id) } } }
503
+ ))?.map((s) => s.id);
559
504
  if (!ids) {
560
- throw new Error('Subscriptions not found');
505
+ throw new Error("Subscriptions not found");
561
506
  }
562
507
  return await Promise.all(
563
508
  (await this.baseSubscriptionService.listSubscriptions({ ids }, em)).map(
@@ -583,7 +528,7 @@ var StripeSubscriptionService = class {
583
528
 
584
529
  // domain/enum/billingProvider.enum.ts
585
530
  var BillingProviderEnum = {
586
- STRIPE: 'stripe'
531
+ STRIPE: "stripe"
587
532
  };
588
533
 
589
534
  // services/webhook.service.ts
@@ -597,17 +542,7 @@ var StripeWebhookService = class {
597
542
  paymentLinkService;
598
543
  planService;
599
544
  subscriptionService;
600
- constructor(
601
- stripeClient,
602
- em,
603
- schemaValidator,
604
- openTelemetryCollector,
605
- billingPortalService,
606
- checkoutSessionService,
607
- paymentLinkService,
608
- planService,
609
- subscriptionService
610
- ) {
545
+ constructor(stripeClient, em, schemaValidator, openTelemetryCollector, billingPortalService, checkoutSessionService, paymentLinkService, planService, subscriptionService) {
611
546
  this.stripeClient = stripeClient;
612
547
  this.em = em;
613
548
  this.schemaValidator = schemaValidator;
@@ -620,11 +555,11 @@ var StripeWebhookService = class {
620
555
  }
621
556
  async handleWebhookEvent(event) {
622
557
  if (this.openTelemetryCollector) {
623
- this.openTelemetryCollector.info('Handling webhook event', event);
558
+ this.openTelemetryCollector.info("Handling webhook event", event);
624
559
  }
625
560
  const eventType = event.type;
626
561
  switch (eventType) {
627
- case 'billing_portal.session.created': {
562
+ case "billing_portal.session.created": {
628
563
  this.billingPortalService.baseBillingPortalService.createBillingPortalSession(
629
564
  {
630
565
  id: event.data.object.id,
@@ -635,156 +570,130 @@ var StripeWebhookService = class {
635
570
  );
636
571
  break;
637
572
  }
638
- case 'checkout.session.expired': {
573
+ case "checkout.session.expired": {
639
574
  this.checkoutSessionService.handleCheckoutFailure({
640
575
  id: event.data.object.id
641
576
  });
642
577
  break;
643
578
  }
644
- case 'checkout.session.completed': {
579
+ case "checkout.session.completed": {
645
580
  this.checkoutSessionService.handleCheckoutSuccess({
646
581
  id: event.data.object.id
647
582
  });
648
583
  break;
649
584
  }
650
- case 'payment_link.created':
585
+ case "payment_link.created":
651
586
  {
652
587
  this.paymentLinkService.basePaymentLinkService.createPaymentLink({
653
588
  id: event.data.object.id,
654
- amount:
655
- event.data.object.line_items?.data.reduce(
656
- (total, item) => total + item.amount_total,
657
- 0
658
- ) ?? 0,
589
+ amount: event.data.object.line_items?.data.reduce(
590
+ (total, item) => total + item.amount_total,
591
+ 0
592
+ ) ?? 0,
659
593
  paymentMethods: event.data.object.payment_method_types,
660
- status: 'CREATED',
594
+ status: "CREATED",
661
595
  currency: event.data.object.currency
662
596
  });
663
597
  }
664
598
  break;
665
- case 'payment_link.updated': {
599
+ case "payment_link.updated": {
666
600
  this.paymentLinkService.basePaymentLinkService.updatePaymentLink({
667
601
  id: event.data.object.id,
668
- amount:
669
- event.data.object.line_items?.data.reduce(
670
- (total, item) => total + item.amount_total,
671
- 0
672
- ) ?? 0,
602
+ amount: event.data.object.line_items?.data.reduce(
603
+ (total, item) => total + item.amount_total,
604
+ 0
605
+ ) ?? 0,
673
606
  paymentMethods: event.data.object.payment_method_types,
674
- status: 'UPDATED',
607
+ status: "UPDATED",
675
608
  currency: event.data.object.currency
676
609
  });
677
610
  break;
678
611
  }
679
- case 'plan.created': {
680
- if (
681
- typeof event.data.object.product === 'object' &&
682
- event.data.object.product != null &&
683
- event.data.object.amount != null
684
- ) {
612
+ case "plan.created": {
613
+ if (typeof event.data.object.product === "object" && event.data.object.product != null && event.data.object.amount != null) {
685
614
  this.planService.basePlanService.createPlan({
686
615
  id: event.data.object.id,
687
616
  billingProvider: BillingProviderEnum.STRIPE,
688
617
  cadence: event.data.object.interval,
689
618
  currency: event.data.object.currency,
690
619
  active: true,
691
- name:
692
- typeof event.data.object.product === 'string'
693
- ? event.data.object.product
694
- : event.data.object.product?.id,
620
+ name: typeof event.data.object.product === "string" ? event.data.object.product : event.data.object.product?.id,
695
621
  price: event.data.object.amount,
696
622
  externalId: event.data.object.id
697
623
  });
698
624
  } else {
699
- throw new Error('Invalid plan');
625
+ throw new Error("Invalid plan");
700
626
  }
701
627
  break;
702
628
  }
703
- case 'plan.updated': {
704
- if (
705
- typeof event.data.object.product === 'object' &&
706
- event.data.object.product != null &&
707
- event.data.object.amount != null
708
- ) {
629
+ case "plan.updated": {
630
+ if (typeof event.data.object.product === "object" && event.data.object.product != null && event.data.object.amount != null) {
709
631
  this.planService.basePlanService.updatePlan({
710
632
  id: event.data.object.id,
711
633
  billingProvider: BillingProviderEnum.STRIPE,
712
634
  cadence: event.data.object.interval,
713
635
  currency: event.data.object.currency,
714
636
  active: true,
715
- name:
716
- typeof event.data.object.product === 'string'
717
- ? event.data.object.product
718
- : event.data.object.product?.id,
637
+ name: typeof event.data.object.product === "string" ? event.data.object.product : event.data.object.product?.id,
719
638
  price: event.data.object.amount,
720
639
  externalId: event.data.object.id
721
640
  });
722
641
  } else {
723
- throw new Error('Invalid plan');
642
+ throw new Error("Invalid plan");
724
643
  }
725
644
  break;
726
645
  }
727
- case 'plan.deleted': {
646
+ case "plan.deleted": {
728
647
  this.planService.deletePlan({
729
648
  id: event.data.object.id
730
649
  });
731
650
  break;
732
651
  }
733
- case 'customer.subscription.created': {
652
+ case "customer.subscription.created": {
734
653
  this.subscriptionService.baseSubscriptionService.createSubscription({
735
654
  id: event.data.object.id,
736
- partyId:
737
- typeof event.data.object.customer === 'string'
738
- ? event.data.object.customer
739
- : event.data.object.customer.id,
740
- partyType: 'USER',
655
+ partyId: typeof event.data.object.customer === "string" ? event.data.object.customer : event.data.object.customer.id,
656
+ partyType: "USER",
741
657
  description: event.data.object.description ?? void 0,
742
658
  active: true,
743
659
  productId: event.data.object.items.data[0].plan.id,
744
660
  externalId: event.data.object.id,
745
661
  billingProvider: BillingProviderEnum.STRIPE,
746
662
  startDate: new Date(event.data.object.created),
747
- endDate: event.data.object.cancel_at
748
- ? new Date(event.data.object.cancel_at)
749
- : /* @__PURE__ */ new Date(Infinity),
663
+ endDate: event.data.object.cancel_at ? new Date(event.data.object.cancel_at) : /* @__PURE__ */ new Date(Infinity),
750
664
  status: event.data.object.status
751
665
  });
752
666
  break;
753
667
  }
754
- case 'customer.subscription.updated': {
668
+ case "customer.subscription.updated": {
755
669
  this.subscriptionService.baseSubscriptionService.updateSubscription({
756
670
  id: event.data.object.id,
757
- partyId:
758
- typeof event.data.object.customer === 'string'
759
- ? event.data.object.customer
760
- : event.data.object.customer.id,
761
- partyType: 'USER',
671
+ partyId: typeof event.data.object.customer === "string" ? event.data.object.customer : event.data.object.customer.id,
672
+ partyType: "USER",
762
673
  description: event.data.object.description ?? void 0,
763
674
  active: true,
764
675
  externalId: event.data.object.id,
765
676
  billingProvider: BillingProviderEnum.STRIPE,
766
677
  startDate: new Date(event.data.object.created),
767
- endDate: event.data.object.cancel_at
768
- ? new Date(event.data.object.cancel_at)
769
- : /* @__PURE__ */ new Date(Infinity),
678
+ endDate: event.data.object.cancel_at ? new Date(event.data.object.cancel_at) : /* @__PURE__ */ new Date(Infinity),
770
679
  productId: event.data.object.items.data[0].plan.id,
771
680
  status: event.data.object.status
772
681
  });
773
682
  break;
774
683
  }
775
- case 'customer.subscription.deleted': {
684
+ case "customer.subscription.deleted": {
776
685
  this.subscriptionService.deleteSubscription({
777
686
  id: event.data.object.id
778
687
  });
779
688
  break;
780
689
  }
781
- case 'customer.subscription.paused': {
690
+ case "customer.subscription.paused": {
782
691
  this.subscriptionService.cancelSubscription({
783
692
  id: event.data.object.id
784
693
  });
785
694
  break;
786
695
  }
787
- case 'customer.subscription.resumed': {
696
+ case "customer.subscription.resumed": {
788
697
  this.subscriptionService.resumeSubscription({
789
698
  id: event.data.object.id
790
699
  });
@@ -792,7 +701,7 @@ var StripeWebhookService = class {
792
701
  }
793
702
  default:
794
703
  this.openTelemetryCollector.info(
795
- 'Unprocessed stripe event type',
704
+ "Unprocessed stripe event type",
796
705
  eventType
797
706
  );
798
707
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-billing-stripe",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Stripe implementation for forklaunch billing",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -42,20 +42,20 @@
42
42
  "lib/**"
43
43
  ],
44
44
  "dependencies": {
45
- "@forklaunch/common": "^0.6.3",
46
- "@forklaunch/core": "^0.14.3",
47
- "@forklaunch/internal": "^0.3.3",
48
- "@forklaunch/validator": "^0.10.3",
45
+ "@forklaunch/common": "^0.6.4",
46
+ "@forklaunch/core": "^0.14.5",
47
+ "@forklaunch/internal": "^0.3.4",
48
+ "@forklaunch/validator": "^0.10.4",
49
49
  "@mikro-orm/core": "^6.5.1",
50
- "@sinclair/typebox": "^0.34.40",
50
+ "@sinclair/typebox": "^0.34.41",
51
51
  "ajv": "^8.17.1",
52
52
  "stripe": "^18.5.0",
53
53
  "zod": "^4.1.5",
54
- "@forklaunch/implementation-billing-base": "0.6.0",
55
- "@forklaunch/interfaces-billing": "0.6.0"
54
+ "@forklaunch/implementation-billing-base": "0.6.2",
55
+ "@forklaunch/interfaces-billing": "0.6.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@typescript/native-preview": "7.0.0-dev.20250828.1",
58
+ "@typescript/native-preview": "7.0.0-dev.20250830.1",
59
59
  "depcheck": "^1.4.7",
60
60
  "prettier": "^3.6.2",
61
61
  "typedoc": "^0.28.11"