@henrylabs-interview/payment-processor 0.1.5 → 0.1.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/dist/index.d.ts +2 -1
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Checkout } from './resources/checkout';
|
|
2
2
|
import { Webhooks } from './resources/webhooks';
|
|
3
|
-
export
|
|
3
|
+
export default class HenryPaymentProcessorSDK {
|
|
4
4
|
checkout: Checkout;
|
|
5
5
|
webhooks: Webhooks;
|
|
6
|
+
private VALID_API_KEYS;
|
|
6
7
|
constructor(config: {
|
|
7
8
|
apiKey: string;
|
|
8
9
|
});
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var __export = (target, all) => {
|
|
|
42
42
|
// src/index.ts
|
|
43
43
|
var exports_src = {};
|
|
44
44
|
__export(exports_src, {
|
|
45
|
-
|
|
45
|
+
default: () => HenryPaymentProcessorSDK
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(exports_src);
|
|
48
48
|
|
|
@@ -470,13 +470,17 @@ class Checkout {
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
// src/index.ts
|
|
473
|
-
class
|
|
473
|
+
class HenryPaymentProcessorSDK {
|
|
474
474
|
checkout;
|
|
475
475
|
webhooks;
|
|
476
|
+
VALID_API_KEYS = ["824c951e-dfac-4342-8e03", "3f67e17a-880a-463b-a667", "78254d40-623a-48c5-b83f"];
|
|
476
477
|
constructor(config) {
|
|
477
478
|
if (!config.apiKey) {
|
|
478
479
|
throw new Error("Henry: apiKey is required");
|
|
479
480
|
}
|
|
481
|
+
if (!this.VALID_API_KEYS.includes(config.apiKey)) {
|
|
482
|
+
throw new Error("Henry: Invalid apiKey provided");
|
|
483
|
+
}
|
|
480
484
|
this.checkout = new Checkout;
|
|
481
485
|
this.webhooks = new Webhooks;
|
|
482
486
|
}
|