@forklaunch/implementation-billing-stripe 0.5.23 → 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.
- package/lib/domain/enum/index.d.mts +6 -123
- package/lib/domain/enum/index.d.ts +6 -123
- package/lib/domain/enum/index.js +8 -0
- package/lib/domain/enum/index.mjs +7 -0
- package/lib/domain/schemas/index.d.mts +39 -39
- package/lib/domain/schemas/index.d.ts +39 -39
- package/lib/domain/schemas/index.js +8 -8
- package/lib/domain/schemas/index.mjs +8 -8
- package/lib/domain/types/index.d.mts +470 -66
- package/lib/domain/types/index.d.ts +470 -66
- package/lib/eject/domain/enum/index.ts +1 -0
- package/lib/eject/domain/enum/party.enum.ts +5 -0
- package/lib/eject/domain/schemas/plan.schema.ts +2 -2
- package/lib/eject/domain/schemas/subscription.schema.ts +2 -2
- package/lib/eject/domain/types/billingPortal.mapper.types.ts +7 -4
- package/lib/eject/domain/types/checkoutSession.mapper.types.ts +7 -4
- package/lib/eject/domain/types/paymentLink.mapper.types.ts +7 -4
- package/lib/eject/domain/types/plan.mapper.types.ts +9 -4
- package/lib/eject/domain/types/stripe.entity.types.ts +103 -63
- package/lib/eject/domain/types/stripeWebhookEvent.types.ts +16 -0
- package/lib/eject/domain/types/subscription.mapper.types.ts +10 -7
- package/lib/eject/services/checkoutSession.service.ts +5 -5
- package/lib/eject/services/paymentLink.service.ts +14 -12
- package/lib/eject/services/webhook.service.ts +4 -3
- package/lib/planCadence.enum-BKHaW1xa.d.mts +126 -0
- package/lib/planCadence.enum-BKHaW1xa.d.ts +126 -0
- package/lib/services/index.d.mts +19 -18
- package/lib/services/index.d.ts +19 -18
- package/lib/services/index.js +86 -14
- package/lib/services/index.mjs +86 -14
- package/package.json +10 -10
package/lib/services/index.mjs
CHANGED
|
@@ -213,17 +213,19 @@ var StripePaymentLinkService = class {
|
|
|
213
213
|
}
|
|
214
214
|
);
|
|
215
215
|
const paymentLink = await this.basePaymentLinkService.updatePaymentLink(
|
|
216
|
-
await this.mappers.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
216
|
+
await this.mappers.PaymentLinkMapper.toDto(
|
|
217
|
+
await this.mappers.UpdatePaymentLinkMapper.toEntity(
|
|
218
|
+
{
|
|
219
|
+
...paymentLinkDto,
|
|
220
|
+
id: session.id,
|
|
221
|
+
amount: session.line_items?.data.reduce(
|
|
222
|
+
(total, item) => total + item.amount_total,
|
|
223
|
+
0
|
|
224
|
+
) ?? 0
|
|
225
|
+
},
|
|
226
|
+
this.em,
|
|
227
|
+
session
|
|
228
|
+
)
|
|
227
229
|
),
|
|
228
230
|
...args
|
|
229
231
|
);
|
|
@@ -581,12 +583,82 @@ var StripeSubscriptionService = class {
|
|
|
581
583
|
}
|
|
582
584
|
};
|
|
583
585
|
|
|
584
|
-
//
|
|
586
|
+
// domain/enum/party.enum.ts
|
|
585
587
|
var PartyEnum = {
|
|
586
588
|
USER: "user",
|
|
587
589
|
ORGANIZATION: "organization"
|
|
588
590
|
};
|
|
589
591
|
|
|
592
|
+
// persistence/entities/index.ts
|
|
593
|
+
import { defineComplianceEntity, fp } from "@forklaunch/core/persistence";
|
|
594
|
+
var BillingPortal = defineComplianceEntity({
|
|
595
|
+
name: "BillingPortal",
|
|
596
|
+
properties: {
|
|
597
|
+
id: fp.string().primary().compliance("none"),
|
|
598
|
+
customerId: fp.string().compliance("none"),
|
|
599
|
+
providerFields: fp.json().compliance("none")
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
var CheckoutSession = defineComplianceEntity({
|
|
603
|
+
name: "CheckoutSession",
|
|
604
|
+
properties: {
|
|
605
|
+
id: fp.string().primary().compliance("none"),
|
|
606
|
+
customerId: fp.string().compliance("none"),
|
|
607
|
+
paymentMethods: fp.enum().array().compliance("none"),
|
|
608
|
+
currency: fp.enum().compliance("none"),
|
|
609
|
+
status: fp.enum().compliance("none"),
|
|
610
|
+
providerFields: fp.json().compliance("none")
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
var PaymentLink = defineComplianceEntity({
|
|
614
|
+
name: "PaymentLink",
|
|
615
|
+
properties: {
|
|
616
|
+
id: fp.string().primary().compliance("none"),
|
|
617
|
+
amount: fp.double().compliance("none"),
|
|
618
|
+
paymentMethods: fp.enum().array().compliance("none"),
|
|
619
|
+
currency: fp.enum().compliance("none"),
|
|
620
|
+
status: fp.enum().compliance("none"),
|
|
621
|
+
providerFields: fp.json().compliance("none")
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
var Plan = defineComplianceEntity({
|
|
625
|
+
name: "Plan",
|
|
626
|
+
properties: {
|
|
627
|
+
id: fp.string().primary().compliance("none"),
|
|
628
|
+
name: fp.string().compliance("none"),
|
|
629
|
+
price: fp.double().compliance("none"),
|
|
630
|
+
externalId: fp.string().compliance("none"),
|
|
631
|
+
cadence: fp.enum().compliance("none"),
|
|
632
|
+
currency: fp.enum().compliance("none"),
|
|
633
|
+
billingProvider: fp.enum().compliance("none"),
|
|
634
|
+
providerFields: fp.json().compliance("none")
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
var Subscription = defineComplianceEntity({
|
|
638
|
+
name: "Subscription",
|
|
639
|
+
properties: {
|
|
640
|
+
id: fp.string().primary().compliance("none"),
|
|
641
|
+
partyId: fp.string().compliance("none"),
|
|
642
|
+
externalId: fp.string().compliance("none"),
|
|
643
|
+
partyType: fp.enum().compliance("none"),
|
|
644
|
+
billingProvider: fp.enum().compliance("none"),
|
|
645
|
+
active: fp.boolean().compliance("none"),
|
|
646
|
+
providerFields: fp.json().compliance("none")
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
var StripeWebhookEvent = defineComplianceEntity({
|
|
650
|
+
name: "StripeWebhookEvent",
|
|
651
|
+
properties: {
|
|
652
|
+
id: fp.uuid().primary().compliance("none"),
|
|
653
|
+
createdAt: fp.datetime().onCreate(() => /* @__PURE__ */ new Date()).compliance("none"),
|
|
654
|
+
updatedAt: fp.datetime().onCreate(() => /* @__PURE__ */ new Date()).onUpdate(() => /* @__PURE__ */ new Date()).compliance("none"),
|
|
655
|
+
stripeId: fp.string().compliance("none"),
|
|
656
|
+
idempotencyKey: fp.string().nullable().compliance("none"),
|
|
657
|
+
eventType: fp.string().compliance("none"),
|
|
658
|
+
eventData: fp.json().compliance("none")
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
590
662
|
// domain/enum/billingProvider.enum.ts
|
|
591
663
|
var BillingProviderEnum = {
|
|
592
664
|
STRIPE: "stripe"
|
|
@@ -638,7 +710,7 @@ var StripeWebhookService = class {
|
|
|
638
710
|
if (this.openTelemetryCollector) {
|
|
639
711
|
this.openTelemetryCollector.info("Handling webhook event", event);
|
|
640
712
|
}
|
|
641
|
-
if (await this.em.findOne(
|
|
713
|
+
if (await this.em.findOne(StripeWebhookEvent, {
|
|
642
714
|
idempotencyKey: event.request?.idempotency_key
|
|
643
715
|
})) {
|
|
644
716
|
this.openTelemetryCollector.info(
|
|
@@ -883,7 +955,7 @@ var StripeWebhookService = class {
|
|
|
883
955
|
);
|
|
884
956
|
break;
|
|
885
957
|
}
|
|
886
|
-
await this.em.insert(
|
|
958
|
+
await this.em.insert(StripeWebhookEvent, {
|
|
887
959
|
stripeId: event.id,
|
|
888
960
|
idempotencyKey: event.request?.idempotency_key,
|
|
889
961
|
eventType: event.type,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-billing-stripe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Stripe implementation for forklaunch billing",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -42,23 +42,23 @@
|
|
|
42
42
|
"lib/**"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@forklaunch/common": "^0.
|
|
46
|
-
"@forklaunch/core": "^0.
|
|
47
|
-
"@forklaunch/internal": "^0.
|
|
48
|
-
"@forklaunch/validator": "^0.
|
|
49
|
-
"@mikro-orm/core": "
|
|
45
|
+
"@forklaunch/common": "^1.0.13",
|
|
46
|
+
"@forklaunch/core": "^1.0.13",
|
|
47
|
+
"@forklaunch/internal": "^1.0.13",
|
|
48
|
+
"@forklaunch/validator": "^1.0.13",
|
|
49
|
+
"@mikro-orm/core": "7.0.5",
|
|
50
50
|
"@sinclair/typebox": "^0.34.48",
|
|
51
51
|
"ajv": "^8.18.0",
|
|
52
52
|
"stripe": "^20.4.1",
|
|
53
53
|
"zod": "^4.3.6",
|
|
54
|
-
"@forklaunch/implementation-billing-base": "0.
|
|
55
|
-
"@forklaunch/interfaces-billing": "0.
|
|
54
|
+
"@forklaunch/implementation-billing-base": "1.0.0",
|
|
55
|
+
"@forklaunch/interfaces-billing": "1.0.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
58
|
+
"@typescript/native-preview": "7.0.0-dev.20260301.1",
|
|
59
59
|
"depcheck": "^1.4.7",
|
|
60
60
|
"prettier": "^3.8.1",
|
|
61
|
-
"typedoc": "^0.28.
|
|
61
|
+
"typedoc": "^0.28.18"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsgo --noEmit && tsup domain/schemas/index.ts services/index.ts domain/enum/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|