@tsed/stripe 8.0.0-alpha.4 → 8.0.0-alpha.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.
- package/lib/esm/middlewares/WebhookEventMiddleware.js.map +1 -1
- package/lib/types/middlewares/WebhookEventMiddleware.d.ts +2 -2
- package/package.json +15 -16
- package/.nycrc +0 -26
- package/lib/cjs/constants/constants.js +0 -6
- package/lib/cjs/constants/constants.js.map +0 -1
- package/lib/cjs/decorators/webhookEvent.js +0 -21
- package/lib/cjs/decorators/webhookEvent.js.map +0 -1
- package/lib/cjs/domain/StripeSettings.js +0 -3
- package/lib/cjs/domain/StripeSettings.js.map +0 -1
- package/lib/cjs/index.js +0 -12
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/middlewares/WebhookEventMiddleware.js +0 -51
- package/lib/cjs/middlewares/WebhookEventMiddleware.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/services/StripeFactory.js +0 -22
- package/lib/cjs/services/StripeFactory.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/constants/constants.d.ts +0 -2
- package/lib/types-esm/decorators/webhookEvent.d.ts +0 -9
- package/lib/types-esm/domain/StripeSettings.d.ts +0 -28
- package/lib/types-esm/index.d.ts +0 -8
- package/lib/types-esm/middlewares/WebhookEventMiddleware.d.ts +0 -14
- package/lib/types-esm/services/StripeFactory.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/WebhookEventMiddleware.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAC,UAAU,EAAoB,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/WebhookEventMiddleware.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAC,UAAU,EAAoB,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACzF,OAAO,8BAA8B,CAAC;AAQ/B,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAOjC,GAAG,CAAmC,SAAiB,EAAmB,IAAY,EAAa,GAAY;QAC7G,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,GAAwB;YAC/C,GAAG,IAAI,CAAC,QAAQ;YAChB,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAsB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,mBAAmB,CAC3B,qHAAqH,CACtH,CAAC;SACH;QAED,IAAI;YACF,GAAG,CAAC,GAAG,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;YAC7C,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;SACxG;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,UAAU,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;SACnE;IACH,CAAC;CACF,CAAA;AAzBC;IAAC,MAAM,EAAE;8BACS,MAAM;sDAAC;AAEzB;IAAC,QAAQ,CAAC,iBAAiB,CAAC;;wDACY;AAExC;IAAK,WAAA,YAAY,CAAC,kBAAkB,CAAC,CAAA;IAAqB,WAAA,aAAa,EAAE,CAAA;IAAgB,WAAA,OAAO,EAAE,CAAA;;6CAAlB,MAAM;;iDAkBrF;AAzBU,sBAAsB;IADlC,UAAU,EAAE;GACA,sBAAsB,CA0BlC;SA1BY,sBAAsB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { Context } from "@tsed/platform-params";
|
|
3
3
|
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
4
4
|
import { Stripe } from "stripe";
|
|
5
|
-
import "../services/StripeFactory";
|
|
5
|
+
import "../services/StripeFactory.js";
|
|
6
6
|
export interface WebhookEventOptions {
|
|
7
7
|
secret: string;
|
|
8
8
|
tolerance: number;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/stripe",
|
|
3
3
|
"description": "Stripe package for Ts.ED framework",
|
|
4
|
-
"type": "
|
|
5
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "8.0.0-alpha.6",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Stripe",
|
|
8
8
|
"Ts.ED",
|
|
@@ -13,14 +13,13 @@
|
|
|
13
13
|
"koa"
|
|
14
14
|
],
|
|
15
15
|
"source": "./src/index.ts",
|
|
16
|
-
"main": "./lib/
|
|
16
|
+
"main": "./lib/esm/index.js",
|
|
17
17
|
"module": "./lib/esm/index.js",
|
|
18
18
|
"typings": "./lib/types/index.d.ts",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./lib/types/index.d.ts",
|
|
22
22
|
"import": "./lib/esm/index.js",
|
|
23
|
-
"require": "./lib/cjs/index.js",
|
|
24
23
|
"default": "./lib/cjs/index.js"
|
|
25
24
|
}
|
|
26
25
|
},
|
|
@@ -35,24 +34,24 @@
|
|
|
35
34
|
"tslib": "2.6.1"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@tsed/barrels": "8.0.0-alpha.
|
|
39
|
-
"@tsed/core": "8.0.0-alpha.
|
|
40
|
-
"@tsed/di": "8.0.0-alpha.
|
|
41
|
-
"@tsed/exceptions": "8.0.0-alpha.
|
|
42
|
-
"@tsed/platform-middlewares": "8.0.0-alpha.
|
|
43
|
-
"@tsed/platform-params": "8.0.0-alpha.
|
|
44
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
45
|
-
"@tsed/typescript": "8.0.0-alpha.
|
|
37
|
+
"@tsed/barrels": "8.0.0-alpha.6",
|
|
38
|
+
"@tsed/core": "8.0.0-alpha.6",
|
|
39
|
+
"@tsed/di": "8.0.0-alpha.6",
|
|
40
|
+
"@tsed/exceptions": "8.0.0-alpha.6",
|
|
41
|
+
"@tsed/platform-middlewares": "8.0.0-alpha.6",
|
|
42
|
+
"@tsed/platform-params": "8.0.0-alpha.6",
|
|
43
|
+
"@tsed/schema": "8.0.0-alpha.6",
|
|
44
|
+
"@tsed/typescript": "8.0.0-alpha.6",
|
|
46
45
|
"eslint": "^8.57.0",
|
|
47
46
|
"stripe": "^8.129.0",
|
|
48
47
|
"typescript": "4.9.5",
|
|
49
48
|
"vitest": "2.0.4"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"@tsed/exceptions": "8.0.0-alpha.
|
|
53
|
-
"@tsed/platform-middlewares": "8.0.0-alpha.
|
|
54
|
-
"@tsed/platform-params": "8.0.0-alpha.
|
|
55
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
51
|
+
"@tsed/exceptions": "8.0.0-alpha.6",
|
|
52
|
+
"@tsed/platform-middlewares": "8.0.0-alpha.6",
|
|
53
|
+
"@tsed/platform-params": "8.0.0-alpha.6",
|
|
54
|
+
"@tsed/schema": "8.0.0-alpha.6",
|
|
56
55
|
"@types/body-parser": "^1.19.0",
|
|
57
56
|
"body-parser": "^1.19.0",
|
|
58
57
|
"stripe": "^9.16.0"
|
package/.nycrc
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": [
|
|
3
|
-
"src/**/*.ts"
|
|
4
|
-
],
|
|
5
|
-
"exclude": [
|
|
6
|
-
"**/*.d.ts",
|
|
7
|
-
"node_modules",
|
|
8
|
-
"**/interfaces/**",
|
|
9
|
-
"**/index.ts"
|
|
10
|
-
],
|
|
11
|
-
"extension": [
|
|
12
|
-
".ts"
|
|
13
|
-
],
|
|
14
|
-
"require": [],
|
|
15
|
-
"reporter": [
|
|
16
|
-
"text-summary",
|
|
17
|
-
"html",
|
|
18
|
-
"lcov",
|
|
19
|
-
"json"
|
|
20
|
-
],
|
|
21
|
-
"check-coverage": true,
|
|
22
|
-
"statements": 99,
|
|
23
|
-
"branches": 75,
|
|
24
|
-
"functions": 93.33,
|
|
25
|
-
"lines": 98.96
|
|
26
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STRIPE_WEBHOOK_SIGNATURE = exports.STRIPE_WEBHOOK_EVENT = void 0;
|
|
4
|
-
exports.STRIPE_WEBHOOK_EVENT = "strip_webhook_event";
|
|
5
|
-
exports.STRIPE_WEBHOOK_SIGNATURE = "strip_webhook_signature";
|
|
6
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,qBAAqB,CAAC;AAC7C,QAAA,wBAAwB,GAAG,yBAAyB,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebhookEvent = void 0;
|
|
4
|
-
const platform_middlewares_1 = require("@tsed/platform-middlewares");
|
|
5
|
-
const platform_params_1 = require("@tsed/platform-params");
|
|
6
|
-
const core_1 = require("@tsed/core");
|
|
7
|
-
const schema_1 = require("@tsed/schema");
|
|
8
|
-
const constants_js_1 = require("../constants/constants.js");
|
|
9
|
-
const WebhookEventMiddleware_js_1 = require("../middlewares/WebhookEventMiddleware.js");
|
|
10
|
-
/**
|
|
11
|
-
* Get the stripe webhook event.
|
|
12
|
-
*
|
|
13
|
-
* @decorator
|
|
14
|
-
* @operation
|
|
15
|
-
* @input
|
|
16
|
-
*/
|
|
17
|
-
function WebhookEvent(options) {
|
|
18
|
-
return (0, core_1.useDecorators)((0, core_1.useMethodDecorators)((0, schema_1.In)("body").Type(Object).Required().Description("The raw webhook payload"), (0, schema_1.In)("header").Name("stripe-signature").Type(String).Required().Description("The stripe webhook signature"), (0, core_1.StoreSet)(WebhookEventMiddleware_js_1.WebhookEventMiddleware, options), (0, platform_middlewares_1.UseBefore)(WebhookEventMiddleware_js_1.WebhookEventMiddleware)), (0, platform_params_1.Context)(constants_js_1.STRIPE_WEBHOOK_EVENT));
|
|
19
|
-
}
|
|
20
|
-
exports.WebhookEvent = WebhookEvent;
|
|
21
|
-
//# sourceMappingURL=webhookEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webhookEvent.js","sourceRoot":"","sources":["../../../src/decorators/webhookEvent.ts"],"names":[],"mappings":";;;AAAA,qEAAqD;AACrD,2DAA8C;AAC9C,qCAAwE;AACxE,yCAAgC;AAChC,4DAA+D;AAC/D,wFAAqG;AAErG;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,OAAsC;IACjE,OAAO,IAAA,oBAAa,EAClB,IAAA,0BAAmB,EACjB,IAAA,WAAE,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,yBAAyB,CAAC,EACzE,IAAA,WAAE,EAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,8BAA8B,CAAC,EACzG,IAAA,eAAQ,EAAC,kDAAsB,EAAE,OAAO,CAAC,EACzC,IAAA,gCAAS,EAAC,kDAAsB,CAAC,CAClC,EACD,IAAA,yBAAO,EAAC,mCAAoB,CAAC,CAC9B,CAAC;AACJ,CAAC;AAVD,oCAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StripeSettings.js","sourceRoot":"","sources":["../../../src/domain/StripeSettings.ts"],"names":[],"mappings":""}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* @file Automatically generated by @tsed/barrels.
|
|
6
|
-
*/
|
|
7
|
-
tslib_1.__exportStar(require("./constants/constants.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./decorators/webhookEvent.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./domain/StripeSettings.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./middlewares/WebhookEventMiddleware.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./services/StripeFactory.js"), exports);
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAyC;AACzC,uEAA6C;AAC7C,qEAA2C;AAC3C,kFAAwD;AACxD,sEAA4C"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var WebhookEventMiddleware_1;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.WebhookEventMiddleware = void 0;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const platform_params_1 = require("@tsed/platform-params");
|
|
7
|
-
const platform_middlewares_1 = require("@tsed/platform-middlewares");
|
|
8
|
-
const di_1 = require("@tsed/di");
|
|
9
|
-
const exceptions_1 = require("@tsed/exceptions");
|
|
10
|
-
const stripe_1 = require("stripe");
|
|
11
|
-
const constants_js_1 = require("../constants/constants.js");
|
|
12
|
-
require("../services/StripeFactory");
|
|
13
|
-
let WebhookEventMiddleware = WebhookEventMiddleware_1 = class WebhookEventMiddleware {
|
|
14
|
-
use(signature, body, ctx) {
|
|
15
|
-
const { secret, tolerance } = {
|
|
16
|
-
...this.webhooks,
|
|
17
|
-
...ctx.endpoint.store.get(WebhookEventMiddleware_1)
|
|
18
|
-
};
|
|
19
|
-
if (!secret) {
|
|
20
|
-
throw new exceptions_1.InternalServerError("Missing Stripe webhooks secret key. You can get this in your dashboard. See: https://dashboard.stripe.com/webhooks.");
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
ctx.set(constants_js_1.STRIPE_WEBHOOK_SIGNATURE, signature);
|
|
24
|
-
ctx.set(constants_js_1.STRIPE_WEBHOOK_EVENT, this.stripe.webhooks.constructEvent(body, signature, secret, tolerance));
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
throw new exceptions_1.BadRequest(`Stripe webhook error: ${err.message}`, err);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
tslib_1.__decorate([
|
|
32
|
-
(0, di_1.Inject)(),
|
|
33
|
-
tslib_1.__metadata("design:type", stripe_1.Stripe)
|
|
34
|
-
], WebhookEventMiddleware.prototype, "stripe", void 0);
|
|
35
|
-
tslib_1.__decorate([
|
|
36
|
-
(0, di_1.Constant)("stripe.webhooks"),
|
|
37
|
-
tslib_1.__metadata("design:type", Object)
|
|
38
|
-
], WebhookEventMiddleware.prototype, "webhooks", void 0);
|
|
39
|
-
tslib_1.__decorate([
|
|
40
|
-
tslib_1.__param(0, (0, platform_params_1.HeaderParams)("stripe-signature")),
|
|
41
|
-
tslib_1.__param(1, (0, platform_params_1.RawBodyParams)()),
|
|
42
|
-
tslib_1.__param(2, (0, platform_params_1.Context)()),
|
|
43
|
-
tslib_1.__metadata("design:type", Function),
|
|
44
|
-
tslib_1.__metadata("design:paramtypes", [String, Buffer, Object]),
|
|
45
|
-
tslib_1.__metadata("design:returntype", Object)
|
|
46
|
-
], WebhookEventMiddleware.prototype, "use", null);
|
|
47
|
-
WebhookEventMiddleware = WebhookEventMiddleware_1 = tslib_1.__decorate([
|
|
48
|
-
(0, platform_middlewares_1.Middleware)()
|
|
49
|
-
], WebhookEventMiddleware);
|
|
50
|
-
exports.WebhookEventMiddleware = WebhookEventMiddleware;
|
|
51
|
-
//# sourceMappingURL=WebhookEventMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebhookEventMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/WebhookEventMiddleware.ts"],"names":[],"mappings":";;;;;AAAA,2DAA2E;AAC3E,qEAAyE;AACzE,iCAA0C;AAC1C,iDAAiE;AACjE,mCAA8B;AAC9B,4DAAyF;AACzF,qCAAmC;AAQ5B,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAOjC,GAAG,CAAmC,SAAiB,EAAmB,IAAY,EAAa,GAAY;QAC7G,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,GAAwB;YAC/C,GAAG,IAAI,CAAC,QAAQ;YAChB,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAsB,CAAC;SAClD,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,gCAAmB,CAC3B,qHAAqH,CACtH,CAAC;SACH;QAED,IAAI;YACF,GAAG,CAAC,GAAG,CAAC,uCAAwB,EAAE,SAAS,CAAC,CAAC;YAC7C,GAAG,CAAC,GAAG,CAAC,mCAAoB,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;SACxG;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,uBAAU,CAAC,yBAAyB,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;SACnE;IACH,CAAC;CACF,CAAA;AAzBC;IAAC,IAAA,WAAM,GAAE;sCACS,eAAM;sDAAC;AAEzB;IAAC,IAAA,aAAQ,EAAC,iBAAiB,CAAC;;wDACY;AAExC;IAAK,mBAAA,IAAA,8BAAY,EAAC,kBAAkB,CAAC,CAAA;IAAqB,mBAAA,IAAA,+BAAa,GAAE,CAAA;IAAgB,mBAAA,IAAA,yBAAO,GAAE,CAAA;;qDAAlB,MAAM;;iDAkBrF;AAzBU,sBAAsB;IADlC,IAAA,iCAAU,GAAE;GACA,sBAAsB,CA0BlC;AA1BY,wDAAsB"}
|
package/lib/cjs/package.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StripeFactory = void 0;
|
|
4
|
-
const di_1 = require("@tsed/di");
|
|
5
|
-
const stripe_1 = require("stripe");
|
|
6
|
-
exports.StripeFactory = stripe_1.Stripe;
|
|
7
|
-
(0, di_1.registerProvider)({
|
|
8
|
-
provide: stripe_1.Stripe,
|
|
9
|
-
deps: [di_1.Configuration],
|
|
10
|
-
useFactory(settings) {
|
|
11
|
-
const { apiKey, webhooks, ...options } = settings.get("stripe", {});
|
|
12
|
-
settings.set("rawBody", true);
|
|
13
|
-
if (apiKey) {
|
|
14
|
-
return new stripe_1.Stripe(apiKey, {
|
|
15
|
-
...options,
|
|
16
|
-
typescript: true
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=StripeFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StripeFactory.js","sourceRoot":"","sources":["../../../src/services/StripeFactory.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AACzD,mCAA8B;AAGjB,QAAA,aAAa,GAAG,eAAM,CAAC;AAEpC,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,eAAM;IACf,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,UAAU,CAAC,QAAuB;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAC,GAAG,QAAQ,CAAC,GAAG,CAAiB,QAAQ,EAAE,EAAS,CAAC,CAAC;QAEzF,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAE9B,IAAI,MAAM,EAAE;YACV,OAAO,IAAI,eAAM,CAAC,MAAM,EAAE;gBACxB,GAAG,OAAO;gBACV,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
package/lib/esm/package.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Stripe } from "stripe";
|
|
2
|
-
export interface StripeSettings extends Stripe.StripeConfig {
|
|
3
|
-
/**
|
|
4
|
-
* Stripe ApiKey
|
|
5
|
-
*/
|
|
6
|
-
apiKey: string;
|
|
7
|
-
/**
|
|
8
|
-
* Webhooks settings
|
|
9
|
-
*/
|
|
10
|
-
webhooks?: {
|
|
11
|
-
/**
|
|
12
|
-
* Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...').
|
|
13
|
-
* You can get this [in your dashboard](https://dashboard.stripe.com/webhooks).
|
|
14
|
-
*/
|
|
15
|
-
secret: string;
|
|
16
|
-
/**
|
|
17
|
-
* Seconds of tolerance on timestamps.
|
|
18
|
-
*/
|
|
19
|
-
tolerance?: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
declare global {
|
|
23
|
-
namespace TsED {
|
|
24
|
-
interface Configuration {
|
|
25
|
-
stripe: StripeSettings;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
package/lib/types-esm/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Automatically generated by @tsed/barrels.
|
|
3
|
-
*/
|
|
4
|
-
export * from "./constants/constants.js";
|
|
5
|
-
export * from "./decorators/webhookEvent.js";
|
|
6
|
-
export * from "./domain/StripeSettings.js";
|
|
7
|
-
export * from "./middlewares/WebhookEventMiddleware.js";
|
|
8
|
-
export * from "./services/StripeFactory.js";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Context } from "@tsed/platform-params";
|
|
3
|
-
import { MiddlewareMethods } from "@tsed/platform-middlewares";
|
|
4
|
-
import { Stripe } from "stripe";
|
|
5
|
-
import "../services/StripeFactory";
|
|
6
|
-
export interface WebhookEventOptions {
|
|
7
|
-
secret: string;
|
|
8
|
-
tolerance: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class WebhookEventMiddleware implements MiddlewareMethods {
|
|
11
|
-
protected stripe: Stripe;
|
|
12
|
-
protected webhooks: WebhookEventOptions;
|
|
13
|
-
use(signature: string, body: Buffer, ctx: Context): any;
|
|
14
|
-
}
|