@misterhomer1992/miit-bot-payment 1.1.6 → 2.0.4
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/config/ConfigurationManager.d.ts +64 -0
- package/dist/config/ConfigurationManager.d.ts.map +1 -0
- package/dist/config/ConfigurationManager.js +144 -0
- package/dist/config/ConfigurationManager.js.map +1 -0
- package/dist/config/defaults.d.ts +18 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +26 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/environment.d.ts +38 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +91 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +53 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/cache/InMemoryCache.d.ts +17 -0
- package/dist/modules/cache/InMemoryCache.d.ts.map +1 -0
- package/dist/modules/cache/InMemoryCache.js +77 -0
- package/dist/modules/cache/InMemoryCache.js.map +1 -0
- package/dist/modules/cache/index.d.ts +3 -0
- package/dist/modules/cache/index.d.ts.map +1 -0
- package/dist/modules/cache/index.js +19 -0
- package/dist/modules/cache/index.js.map +1 -0
- package/dist/modules/cache/types.d.ts +52 -0
- package/dist/modules/cache/types.d.ts.map +1 -0
- package/dist/modules/cache/types.js +3 -0
- package/dist/modules/cache/types.js.map +1 -0
- package/dist/modules/errors/index.d.ts +2 -0
- package/dist/modules/errors/index.d.ts.map +1 -0
- package/dist/modules/errors/index.js +19 -0
- package/dist/modules/errors/index.js.map +1 -0
- package/dist/modules/errors/types.d.ts +112 -0
- package/dist/modules/errors/types.d.ts.map +1 -0
- package/dist/modules/errors/types.js +174 -0
- package/dist/modules/errors/types.js.map +1 -0
- package/dist/modules/payments/api.d.ts +63 -1
- package/dist/modules/payments/api.d.ts.map +1 -1
- package/dist/modules/payments/api.js +103 -1
- package/dist/modules/payments/api.js.map +1 -1
- package/dist/modules/payments/const.d.ts.map +1 -1
- package/dist/modules/payments/const.js +1 -0
- package/dist/modules/payments/const.js.map +1 -1
- package/dist/modules/payments/index.d.ts +8 -0
- package/dist/modules/payments/index.d.ts.map +1 -1
- package/dist/modules/payments/index.js +8 -0
- package/dist/modules/payments/index.js.map +1 -1
- package/dist/modules/payments/service.d.ts +42 -2
- package/dist/modules/payments/service.d.ts.map +1 -1
- package/dist/modules/payments/service.js +132 -3
- package/dist/modules/payments/service.js.map +1 -1
- package/dist/modules/payments/subscription-check-webhook.handler.d.ts +85 -0
- package/dist/modules/payments/subscription-check-webhook.handler.d.ts.map +1 -0
- package/dist/modules/payments/subscription-check-webhook.handler.js +155 -0
- package/dist/modules/payments/subscription-check-webhook.handler.js.map +1 -0
- package/dist/modules/payments/subscription-check-webhook.service.d.ts +59 -0
- package/dist/modules/payments/subscription-check-webhook.service.d.ts.map +1 -0
- package/dist/modules/payments/subscription-check-webhook.service.js +330 -0
- package/dist/modules/payments/subscription-check-webhook.service.js.map +1 -0
- package/dist/modules/payments/subscription-check-webhook.types.d.ts +25 -0
- package/dist/modules/payments/subscription-check-webhook.types.d.ts.map +1 -0
- package/dist/modules/payments/subscription-check-webhook.types.js +3 -0
- package/dist/modules/payments/subscription-check-webhook.types.js.map +1 -0
- package/dist/modules/payments/types.d.ts +69 -2
- package/dist/modules/payments/types.d.ts.map +1 -1
- package/dist/modules/payments/utils.d.ts +151 -5
- package/dist/modules/payments/utils.d.ts.map +1 -1
- package/dist/modules/payments/utils.js +253 -9
- package/dist/modules/payments/utils.js.map +1 -1
- package/dist/modules/payments/wayforpay.service.d.ts +39 -0
- package/dist/modules/payments/wayforpay.service.d.ts.map +1 -0
- package/dist/modules/payments/wayforpay.service.js +217 -0
- package/dist/modules/payments/wayforpay.service.js.map +1 -0
- package/dist/modules/payments/wayforpay.types.d.ts +115 -0
- package/dist/modules/payments/wayforpay.types.d.ts.map +1 -0
- package/dist/modules/payments/wayforpay.types.js +3 -0
- package/dist/modules/payments/wayforpay.types.js.map +1 -0
- package/dist/modules/payments/webhook.handler.d.ts +98 -0
- package/dist/modules/payments/webhook.handler.d.ts.map +1 -0
- package/dist/modules/payments/webhook.handler.js +153 -0
- package/dist/modules/payments/webhook.handler.js.map +1 -0
- package/dist/modules/payments/webhook.service.d.ts +99 -0
- package/dist/modules/payments/webhook.service.d.ts.map +1 -0
- package/dist/modules/payments/webhook.service.js +672 -0
- package/dist/modules/payments/webhook.service.js.map +1 -0
- package/dist/modules/payments/webhook.types.d.ts +35 -0
- package/dist/modules/payments/webhook.types.d.ts.map +1 -0
- package/dist/modules/payments/webhook.types.js +3 -0
- package/dist/modules/payments/webhook.types.js.map +1 -0
- package/dist/modules/subscription/change.service.d.ts +80 -0
- package/dist/modules/subscription/change.service.d.ts.map +1 -0
- package/dist/modules/subscription/change.service.js +226 -0
- package/dist/modules/subscription/change.service.js.map +1 -0
- package/dist/modules/subscription/index.d.ts +2 -0
- package/dist/modules/subscription/index.d.ts.map +1 -1
- package/dist/modules/subscription/index.js +2 -0
- package/dist/modules/subscription/index.js.map +1 -1
- package/dist/modules/subscription/service.d.ts +8 -1
- package/dist/modules/subscription/service.d.ts.map +1 -1
- package/dist/modules/subscription/service.js +59 -2
- package/dist/modules/subscription/service.js.map +1 -1
- package/dist/modules/subscription/status-check.handler.d.ts +117 -0
- package/dist/modules/subscription/status-check.handler.d.ts.map +1 -0
- package/dist/modules/subscription/status-check.handler.js +164 -0
- package/dist/modules/subscription/status-check.handler.js.map +1 -0
- package/dist/modules/subscription/types.d.ts +37 -1
- package/dist/modules/subscription/types.d.ts.map +1 -1
- package/dist/modules/subscriptionPlan/const.d.ts +5 -0
- package/dist/modules/subscriptionPlan/const.d.ts.map +1 -0
- package/dist/modules/subscriptionPlan/const.js +106 -0
- package/dist/modules/subscriptionPlan/const.js.map +1 -0
- package/dist/modules/subscriptionPlan/index.d.ts +5 -0
- package/dist/modules/subscriptionPlan/index.d.ts.map +1 -0
- package/dist/modules/subscriptionPlan/index.js +21 -0
- package/dist/modules/subscriptionPlan/index.js.map +1 -0
- package/dist/modules/subscriptionPlan/repository.d.ts +22 -0
- package/dist/modules/subscriptionPlan/repository.d.ts.map +1 -0
- package/dist/modules/subscriptionPlan/repository.js +95 -0
- package/dist/modules/subscriptionPlan/repository.js.map +1 -0
- package/dist/modules/subscriptionPlan/service.d.ts +21 -0
- package/dist/modules/subscriptionPlan/service.d.ts.map +1 -0
- package/dist/modules/subscriptionPlan/service.js +128 -0
- package/dist/modules/subscriptionPlan/service.js.map +1 -0
- package/dist/modules/subscriptionPlan/types.d.ts +40 -0
- package/dist/modules/subscriptionPlan/types.d.ts.map +1 -0
- package/dist/modules/subscriptionPlan/types.js +3 -0
- package/dist/modules/subscriptionPlan/types.js.map +1 -0
- package/dist/modules/token/const.d.ts +7 -0
- package/dist/modules/token/const.d.ts.map +1 -0
- package/dist/modules/token/const.js +66 -0
- package/dist/modules/token/const.js.map +1 -0
- package/dist/modules/token/index.d.ts +4 -0
- package/dist/modules/token/index.d.ts.map +1 -0
- package/dist/modules/token/index.js +20 -0
- package/dist/modules/token/index.js.map +1 -0
- package/dist/modules/token/service.d.ts +46 -0
- package/dist/modules/token/service.d.ts.map +1 -0
- package/dist/modules/token/service.js +249 -0
- package/dist/modules/token/service.js.map +1 -0
- package/dist/modules/token/types.d.ts +109 -0
- package/dist/modules/token/types.d.ts.map +1 -0
- package/dist/modules/token/types.js +3 -0
- package/dist/modules/token/types.js.map +1 -0
- package/dist/modules/tokenPack/const.d.ts +4 -0
- package/dist/modules/tokenPack/const.d.ts.map +1 -0
- package/dist/modules/tokenPack/const.js +10 -0
- package/dist/modules/tokenPack/const.js.map +1 -0
- package/dist/modules/tokenPack/index.d.ts +5 -0
- package/dist/modules/tokenPack/index.d.ts.map +1 -0
- package/dist/modules/tokenPack/index.js +21 -0
- package/dist/modules/tokenPack/index.js.map +1 -0
- package/dist/modules/tokenPack/repository.d.ts +32 -0
- package/dist/modules/tokenPack/repository.d.ts.map +1 -0
- package/dist/modules/tokenPack/repository.js +103 -0
- package/dist/modules/tokenPack/repository.js.map +1 -0
- package/dist/modules/tokenPack/service.d.ts +28 -0
- package/dist/modules/tokenPack/service.d.ts.map +1 -0
- package/dist/modules/tokenPack/service.js +106 -0
- package/dist/modules/tokenPack/service.js.map +1 -0
- package/dist/modules/tokenPack/types.d.ts +124 -0
- package/dist/modules/tokenPack/types.d.ts.map +1 -0
- package/dist/modules/tokenPack/types.js +3 -0
- package/dist/modules/tokenPack/types.js.map +1 -0
- package/package.json +9 -5
- package/src/config/ConfigurationManager.ts +159 -0
- package/src/config/defaults.ts +27 -0
- package/src/config/environment.ts +94 -0
- package/src/config/index.ts +22 -0
- package/src/config/types.ts +56 -0
- package/src/index.ts +29 -0
- package/src/modules/cache/InMemoryCache.ts +98 -0
- package/src/modules/cache/index.ts +2 -0
- package/src/modules/cache/types.ts +60 -0
- package/src/modules/cancellableAPI/utils.ts +60 -0
- package/src/modules/errors/index.ts +16 -0
- package/src/modules/errors/types.ts +201 -0
- package/src/modules/invoice/const.ts +7 -0
- package/src/modules/invoice/index.ts +4 -0
- package/src/modules/invoice/repository.ts +52 -0
- package/src/modules/invoice/service.ts +44 -0
- package/src/modules/invoice/types.ts +47 -0
- package/src/modules/logger/types.ts +8 -0
- package/src/modules/network/utils.ts +24 -0
- package/src/modules/payments/api.ts +289 -0
- package/src/modules/payments/const.ts +11 -0
- package/src/modules/payments/index.ts +14 -0
- package/src/modules/payments/repository.ts +125 -0
- package/src/modules/payments/service.test.ts +400 -0
- package/src/modules/payments/service.ts +365 -0
- package/src/modules/payments/subscription-check-webhook.handler.integration.test.ts +935 -0
- package/src/modules/payments/subscription-check-webhook.handler.ts +211 -0
- package/src/modules/payments/subscription-check-webhook.service.ts +398 -0
- package/src/modules/payments/subscription-check-webhook.types.ts +29 -0
- package/src/modules/payments/types.ts +193 -0
- package/src/modules/payments/utils.ts +428 -0
- package/src/modules/payments/wayforpay.service.test.ts +375 -0
- package/src/modules/payments/wayforpay.service.ts +284 -0
- package/src/modules/payments/wayforpay.types.ts +138 -0
- package/src/modules/payments/webhook.handler.integration.test.ts +975 -0
- package/src/modules/payments/webhook.handler.ts +219 -0
- package/src/modules/payments/webhook.service.ts +812 -0
- package/src/modules/payments/webhook.types.ts +38 -0
- package/src/modules/subscription/change.service.ts +317 -0
- package/src/modules/subscription/const.ts +9 -0
- package/src/modules/subscription/index.ts +5 -0
- package/src/modules/subscription/repository.ts +277 -0
- package/src/modules/subscription/service.test.ts +665 -0
- package/src/modules/subscription/service.ts +328 -0
- package/src/modules/subscription/status-check.handler.ts +254 -0
- package/src/modules/subscription/types.ts +267 -0
- package/src/modules/subscription/utils.ts +5 -0
- package/src/modules/subscriptionPlan/const.ts +106 -0
- package/src/modules/subscriptionPlan/index.ts +4 -0
- package/src/modules/subscriptionPlan/repository.ts +129 -0
- package/src/modules/subscriptionPlan/service.test.ts +401 -0
- package/src/modules/subscriptionPlan/service.ts +148 -0
- package/src/modules/subscriptionPlan/types.ts +67 -0
- package/src/modules/token/const.ts +64 -0
- package/src/modules/token/index.ts +3 -0
- package/src/modules/token/service.test.ts +499 -0
- package/src/modules/token/service.ts +297 -0
- package/src/modules/token/types.ts +124 -0
- package/src/modules/tokenPack/const.ts +9 -0
- package/src/modules/tokenPack/index.ts +4 -0
- package/src/modules/tokenPack/repository.ts +144 -0
- package/src/modules/tokenPack/service.ts +119 -0
- package/src/modules/tokenPack/types.ts +131 -0
- package/src/modules/user/index.ts +3 -0
- package/src/modules/user/types.ts +143 -0
- package/src/modules/user/userRepository.ts +64 -0
- package/src/modules/user/userService.ts +68 -0
- package/src/types/extend-express.d.ts +16 -0
- package/src/types/function.ts +5 -0
- package/src/types/utilities.ts +22 -0
- package/src/utils.ts +53 -0
- package/tsconfig.json +29 -0
- package/dist/modules/subscription/subscriptionPlan.d.ts +0 -4
- package/dist/modules/subscription/subscriptionPlan.d.ts.map +0 -1
- package/dist/modules/subscription/subscriptionPlan.js +0 -67
- package/dist/modules/subscription/subscriptionPlan.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misterhomer1992/miit-bot-payment",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "A TypeScript utility library for payment validation and formatting",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
+
"build:test": "tsc --project tsconfig.test.json",
|
|
10
|
+
"prepare": "npm run build",
|
|
9
11
|
"prepublishOnly": "npm run build",
|
|
10
|
-
"test": "node --test dist/**/*.test.js",
|
|
12
|
+
"test": "npm run build:test && node --test dist/**/*.test.js",
|
|
11
13
|
"lint": "eslint src --ext .ts",
|
|
12
14
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
13
15
|
"watch": "tsc --watch",
|
|
@@ -29,14 +31,14 @@
|
|
|
29
31
|
"dotenv": "17.2.2",
|
|
30
32
|
"axios": "1.12.2",
|
|
31
33
|
"firebase-admin": "12.1.0",
|
|
32
|
-
"@misterhomer1992/wayforpay-api": "3.0.1"
|
|
34
|
+
"@misterhomer1992/wayforpay-api": "3.0.1",
|
|
35
|
+
"typescript": "^5.3.2"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
38
|
"@types/node": "^20.10.0",
|
|
36
39
|
"@typescript-eslint/eslint-plugin": "^6.13.0",
|
|
37
40
|
"@typescript-eslint/parser": "^6.13.0",
|
|
38
41
|
"ts-node": "^10.9.2",
|
|
39
|
-
"typescript": "^5.3.2",
|
|
40
42
|
"eslint": "^8.48.0",
|
|
41
43
|
"eslint-config-airbnb": "^19.0.4",
|
|
42
44
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -44,8 +46,10 @@
|
|
|
44
46
|
},
|
|
45
47
|
"files": [
|
|
46
48
|
"dist",
|
|
49
|
+
"src",
|
|
47
50
|
"README.md",
|
|
48
|
-
"LICENSE"
|
|
51
|
+
"LICENSE",
|
|
52
|
+
"tsconfig.json"
|
|
49
53
|
],
|
|
50
54
|
"repository": {
|
|
51
55
|
"type": "git",
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { PackageConfig, PartialPackageConfig, WayForPayConfig, CacheConfig, GracePeriodConfig } from './types';
|
|
2
|
+
import { DEFAULT_CACHE_CONFIG, DEFAULT_GRACE_PERIOD_CONFIG } from './defaults';
|
|
3
|
+
import { loadWayForPayConfigFromEnv, loadCacheConfigFromEnv, loadGracePeriodConfigFromEnv } from './environment';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ConfigurationManager provides centralized configuration management for the package.
|
|
7
|
+
* Supports environment-based configuration with programmatic overrides.
|
|
8
|
+
*/
|
|
9
|
+
export class ConfigurationManager {
|
|
10
|
+
private static instance: ConfigurationManager | null = null;
|
|
11
|
+
private config: PackageConfig;
|
|
12
|
+
private initialized: boolean = false;
|
|
13
|
+
|
|
14
|
+
private constructor() {
|
|
15
|
+
this.config = this.loadDefaultConfig();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Gets the singleton instance of ConfigurationManager.
|
|
20
|
+
*/
|
|
21
|
+
public static getInstance(): ConfigurationManager {
|
|
22
|
+
if (!ConfigurationManager.instance) {
|
|
23
|
+
ConfigurationManager.instance = new ConfigurationManager();
|
|
24
|
+
}
|
|
25
|
+
return ConfigurationManager.instance;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Resets the singleton instance (useful for testing).
|
|
30
|
+
*/
|
|
31
|
+
public static resetInstance(): void {
|
|
32
|
+
ConfigurationManager.instance = null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Initializes the configuration with optional overrides.
|
|
37
|
+
* Should be called once at application startup.
|
|
38
|
+
*/
|
|
39
|
+
public initialize(overrides?: PartialPackageConfig): void {
|
|
40
|
+
this.config = this.mergeConfig(this.loadDefaultConfig(), overrides);
|
|
41
|
+
this.initialized = true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the configuration has been explicitly initialized.
|
|
46
|
+
*/
|
|
47
|
+
public isInitialized(): boolean {
|
|
48
|
+
return this.initialized;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Gets the complete configuration.
|
|
53
|
+
*/
|
|
54
|
+
public getConfig(): PackageConfig {
|
|
55
|
+
return { ...this.config };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets WayForPay configuration.
|
|
60
|
+
*/
|
|
61
|
+
public getWayForPayConfig(): WayForPayConfig {
|
|
62
|
+
return { ...this.config.wayforpay };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Gets cache configuration.
|
|
67
|
+
*/
|
|
68
|
+
public getCacheConfig(): CacheConfig {
|
|
69
|
+
return { ...this.config.cache };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets grace period configuration.
|
|
74
|
+
*/
|
|
75
|
+
public getGracePeriodConfig(): GracePeriodConfig {
|
|
76
|
+
return { ...this.config.gracePeriod };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Updates configuration at runtime.
|
|
81
|
+
*/
|
|
82
|
+
public updateConfig(overrides: PartialPackageConfig): void {
|
|
83
|
+
this.config = this.mergeConfig(this.config, overrides);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Validates that required WayForPay credentials are present.
|
|
88
|
+
*/
|
|
89
|
+
public validateWayForPayConfig(): { valid: boolean; missingFields: string[] } {
|
|
90
|
+
const missingFields: string[] = [];
|
|
91
|
+
const { wayforpay } = this.config;
|
|
92
|
+
|
|
93
|
+
if (!wayforpay.merchantAccount) {
|
|
94
|
+
missingFields.push('merchantAccount');
|
|
95
|
+
}
|
|
96
|
+
if (!wayforpay.merchantSecretKey) {
|
|
97
|
+
missingFields.push('merchantSecretKey');
|
|
98
|
+
}
|
|
99
|
+
if (!wayforpay.merchantDomainName) {
|
|
100
|
+
missingFields.push('merchantDomainName');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
valid: missingFields.length === 0,
|
|
105
|
+
missingFields,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Loads default configuration from environment and defaults.
|
|
111
|
+
*/
|
|
112
|
+
private loadDefaultConfig(): PackageConfig {
|
|
113
|
+
const envWayForPay = loadWayForPayConfigFromEnv();
|
|
114
|
+
const envCache = loadCacheConfigFromEnv();
|
|
115
|
+
const envGracePeriod = loadGracePeriodConfigFromEnv();
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
wayforpay: {
|
|
119
|
+
merchantAccount: envWayForPay.merchantAccount ?? '',
|
|
120
|
+
merchantSecretKey: envWayForPay.merchantSecretKey ?? '',
|
|
121
|
+
merchantDomainName: envWayForPay.merchantDomainName ?? '',
|
|
122
|
+
serviceUrl: envWayForPay.serviceUrl,
|
|
123
|
+
merchantPassword: envWayForPay.merchantPassword,
|
|
124
|
+
},
|
|
125
|
+
cache: {
|
|
126
|
+
ttlMs: envCache.ttlMs ?? DEFAULT_CACHE_CONFIG.ttlMs,
|
|
127
|
+
maxSize: envCache.maxSize ?? DEFAULT_CACHE_CONFIG.maxSize,
|
|
128
|
+
},
|
|
129
|
+
gracePeriod: {
|
|
130
|
+
durationMs: envGracePeriod.durationMs ?? DEFAULT_GRACE_PERIOD_CONFIG.durationMs,
|
|
131
|
+
enabled: envGracePeriod.enabled ?? DEFAULT_GRACE_PERIOD_CONFIG.enabled,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Merges configuration with overrides.
|
|
138
|
+
*/
|
|
139
|
+
private mergeConfig(base: PackageConfig, overrides?: PartialPackageConfig): PackageConfig {
|
|
140
|
+
if (!overrides) {
|
|
141
|
+
return base;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
wayforpay: {
|
|
146
|
+
...base.wayforpay,
|
|
147
|
+
...overrides.wayforpay,
|
|
148
|
+
},
|
|
149
|
+
cache: {
|
|
150
|
+
...base.cache,
|
|
151
|
+
...overrides.cache,
|
|
152
|
+
},
|
|
153
|
+
gracePeriod: {
|
|
154
|
+
...base.gracePeriod,
|
|
155
|
+
...overrides.gracePeriod,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CacheConfig, GracePeriodConfig } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default cache TTL: 20 hours in milliseconds.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_CACHE_TTL_MS = 20 * 60 * 60 * 1000;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Default cache configuration.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_CACHE_CONFIG: CacheConfig = {
|
|
12
|
+
ttlMs: DEFAULT_CACHE_TTL_MS,
|
|
13
|
+
maxSize: undefined,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Default grace period: 3 days in milliseconds.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_GRACE_PERIOD_MS = 3 * 24 * 60 * 60 * 1000;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Default grace period configuration.
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_GRACE_PERIOD_CONFIG: GracePeriodConfig = {
|
|
25
|
+
durationMs: DEFAULT_GRACE_PERIOD_MS,
|
|
26
|
+
enabled: true,
|
|
27
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { WayForPayConfig, CacheConfig, GracePeriodConfig } from './types';
|
|
2
|
+
import { DEFAULT_CACHE_TTL_MS, DEFAULT_GRACE_PERIOD_MS } from './defaults';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Environment variable names for WayForPay configuration.
|
|
6
|
+
*/
|
|
7
|
+
export const WAYFORPAY_ENV_VARS = {
|
|
8
|
+
MERCHANT_ACCOUNT: 'WAYFORPAY_MERCHANT_ACCOUNT',
|
|
9
|
+
MERCHANT_SECRET_KEY: 'WAYFORPAY_MERCHANT_SECRET_KEY',
|
|
10
|
+
MERCHANT_DOMAIN: 'WAYFORPAY_MERCHANT_DOMAIN',
|
|
11
|
+
SERVICE_URL: 'WAYFORPAY_SERVICE_URL',
|
|
12
|
+
MERCHANT_PASSWORD: 'WAYFORPAY_MERCHANT_PASSWORD',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Environment variable names for cache configuration.
|
|
17
|
+
*/
|
|
18
|
+
export const CACHE_ENV_VARS = {
|
|
19
|
+
TTL_MS: 'CACHE_TTL_MS',
|
|
20
|
+
MAX_SIZE: 'CACHE_MAX_SIZE',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Environment variable names for grace period configuration.
|
|
25
|
+
*/
|
|
26
|
+
export const GRACE_PERIOD_ENV_VARS = {
|
|
27
|
+
DURATION_MS: 'GRACE_PERIOD_DURATION_MS',
|
|
28
|
+
ENABLED: 'GRACE_PERIOD_ENABLED',
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Gets a string environment variable value.
|
|
33
|
+
*/
|
|
34
|
+
function getEnvString(name: string): string | undefined {
|
|
35
|
+
return process.env[name];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets a numeric environment variable value.
|
|
40
|
+
*/
|
|
41
|
+
function getEnvNumber(name: string): number | undefined {
|
|
42
|
+
const value = process.env[name];
|
|
43
|
+
if (value === undefined || value === '') {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const parsed = parseInt(value, 10);
|
|
47
|
+
return isNaN(parsed) ? undefined : parsed;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets a boolean environment variable value.
|
|
52
|
+
* Accepts 'true', '1', 'yes' as truthy values.
|
|
53
|
+
*/
|
|
54
|
+
function getEnvBoolean(name: string): boolean | undefined {
|
|
55
|
+
const value = process.env[name];
|
|
56
|
+
if (value === undefined || value === '') {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return ['true', '1', 'yes'].includes(value.toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Loads WayForPay configuration from environment variables.
|
|
64
|
+
*/
|
|
65
|
+
export function loadWayForPayConfigFromEnv(): Partial<WayForPayConfig> {
|
|
66
|
+
return {
|
|
67
|
+
merchantAccount: getEnvString(WAYFORPAY_ENV_VARS.MERCHANT_ACCOUNT),
|
|
68
|
+
merchantSecretKey: getEnvString(WAYFORPAY_ENV_VARS.MERCHANT_SECRET_KEY),
|
|
69
|
+
merchantDomainName: getEnvString(WAYFORPAY_ENV_VARS.MERCHANT_DOMAIN),
|
|
70
|
+
serviceUrl: getEnvString(WAYFORPAY_ENV_VARS.SERVICE_URL),
|
|
71
|
+
merchantPassword: getEnvString(WAYFORPAY_ENV_VARS.MERCHANT_PASSWORD),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Loads cache configuration from environment variables.
|
|
77
|
+
*/
|
|
78
|
+
export function loadCacheConfigFromEnv(): Partial<CacheConfig> {
|
|
79
|
+
return {
|
|
80
|
+
ttlMs: getEnvNumber(CACHE_ENV_VARS.TTL_MS) ?? DEFAULT_CACHE_TTL_MS,
|
|
81
|
+
maxSize: getEnvNumber(CACHE_ENV_VARS.MAX_SIZE),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Loads grace period configuration from environment variables.
|
|
87
|
+
*/
|
|
88
|
+
export function loadGracePeriodConfigFromEnv(): Partial<GracePeriodConfig> {
|
|
89
|
+
const enabled = getEnvBoolean(GRACE_PERIOD_ENV_VARS.ENABLED);
|
|
90
|
+
return {
|
|
91
|
+
durationMs: getEnvNumber(GRACE_PERIOD_ENV_VARS.DURATION_MS) ?? DEFAULT_GRACE_PERIOD_MS,
|
|
92
|
+
enabled: enabled ?? true,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { ConfigurationManager } from './ConfigurationManager';
|
|
2
|
+
export type {
|
|
3
|
+
PackageConfig,
|
|
4
|
+
PartialPackageConfig,
|
|
5
|
+
WayForPayConfig,
|
|
6
|
+
CacheConfig,
|
|
7
|
+
GracePeriodConfig,
|
|
8
|
+
} from './types';
|
|
9
|
+
export {
|
|
10
|
+
DEFAULT_CACHE_TTL_MS,
|
|
11
|
+
DEFAULT_CACHE_CONFIG,
|
|
12
|
+
DEFAULT_GRACE_PERIOD_MS,
|
|
13
|
+
DEFAULT_GRACE_PERIOD_CONFIG,
|
|
14
|
+
} from './defaults';
|
|
15
|
+
export {
|
|
16
|
+
WAYFORPAY_ENV_VARS,
|
|
17
|
+
CACHE_ENV_VARS,
|
|
18
|
+
GRACE_PERIOD_ENV_VARS,
|
|
19
|
+
loadWayForPayConfigFromEnv,
|
|
20
|
+
loadCacheConfigFromEnv,
|
|
21
|
+
loadGracePeriodConfigFromEnv,
|
|
22
|
+
} from './environment';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WayForPay payment provider credentials configuration.
|
|
3
|
+
*/
|
|
4
|
+
export interface WayForPayConfig {
|
|
5
|
+
/** Merchant account identifier from WayForPay dashboard */
|
|
6
|
+
merchantAccount: string;
|
|
7
|
+
/** Secret key for signing requests */
|
|
8
|
+
merchantSecretKey: string;
|
|
9
|
+
/** Merchant domain name registered with WayForPay */
|
|
10
|
+
merchantDomainName: string;
|
|
11
|
+
/** Optional service URL for webhook callbacks */
|
|
12
|
+
serviceUrl?: string;
|
|
13
|
+
/** Optional merchant password for edit operations */
|
|
14
|
+
merchantPassword?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Cache configuration settings.
|
|
19
|
+
*/
|
|
20
|
+
export interface CacheConfig {
|
|
21
|
+
/** Default cache TTL in milliseconds */
|
|
22
|
+
ttlMs: number;
|
|
23
|
+
/** Optional maximum cache size (number of entries) */
|
|
24
|
+
maxSize?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Subscription grace period configuration.
|
|
29
|
+
*/
|
|
30
|
+
export interface GracePeriodConfig {
|
|
31
|
+
/** Grace period duration in milliseconds after subscription expires */
|
|
32
|
+
durationMs: number;
|
|
33
|
+
/** Whether grace period is enabled */
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Complete package configuration.
|
|
39
|
+
*/
|
|
40
|
+
export interface PackageConfig {
|
|
41
|
+
/** WayForPay payment provider configuration */
|
|
42
|
+
wayforpay: WayForPayConfig;
|
|
43
|
+
/** Cache settings */
|
|
44
|
+
cache: CacheConfig;
|
|
45
|
+
/** Grace period settings for subscriptions */
|
|
46
|
+
gracePeriod: GracePeriodConfig;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Partial configuration for overriding defaults.
|
|
51
|
+
*/
|
|
52
|
+
export type PartialPackageConfig = {
|
|
53
|
+
wayforpay?: Partial<WayForPayConfig>;
|
|
54
|
+
cache?: Partial<CacheConfig>;
|
|
55
|
+
gracePeriod?: Partial<GracePeriodConfig>;
|
|
56
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './modules/payments';
|
|
2
|
+
export * from './modules/invoice';
|
|
3
|
+
export * from './modules/subscription';
|
|
4
|
+
export * from './modules/subscriptionPlan';
|
|
5
|
+
export * from './modules/user';
|
|
6
|
+
export * from './modules/tokenPack';
|
|
7
|
+
export * from './modules/token';
|
|
8
|
+
export * from './modules/cache';
|
|
9
|
+
export * from './modules/errors';
|
|
10
|
+
export * from './config';
|
|
11
|
+
|
|
12
|
+
// Status constants for common use cases
|
|
13
|
+
export const SUBSCRIPTION_STATUS = {
|
|
14
|
+
ACTIVE: 'active',
|
|
15
|
+
EXPIRED: 'expired',
|
|
16
|
+
CANCELLED: 'cancelled',
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export const PAYMENT_STATUS = {
|
|
20
|
+
PENDING: 'pending',
|
|
21
|
+
COMPLETED: 'completed',
|
|
22
|
+
FAILED: 'failed',
|
|
23
|
+
EXPIRED: 'expired',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export const PAYMENT_TYPE = {
|
|
27
|
+
SUBSCRIPTION: 'subscription',
|
|
28
|
+
TOKEN_PACK: 'token_pack',
|
|
29
|
+
} as const;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { CacheEntry, ICacheOptions, ICache } from './types';
|
|
2
|
+
|
|
3
|
+
export class InMemoryCache<T> implements ICache<T> {
|
|
4
|
+
private readonly cache: Map<string, CacheEntry<T>>;
|
|
5
|
+
private readonly defaultTtl: number;
|
|
6
|
+
private readonly maxSize: number;
|
|
7
|
+
|
|
8
|
+
constructor(options: ICacheOptions) {
|
|
9
|
+
this.cache = new Map();
|
|
10
|
+
this.defaultTtl = options.ttl;
|
|
11
|
+
this.maxSize = options.maxSize || Infinity;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
public get(key: string): T | undefined {
|
|
15
|
+
const entry = this.cache.get(key);
|
|
16
|
+
|
|
17
|
+
if (!entry) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (this.isExpired(entry)) {
|
|
22
|
+
this.cache.delete(key);
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return entry.value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public set(key: string, value: T, ttl?: number): void {
|
|
30
|
+
if (this.cache.size >= this.maxSize && !this.cache.has(key)) {
|
|
31
|
+
this.evictOldest();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const expiresAt = Date.now() + (ttl ?? this.defaultTtl);
|
|
35
|
+
|
|
36
|
+
this.cache.set(key, {
|
|
37
|
+
value,
|
|
38
|
+
expiresAt,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public has(key: string): boolean {
|
|
43
|
+
const entry = this.cache.get(key);
|
|
44
|
+
|
|
45
|
+
if (!entry) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (this.isExpired(entry)) {
|
|
50
|
+
this.cache.delete(key);
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public delete(key: string): boolean {
|
|
58
|
+
return this.cache.delete(key);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public clear(): void {
|
|
62
|
+
this.cache.clear();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public size(): number {
|
|
66
|
+
return this.cache.size;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public cleanup(): void {
|
|
70
|
+
const now = Date.now();
|
|
71
|
+
|
|
72
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
73
|
+
if (entry.expiresAt <= now) {
|
|
74
|
+
this.cache.delete(key);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private isExpired(entry: CacheEntry<T>): boolean {
|
|
80
|
+
return entry.expiresAt <= Date.now();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private evictOldest(): void {
|
|
84
|
+
let oldestKey: string | null = null;
|
|
85
|
+
let oldestTime = Infinity;
|
|
86
|
+
|
|
87
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
88
|
+
if (entry.expiresAt < oldestTime) {
|
|
89
|
+
oldestTime = entry.expiresAt;
|
|
90
|
+
oldestKey = key;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (oldestKey) {
|
|
95
|
+
this.cache.delete(oldestKey);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
interface CacheEntry<T> {
|
|
2
|
+
value: T;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface ICacheOptions {
|
|
7
|
+
/** Time to live in milliseconds */
|
|
8
|
+
ttl: number;
|
|
9
|
+
/** Maximum number of entries in the cache */
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ICache<T> {
|
|
14
|
+
/**
|
|
15
|
+
* Gets a value from the cache.
|
|
16
|
+
* @param key - The cache key
|
|
17
|
+
* @returns The cached value or undefined if not found or expired
|
|
18
|
+
*/
|
|
19
|
+
get(key: string): T | undefined;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Sets a value in the cache.
|
|
23
|
+
* @param key - The cache key
|
|
24
|
+
* @param value - The value to cache
|
|
25
|
+
* @param ttl - Optional TTL override in milliseconds
|
|
26
|
+
*/
|
|
27
|
+
set(key: string, value: T, ttl?: number): void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a key exists in the cache and is not expired.
|
|
31
|
+
* @param key - The cache key
|
|
32
|
+
* @returns True if the key exists and is not expired
|
|
33
|
+
*/
|
|
34
|
+
has(key: string): boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Deletes a key from the cache.
|
|
38
|
+
* @param key - The cache key
|
|
39
|
+
* @returns True if the key was deleted
|
|
40
|
+
*/
|
|
41
|
+
delete(key: string): boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Clears all entries from the cache.
|
|
45
|
+
*/
|
|
46
|
+
clear(): void;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Gets the number of entries in the cache.
|
|
50
|
+
* @returns The number of entries
|
|
51
|
+
*/
|
|
52
|
+
size(): number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Removes all expired entries from the cache.
|
|
56
|
+
*/
|
|
57
|
+
cleanup(): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type { CacheEntry, ICacheOptions, ICache };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SimpleFn } from '../../types/function';
|
|
2
|
+
import { mockTimeoutResponse } from '../network/utils';
|
|
3
|
+
|
|
4
|
+
type DefaultParams = Record<string, unknown> & {
|
|
5
|
+
userId: string;
|
|
6
|
+
platform: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function wrapCancellableAPI<
|
|
10
|
+
T extends SimpleFn,
|
|
11
|
+
TParams extends any[] = Parameters<T> extends never[] ? [DefaultParams] : Parameters<T> & [DefaultParams],
|
|
12
|
+
>(api: T, props?: { timeout?: number }) {
|
|
13
|
+
return function (...args: TParams): Promise<Awaited<ReturnType<T>> | never> {
|
|
14
|
+
const { promise: timeoutPromise, cleanUp } = mockTimeoutResponse({
|
|
15
|
+
timeout: props?.timeout,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return Promise.race([api(...args), timeoutPromise])
|
|
19
|
+
.catch((e) => {
|
|
20
|
+
throw e;
|
|
21
|
+
})
|
|
22
|
+
.finally(cleanUp);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function wrapTimeoutAPI<
|
|
27
|
+
T extends SimpleFn,
|
|
28
|
+
TParams extends any[] = Parameters<T> extends never[] ? [DefaultParams] : Parameters<T> & [DefaultParams],
|
|
29
|
+
>(api: T, props?: { timeout?: number }) {
|
|
30
|
+
return function (...args: TParams): Promise<Awaited<ReturnType<T>> | never> {
|
|
31
|
+
const { promise: timeoutPromise, cleanUp } = mockTimeoutResponse({
|
|
32
|
+
timeout: props?.timeout,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return Promise.race([api(...args), timeoutPromise])
|
|
36
|
+
.catch((e) => {
|
|
37
|
+
throw e;
|
|
38
|
+
})
|
|
39
|
+
.finally(cleanUp);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function wrapRawTimeoutAPI<T extends SimpleFn, TParams extends any[] = Parameters<T>>(
|
|
44
|
+
api: T,
|
|
45
|
+
props?: { timeout?: number },
|
|
46
|
+
) {
|
|
47
|
+
return function (...args: TParams): Promise<Awaited<ReturnType<T>> | never> {
|
|
48
|
+
const { promise: timeoutPromise, cleanUp } = mockTimeoutResponse({
|
|
49
|
+
timeout: props?.timeout,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return Promise.race([api(...args), timeoutPromise])
|
|
53
|
+
.catch((e) => {
|
|
54
|
+
throw e;
|
|
55
|
+
})
|
|
56
|
+
.finally(cleanUp);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { wrapCancellableAPI, wrapTimeoutAPI, wrapRawTimeoutAPI };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
BaseError,
|
|
3
|
+
PaymentError,
|
|
4
|
+
PaymentErrorCode,
|
|
5
|
+
SubscriptionError,
|
|
6
|
+
SubscriptionErrorCode,
|
|
7
|
+
ValidationError,
|
|
8
|
+
ValidationErrorCode,
|
|
9
|
+
NotFoundError,
|
|
10
|
+
NotFoundErrorCode,
|
|
11
|
+
isBaseError,
|
|
12
|
+
isPaymentError,
|
|
13
|
+
isSubscriptionError,
|
|
14
|
+
isValidationError,
|
|
15
|
+
isNotFoundError,
|
|
16
|
+
} from './types';
|