@antelopejs/dms-saas 0.12.5-next.292.g1249caf → 0.12.5-next.293.gb11f00a
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/README.md +1 -1
- package/dist/routes/public/webhooks/stripe.js +4 -0
- package/dist/routes/public/webhooks/stripe.js.map +1 -1
- package/dist/stripe/client.d.ts +1 -0
- package/dist/stripe/client.js +7 -0
- package/dist/stripe/client.js.map +1 -1
- package/frontend-vue/i18n/locales/saas-en-GB.json +2 -1
- package/frontend-vue/i18n/locales/saas-fr-FR.json +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,8 +16,12 @@ exports.StripeWebhookController = void 0;
|
|
|
16
16
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
17
|
const stripe_1 = require("../../../stripe");
|
|
18
18
|
const HTTP_BAD_REQUEST = 400;
|
|
19
|
+
const HTTP_NOT_FOUND = 404;
|
|
19
20
|
class StripeWebhookController extends (0, interface_api_1.Controller)("/api/saas/webhooks/stripe") {
|
|
20
21
|
async receive(rawBody, signature) {
|
|
22
|
+
if (!(0, stripe_1.isStripeWebhookConfigured)()) {
|
|
23
|
+
throw new interface_api_1.HTTPResult(HTTP_NOT_FOUND, "saas.errors.webhook.not_configured");
|
|
24
|
+
}
|
|
21
25
|
let event;
|
|
22
26
|
try {
|
|
23
27
|
event = (0, stripe_1.getStripeClient)().webhooks.constructEvent(rawBody, signature, (0, stripe_1.getStripeWebhookSecret)());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../../../src/routes/public/webhooks/stripe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAMmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../../../src/routes/public/webhooks/stripe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAMmC;AAEnC,4CAKyB;AAEzB,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAa,uBAAwB,SAAQ,IAAA,0BAAU,EACrD,2BAA2B,CAC5B;IAEO,AAAN,KAAK,CAAC,OAAO,CACA,OAAe,EACe,SAAiB;QAE1D,IAAI,CAAC,IAAA,kCAAyB,GAAE,EAAE,CAAC;YACjC,MAAM,IAAI,0BAAU,CAClB,cAAc,EACd,oCAAoC,CACrC,CAAC;QACJ,CAAC;QACD,IAAI,KAAmB,CAAC;QACxB,IAAI,CAAC;YACH,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAC,QAAQ,CAAC,cAAc,CAC/C,OAAO,EACP,SAAS,EACT,IAAA,+BAAsB,GAAE,CACzB,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,0BAAU,CAClB,gBAAgB,EAChB,uCAAuC,CACxC,CAAC;QACJ,CAAC;QACD,MAAM,IAAA,mCAA0B,EAAC,KAAK,CAAC,CAAC;QACxC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;CACF;AA9BD,0DA8BC;AA1BO;IADL,IAAA,oBAAI,EAAC,GAAG,CAAC;IAEP,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,yBAAS,EAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;;qCADpB,MAAM;;sDAwB3B"}
|
package/dist/stripe/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare const DEFAULT_STRIPE_READ_MAX_NETWORK_RETRIES = 0;
|
|
|
6
6
|
export declare function initStripeClient(config: DmsSaasStripeConfig): void;
|
|
7
7
|
export declare function stripeDashboardUrl(path: string): string;
|
|
8
8
|
export declare function isStripeConfigured(): boolean;
|
|
9
|
+
export declare function isStripeWebhookConfigured(): boolean;
|
|
9
10
|
export declare function getStripeClient(): Stripe;
|
|
10
11
|
export declare function getStripeReadClient(): Stripe;
|
|
11
12
|
export declare function getStripeWebhookSecret(): string;
|
package/dist/stripe/client.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.DEFAULT_STRIPE_READ_MAX_NETWORK_RETRIES = exports.DEFAULT_STRIPE_READ_TI
|
|
|
7
7
|
exports.initStripeClient = initStripeClient;
|
|
8
8
|
exports.stripeDashboardUrl = stripeDashboardUrl;
|
|
9
9
|
exports.isStripeConfigured = isStripeConfigured;
|
|
10
|
+
exports.isStripeWebhookConfigured = isStripeWebhookConfigured;
|
|
10
11
|
exports.getStripeClient = getStripeClient;
|
|
11
12
|
exports.getStripeReadClient = getStripeReadClient;
|
|
12
13
|
exports.getStripeWebhookSecret = getStripeWebhookSecret;
|
|
@@ -51,6 +52,12 @@ function stripeDashboardUrl(path) {
|
|
|
51
52
|
function isStripeConfigured() {
|
|
52
53
|
return stripeConfigured;
|
|
53
54
|
}
|
|
55
|
+
function isStripeWebhookConfigured() {
|
|
56
|
+
return (stripeConfigured &&
|
|
57
|
+
(0, primitive_guards_1.isString)(stripeWebhookSecret) &&
|
|
58
|
+
stripeWebhookSecret !== "" &&
|
|
59
|
+
!stripeWebhookSecret.includes(PLACEHOLDER_MARKER));
|
|
60
|
+
}
|
|
54
61
|
function getStripeClient() {
|
|
55
62
|
if (!stripeClient) {
|
|
56
63
|
throw new Error("Stripe client not initialized. Call initStripeClient first.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/stripe/client.ts"],"names":[],"mappings":";;;;;;AAgDA,4CAaC;AAQD,gDAIC;AAED,gDAEC;AAED,0CAOC;AAQD,kDAOC;AAED,wDAKC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/stripe/client.ts"],"names":[],"mappings":";;;;;;AAgDA,4CAaC;AAQD,gDAIC;AAED,gDAEC;AAOD,8DAOC;AAED,0CAOC;AAQD,kDAOC;AAED,wDAKC;AA1HD,oDAA4B;AAE5B,gEAAqD;AASxC,QAAA,kBAAkB,G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AAC,CAAC;AAC/D,CAAC;AAQD,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAClD,OAAO,GAAG,oBAAoB,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,EAAE,CAAC;AAC7D,CAAC;AAED,SAAgB,kBAAkB;IAChC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAOD,SAAgB,yBAAyB;IACvC,OAAO,CACL,gBAAgB;QAChB,IAAA,2BAAQ,EAAC,mBAAmB,CAAC;QAC7B,mBAAmB,KAAK,EAAE;QAC1B,CAAC,mBAAmB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe;IAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAQD,SAAgB,mBAAmB;IACjC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAgB,sBAAsB;IACpC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
"cannot_demote_last_owner": "The platform needs at least one platform admin"
|
|
141
141
|
},
|
|
142
142
|
"webhook": {
|
|
143
|
-
"invalid_signature": "Invalid webhook signature"
|
|
143
|
+
"invalid_signature": "Invalid webhook signature",
|
|
144
|
+
"not_configured": "Stripe webhooks are not configured"
|
|
144
145
|
},
|
|
145
146
|
"platform_notes": {
|
|
146
147
|
"invalid_target": "Invalid target type",
|
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
"cannot_demote_last_owner": "La plateforme a besoin d'au moins un admin plateforme"
|
|
141
141
|
},
|
|
142
142
|
"webhook": {
|
|
143
|
-
"invalid_signature": "Signature webhook invalide"
|
|
143
|
+
"invalid_signature": "Signature webhook invalide",
|
|
144
|
+
"not_configured": "Les webhooks Stripe ne sont pas configurés"
|
|
144
145
|
},
|
|
145
146
|
"platform_notes": {
|
|
146
147
|
"invalid_target": "Type de cible invalide",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-saas",
|
|
3
|
-
"version": "0.12.5-next.
|
|
3
|
+
"version": "0.12.5-next.293.gb11f00a",
|
|
4
4
|
"description": "SaaS module for the AntelopeJS DMS: self-service sign-up and pricing, plans that gate features, Stripe billing, workspace settings and a back office.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"dmsFrontend": "dist/frontend-module.js",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "b11f00a10ccb2b5efb829e48868e9df0f4c9a4fd",
|
|
98
98
|
"scripts": {
|
|
99
99
|
"build": "pnpm --filter @antelopejs/interface-dms-saas build && rimraf dist && tsc",
|
|
100
100
|
"test:frontend": "ajs dms verify-source --layer node_modules/@antelopejs/dms/frontend-vue --module frontend-vue",
|