univapay-node 3.0.23 → 3.0.25
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/cjs/api/RestAPI.d.ts +1 -1
- package/dist/cjs/api/RestAPI.js +6 -18
- package/dist/cjs/api/RestAPI.js.map +1 -1
- package/dist/cjs/api/utils/JWT.d.ts +2 -2
- package/dist/cjs/api/utils/JWT.js +4 -4
- package/dist/cjs/api/utils/JWT.js.map +1 -1
- package/dist/cjs/api/utils/userAgent.js +7 -6
- package/dist/cjs/api/utils/userAgent.js.map +1 -1
- package/dist/cjs/errors/parser.d.ts +1 -1
- package/dist/cjs/errors/parser.js +4 -4
- package/dist/cjs/errors/parser.js.map +1 -1
- package/dist/cjs/resources/common/Configuration.d.ts +3 -0
- package/dist/esm/api/RestAPI.d.ts +1 -1
- package/dist/esm/api/RestAPI.js +7 -19
- package/dist/esm/api/RestAPI.js.map +1 -1
- package/dist/esm/api/utils/JWT.d.ts +2 -2
- package/dist/esm/api/utils/JWT.js +4 -4
- package/dist/esm/api/utils/JWT.js.map +1 -1
- package/dist/esm/api/utils/userAgent.js +7 -6
- package/dist/esm/api/utils/userAgent.js.map +1 -1
- package/dist/esm/errors/parser.d.ts +1 -1
- package/dist/esm/errors/parser.js +4 -4
- package/dist/esm/errors/parser.js.map +1 -1
- package/dist/esm/resources/common/Configuration.d.ts +3 -0
- package/package.json +10 -10
package/dist/cjs/api/RestAPI.js
CHANGED
|
@@ -11,7 +11,6 @@ const p_timeout_1 = tslib_1.__importDefault(require("p-timeout"));
|
|
|
11
11
|
const query_string_1 = require("query-string");
|
|
12
12
|
const flat_1 = tslib_1.__importDefault(require("flat"));
|
|
13
13
|
const constants_js_1 = require("../common/constants.js");
|
|
14
|
-
const APIError_js_1 = require("../errors/APIError.js");
|
|
15
14
|
const parser_js_1 = require("../errors/parser.js");
|
|
16
15
|
const RequestResponseError_js_1 = require("../errors/RequestResponseError.js");
|
|
17
16
|
const TimeoutError_js_1 = require("../errors/TimeoutError.js");
|
|
@@ -47,28 +46,25 @@ const execRequest = async (execute) => {
|
|
|
47
46
|
return response;
|
|
48
47
|
}
|
|
49
48
|
catch (error) {
|
|
50
|
-
const
|
|
51
|
-
throw
|
|
49
|
+
const formattedError = error instanceof TimeoutError_js_1.TimeoutError || error instanceof RequestResponseError_js_1.ResponseError ? error : (0, parser_js_1.fromError)(error);
|
|
50
|
+
throw formattedError;
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
53
|
class RestAPI extends events_1.EventEmitter {
|
|
55
54
|
constructor(options = {}) {
|
|
56
55
|
super();
|
|
57
56
|
this._jwtRaw = null;
|
|
58
|
-
this.handleUpdateJWT = () => undefined;
|
|
59
57
|
this.endpoint = options.endpoint || process.env[constants_js_1.ENV_KEY_ENDPOINT] || constants_js_1.DEFAULT_ENDPOINT;
|
|
60
58
|
this.origin = options.origin || this.origin;
|
|
61
59
|
this.jwtRaw = options.jwt || process.env[constants_js_1.ENV_KEY_APPLICATION_JWT];
|
|
62
|
-
|
|
63
|
-
this.handleUpdateJWT = options.handleUpdateJWT;
|
|
64
|
-
}
|
|
60
|
+
this.handleUpdateJWT = options.handleUpdateJWT || undefined;
|
|
65
61
|
this.appId = options.appId || process.env[constants_js_1.ENV_KEY_APP_ID];
|
|
66
62
|
this.secret = options.secret || process.env[constants_js_1.ENV_KEY_SECRET];
|
|
67
63
|
this.authToken = options.authToken;
|
|
68
64
|
}
|
|
69
65
|
set jwtRaw(jwtRaw) {
|
|
70
|
-
this.jwt = (0, JWT_js_1.parseJWT)(jwtRaw);
|
|
71
66
|
this._jwtRaw = jwtRaw;
|
|
67
|
+
this.jwt = (0, JWT_js_1.parseJWT)(jwtRaw);
|
|
72
68
|
}
|
|
73
69
|
get jwtRaw() {
|
|
74
70
|
return this._jwtRaw;
|
|
@@ -77,15 +73,7 @@ class RestAPI extends events_1.EventEmitter {
|
|
|
77
73
|
* @internal
|
|
78
74
|
*/
|
|
79
75
|
async send(method, uri, data, auth, options = {}) {
|
|
80
|
-
const {
|
|
81
|
-
const dateNow = new Date();
|
|
82
|
-
const timestampUTC = Math.round(dateNow.getTime() / 1000);
|
|
83
|
-
if (requireAuth && this._jwtRaw && this.jwt.exp < timestampUTC) {
|
|
84
|
-
throw new RequestResponseError_js_1.RequestError({
|
|
85
|
-
code: APIError_js_1.ResponseErrorCode.ExpiredLoginToken,
|
|
86
|
-
errors: [],
|
|
87
|
-
});
|
|
88
|
-
}
|
|
76
|
+
const { acceptType, keyFormatter = object_js_1.toSnakeCase, ignoreKeysFormatting = ["metadata"] } = options;
|
|
89
77
|
const payload = [HTTPMethod.GET, HTTPMethod.DELETE].includes(method) === false;
|
|
90
78
|
const params = {
|
|
91
79
|
headers: this.getHeaders(data, auth, payload, acceptType),
|
|
@@ -99,7 +87,7 @@ class RestAPI extends events_1.EventEmitter {
|
|
|
99
87
|
const jwt = (0, JWT_js_1.extractJWT)(response);
|
|
100
88
|
if (jwt) {
|
|
101
89
|
this.jwtRaw = jwt;
|
|
102
|
-
this.handleUpdateJWT(jwt);
|
|
90
|
+
this.handleUpdateJWT?.(jwt);
|
|
103
91
|
}
|
|
104
92
|
await (0, fetch_js_1.checkStatus)(response);
|
|
105
93
|
const noContentStatus = 204;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestAPI.js","sourceRoot":"","sources":["../../../src/api/RestAPI.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,uDAAkD;AAClD,mCAAsC;AACtC,kEAAiC;AACjC,+CAA2D;AAC3D,wDAA2B;AAE3B,yDAUgC;
|
|
1
|
+
{"version":3,"file":"RestAPI.js","sourceRoot":"","sources":["../../../src/api/RestAPI.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,uDAAkD;AAClD,mCAAsC;AACtC,kEAAiC;AACjC,+CAA2D;AAC3D,wDAA2B;AAE3B,yDAUgC;AAEhC,mDAAgD;AAChD,+EAAkE;AAClE,+DAAyD;AAEzD,gDA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,MAAM,QAAQ,GAAG,KAAK,IAAuB,EAAE;gBAC3C,IAAI;oBACA,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAAC;oBAE/B,iBAAiB,EAAE,CAAC,MAAM,CAAC,CAAC;oBAE5B,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE;wBAC3B,OAAO,IAAI,CAAC;qBACf;oBAED,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE;wBAC3B,MAAM,aAAa,EAAE,CAAC;wBACtB,OAAO,QAAQ,EAAE,CAAC;qBACrB;oBAED,OAAO,MAAM,CAAC;iBACjB;gBAAC,OAAO,KAAK,EAAE;oBACZ,8FAA8F;oBAC9F,IAAI,KAAK,CAAC,aAAa,EAAE,QAAQ,KAAK,GAAG,IAAI,kBAAkB,IAAI,uCAAwB,EAAE;wBACzF,MAAM,KAAK,CAAC;qBACf;oBAED,kBAAkB,EAAE,CAAC;oBACrB,MAAM,aAAa,EAAE,CAAC;oBACtB,OAAO,QAAQ,EAAE,CAAC;iBACrB;YACL,CAAC,CAAC;YAEF,OAAO,IAAA,mBAAQ,EAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,8BAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC;CACJ;AA3MD,0BA2MC"}
|
|
@@ -8,8 +8,8 @@ export interface JWTBasePayload {
|
|
|
8
8
|
jti?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare type JWTPayload<Payload> = JWTBasePayload & Payload;
|
|
11
|
-
export declare
|
|
11
|
+
export declare const parseJWT: <Payload>(jwt?: string | null, keepKeys?: boolean) => JWTPayload<Payload>;
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const extractJWT: (response: Response) => string | null;
|
|
@@ -9,7 +9,7 @@ const tslib_1 = require("tslib");
|
|
|
9
9
|
const jwt_decode_1 = tslib_1.__importDefault(require("jwt-decode"));
|
|
10
10
|
const JWTError_js_1 = require("../../errors/JWTError.js");
|
|
11
11
|
const object_js_1 = require("../../utils/object.js");
|
|
12
|
-
|
|
12
|
+
const parseJWT = (jwt, keepKeys = false) => {
|
|
13
13
|
if (!jwt) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
@@ -23,13 +23,13 @@ function parseJWT(jwt, keepKeys = false) {
|
|
|
23
23
|
catch {
|
|
24
24
|
throw new JWTError_js_1.JWTError();
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
exports.parseJWT = parseJWT;
|
|
28
28
|
const BearerRegexp = /^Bearer (.*)$/i;
|
|
29
29
|
/**
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
const extractJWT = (response) => {
|
|
33
33
|
const headerNames = ["authorization", "x-amzn-remapped-authorization", "X-REFRESH-AUTHORIZATION"];
|
|
34
34
|
const header = headerNames.reduce((acc, name) => response.headers.get(name) || acc, null);
|
|
35
35
|
if (header === null) {
|
|
@@ -37,6 +37,6 @@ function extractJWT(response) {
|
|
|
37
37
|
}
|
|
38
38
|
const matches = header.match(BearerRegexp);
|
|
39
39
|
return matches === null ? null : matches[1];
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
exports.extractJWT = extractJWT;
|
|
42
42
|
//# sourceMappingURL=JWT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JWT.js","sourceRoot":"","sources":["../../../../src/api/utils/JWT.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,oEAAgC;AAEhC,0DAAoD;AACpD,qDAAmE;
|
|
1
|
+
{"version":3,"file":"JWT.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AAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB"}
|
|
@@ -7,12 +7,13 @@ const browser_or_node_1 = require("browser-or-node");
|
|
|
7
7
|
const CLIENT_NAME = "univapay-node";
|
|
8
8
|
const getPlatform = () => browser_or_node_1.isNode
|
|
9
9
|
? `node.js@${process.versions.node}`
|
|
10
|
-
:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
: /* c8 ignore next 8 */
|
|
11
|
+
browser_or_node_1.isBrowser
|
|
12
|
+
? (() => {
|
|
13
|
+
const { browser: { name, version }, } = bowser_1.default.parse(window.navigator.userAgent);
|
|
14
|
+
return `${name}@${version}`;
|
|
15
|
+
})()
|
|
16
|
+
: "unknown-platform";
|
|
16
17
|
const getModuleType = () => (typeof require === "function" ? "commonjs" : "module");
|
|
17
18
|
const userAgent = () => `${CLIENT_NAME} ${getPlatform()} ${getModuleType()}`;
|
|
18
19
|
exports.userAgent = userAgent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../../src/api/utils/userAgent.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,qDAAoD;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,wBAAM;IACF,CAAC,CAAC,WAAW,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IACpC,CAAC,CAAC,2BAAS;
|
|
1
|
+
{"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../../src/api/utils/userAgent.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAC5B,qDAAoD;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,wBAAM;IACF,CAAC,CAAC,WAAW,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IACpC,CAAC,CAAC,sBAAsB;QACxB,2BAAS;YACT,CAAC,CAAC,CAAC,GAAG,EAAE;gBACF,MAAM,EACF,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAC7B,GAAG,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAE7C,OAAO,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,EAAE;YACN,CAAC,CAAC,kBAAkB,CAAC;AAE7B,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE7E,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,WAAW,IAAI,WAAW,EAAE,IAAI,aAAa,EAAE,EAAE,CAAC;AAAvE,QAAA,SAAS,aAA8D"}
|
|
@@ -9,7 +9,7 @@ const APIError_js_1 = require("./APIError.js");
|
|
|
9
9
|
const PathParameterError_js_1 = require("./PathParameterError.js");
|
|
10
10
|
const RequestParameterError_js_1 = require("./RequestParameterError.js");
|
|
11
11
|
const RequestResponseError_js_1 = require("./RequestResponseError.js");
|
|
12
|
-
|
|
12
|
+
const getCodeByStatus = (status) => {
|
|
13
13
|
const codeMap = {
|
|
14
14
|
301: APIError_js_1.ResponseErrorCode.CardNumberNotValid,
|
|
15
15
|
302: APIError_js_1.ResponseErrorCode.CardExpirationMonthInvalid,
|
|
@@ -72,8 +72,8 @@ function getCodeByStatus(status) {
|
|
|
72
72
|
return codeMap[status];
|
|
73
73
|
}
|
|
74
74
|
return APIError_js_1.ResponseErrorCode.UnknownError;
|
|
75
|
-
}
|
|
76
|
-
|
|
75
|
+
};
|
|
76
|
+
const fromError = (error) => {
|
|
77
77
|
if (error instanceof PathParameterError_js_1.PathParameterError || error instanceof RequestParameterError_js_1.RequestParameterError) {
|
|
78
78
|
return new RequestResponseError_js_1.RequestError({
|
|
79
79
|
code: APIError_js_1.ResponseErrorCode.ValidationError,
|
|
@@ -96,6 +96,6 @@ function fromError(error) {
|
|
|
96
96
|
code: APIError_js_1.ResponseErrorCode.UnknownError,
|
|
97
97
|
errors: [],
|
|
98
98
|
});
|
|
99
|
-
}
|
|
99
|
+
};
|
|
100
100
|
exports.fromError = fromError;
|
|
101
101
|
//# sourceMappingURL=parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/errors/parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA4D;AAC5D,mEAA6D;AAC7D,yEAAmE;AACnE,uEAAkG;AAElG,
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/errors/parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA4D;AAC5D,mEAA6D;AAC7D,yEAAmE;AACnE,uEAAkG;AAElG,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IAC/C,MAAM,OAAO,GAA2B;QACpC,GAAG,EAAE,+BAAiB,CAAC,kBAAkB;QACzC,GAAG,EAAE,+BAAiB,CAAC,0BAA0B;QACjD,GAAG,EAAE,+BAAiB,CAAC,yBAAyB;QAChD,GAAG,EAAE,+BAAiB,CAAC,WAAW;QAClC,GAAG,EAAE,+BAAiB,CAAC,cAAc;QACrC,GAAG,EAAE,+BAAiB,CAAC,YAAY;QACnC,GAAG,EAAE,+BAAiB,CAAC,WAAW;QAClC,GAAG,EAAE,+BAAiB,CAAC,iBAAiB;QACxC,GAAG,EAAE,+BAAiB,CAAC,eAAe;QACtC,GAAG,EAAE,+BAAiB,CAAC,qBAAqB;QAC5C,GAAG,EAAE,+BAAiB,CAAC,iBAAiB;QACxC,GAAG,EAAE,+BAAiB,CAAC,aAAa;QACpC,GAAG,EAAE,+BAAiB,CAAC,SAAS;QAChC,GAAG,EAAE,+BAAiB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,CAAC,KAAK,CAAC,MAAM,CAAC;YAC1E,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;SACxE,CAAC,CAAC;KACN;IAED,OAAO,IAAI,uCAAa,CAAC;QACrB,IAAI,EAAE,+BAAiB,CAAC,YAAY;QACpC,MAAM,EAAE,EAAE;KACb,CAAC,CAAC;AACP,CAAC,CAAC;AAvBW,QAAA,SAAS,aAuBpB"}
|
|
@@ -138,6 +138,8 @@ export interface UserTransactionsConfiguration {
|
|
|
138
138
|
enabled?: boolean;
|
|
139
139
|
notifyCustomer?: boolean;
|
|
140
140
|
notifyOnTest?: boolean;
|
|
141
|
+
notifyUserOnFailedTransaction?: boolean;
|
|
142
|
+
notifyCustomerOnFailedTransaction?: boolean;
|
|
141
143
|
notifyOnRecurringTokenCreation?: boolean;
|
|
142
144
|
notifyOnWebhookFailure?: boolean;
|
|
143
145
|
notifyOnWebhookDisabled?: boolean;
|
|
@@ -156,6 +158,7 @@ export interface SubscriptionsConfiguration {
|
|
|
156
158
|
enabled?: boolean;
|
|
157
159
|
failedChargesToCancel: number;
|
|
158
160
|
suspendOnCancel: boolean;
|
|
161
|
+
allowMerchantAmountPatch?: boolean;
|
|
159
162
|
}
|
|
160
163
|
export interface DescriptorProvidedConfiguration {
|
|
161
164
|
name: string;
|
package/dist/esm/api/RestAPI.js
CHANGED
|
@@ -7,9 +7,8 @@ import pTimeout from "p-timeout";
|
|
|
7
7
|
import { stringify as stringifyQuery } from "query-string";
|
|
8
8
|
import flatten from "flat";
|
|
9
9
|
import { DEFAULT_ENDPOINT, ENV_KEY_APP_ID, ENV_KEY_APPLICATION_JWT, ENV_KEY_ENDPOINT, ENV_KEY_SECRET, IDEMPOTENCY_KEY_HEADER, POLLING_INTERVAL, POLLING_TIMEOUT, MAX_INTERNAL_ERROR_RETRY, } from "../common/constants.js";
|
|
10
|
-
import { ResponseErrorCode } from "../errors/APIError.js";
|
|
11
10
|
import { fromError } from "../errors/parser.js";
|
|
12
|
-
import {
|
|
11
|
+
import { ResponseError } from "../errors/RequestResponseError.js";
|
|
13
12
|
import { TimeoutError } from "../errors/TimeoutError.js";
|
|
14
13
|
import { checkStatus, parseJSON } from "../utils/fetch.js";
|
|
15
14
|
import { isBlob, toSnakeCase, transformKeys } from "../utils/object.js";
|
|
@@ -43,28 +42,25 @@ const execRequest = async (execute) => {
|
|
|
43
42
|
return response;
|
|
44
43
|
}
|
|
45
44
|
catch (error) {
|
|
46
|
-
const
|
|
47
|
-
throw
|
|
45
|
+
const formattedError = error instanceof TimeoutError || error instanceof ResponseError ? error : fromError(error);
|
|
46
|
+
throw formattedError;
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
export class RestAPI extends EventEmitter {
|
|
51
50
|
constructor(options = {}) {
|
|
52
51
|
super();
|
|
53
52
|
this._jwtRaw = null;
|
|
54
|
-
this.handleUpdateJWT = () => undefined;
|
|
55
53
|
this.endpoint = options.endpoint || process.env[ENV_KEY_ENDPOINT] || DEFAULT_ENDPOINT;
|
|
56
54
|
this.origin = options.origin || this.origin;
|
|
57
55
|
this.jwtRaw = options.jwt || process.env[ENV_KEY_APPLICATION_JWT];
|
|
58
|
-
|
|
59
|
-
this.handleUpdateJWT = options.handleUpdateJWT;
|
|
60
|
-
}
|
|
56
|
+
this.handleUpdateJWT = options.handleUpdateJWT || undefined;
|
|
61
57
|
this.appId = options.appId || process.env[ENV_KEY_APP_ID];
|
|
62
58
|
this.secret = options.secret || process.env[ENV_KEY_SECRET];
|
|
63
59
|
this.authToken = options.authToken;
|
|
64
60
|
}
|
|
65
61
|
set jwtRaw(jwtRaw) {
|
|
66
|
-
this.jwt = parseJWT(jwtRaw);
|
|
67
62
|
this._jwtRaw = jwtRaw;
|
|
63
|
+
this.jwt = parseJWT(jwtRaw);
|
|
68
64
|
}
|
|
69
65
|
get jwtRaw() {
|
|
70
66
|
return this._jwtRaw;
|
|
@@ -73,15 +69,7 @@ export class RestAPI extends EventEmitter {
|
|
|
73
69
|
* @internal
|
|
74
70
|
*/
|
|
75
71
|
async send(method, uri, data, auth, options = {}) {
|
|
76
|
-
const {
|
|
77
|
-
const dateNow = new Date();
|
|
78
|
-
const timestampUTC = Math.round(dateNow.getTime() / 1000);
|
|
79
|
-
if (requireAuth && this._jwtRaw && this.jwt.exp < timestampUTC) {
|
|
80
|
-
throw new RequestError({
|
|
81
|
-
code: ResponseErrorCode.ExpiredLoginToken,
|
|
82
|
-
errors: [],
|
|
83
|
-
});
|
|
84
|
-
}
|
|
72
|
+
const { acceptType, keyFormatter = toSnakeCase, ignoreKeysFormatting = ["metadata"] } = options;
|
|
85
73
|
const payload = [HTTPMethod.GET, HTTPMethod.DELETE].includes(method) === false;
|
|
86
74
|
const params = {
|
|
87
75
|
headers: this.getHeaders(data, auth, payload, acceptType),
|
|
@@ -95,7 +83,7 @@ export class RestAPI extends EventEmitter {
|
|
|
95
83
|
const jwt = extractJWT(response);
|
|
96
84
|
if (jwt) {
|
|
97
85
|
this.jwtRaw = jwt;
|
|
98
|
-
this.handleUpdateJWT(jwt);
|
|
86
|
+
this.handleUpdateJWT?.(jwt);
|
|
99
87
|
}
|
|
100
88
|
await checkStatus(response);
|
|
101
89
|
const noContentStatus = 204;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestAPI.js","sourceRoot":"","sources":["../../../src/api/RestAPI.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,OAAO,MAAM,MAAM,CAAC;AAE3B,OA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E;wBAC3B,MAAM,aAAa,EAAE,CAAC;wBACtB,OAAO,QAAQ,EAAE,CAAC;qBACrB;oBAED,OAAO,MAAM,CAAC;iBACjB;gBAAC,OAAO,KAAK,EAAE;oBACZ,8FAA8F;oBAC9F,IAAI,KAAK,CAAC,aAAa,EAAE,QAAQ,KAAK,GAAG,IAAI,kBAAkB,IAAI,wBAAwB,EAAE;wBACzF,MAAM,KAAK,CAAC;qBACf;oBAED,kBAAkB,EAAE,CAAC;oBACrB,MAAM,aAAa,EAAE,CAAC;oBACtB,OAAO,QAAQ,EAAE,CAAC;iBACrB;YACL,CAAC,CAAC;YAEF,OAAO,QAAQ,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC;CACJ"}
|
|
@@ -8,8 +8,8 @@ export interface JWTBasePayload {
|
|
|
8
8
|
jti?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare type JWTPayload<Payload> = JWTBasePayload & Payload;
|
|
11
|
-
export declare
|
|
11
|
+
export declare const parseJWT: <Payload>(jwt?: string | null, keepKeys?: boolean) => JWTPayload<Payload>;
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const extractJWT: (response: Response) => string | null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import decode from "jwt-decode";
|
|
6
6
|
import { JWTError } from "../../errors/JWTError.js";
|
|
7
7
|
import { toCamelCase, transformKeys } from "../../utils/object.js";
|
|
8
|
-
export
|
|
8
|
+
export const parseJWT = (jwt, keepKeys = false) => {
|
|
9
9
|
if (!jwt) {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
@@ -19,12 +19,12 @@ export function parseJWT(jwt, keepKeys = false) {
|
|
|
19
19
|
catch {
|
|
20
20
|
throw new JWTError();
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
const BearerRegexp = /^Bearer (.*)$/i;
|
|
24
24
|
/**
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export const extractJWT = (response) => {
|
|
28
28
|
const headerNames = ["authorization", "x-amzn-remapped-authorization", "X-REFRESH-AUTHORIZATION"];
|
|
29
29
|
const header = headerNames.reduce((acc, name) => response.headers.get(name) || acc, null);
|
|
30
30
|
if (header === null) {
|
|
@@ -32,5 +32,5 @@ export function extractJWT(response) {
|
|
|
32
32
|
}
|
|
33
33
|
const matches = header.match(BearerRegexp);
|
|
34
34
|
return matches === null ? null : matches[1];
|
|
35
|
-
}
|
|
35
|
+
};
|
|
36
36
|
//# sourceMappingURL=JWT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JWT.js","sourceRoot":"","sources":["../../../../src/api/utils/JWT.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAcnE,MAAM,
|
|
1
|
+
{"version":3,"file":"JWT.js","sourceRoot":"","sources":["../../../../src/api/utils/JWT.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAcnE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAU,GAAmB,EAAE,QAAQ,GAAG,K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@${process.versions.node}`
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
: /* c8 ignore next 8 */
|
|
7
|
+
isBrowser
|
|
8
|
+
? (() => {
|
|
9
|
+
const { browser: { name, version }, } = bowser.parse(window.navigator.userAgent);
|
|
10
|
+
return `${name}@${version}`;
|
|
11
|
+
})()
|
|
12
|
+
: "unknown-platform";
|
|
12
13
|
const getModuleType = () => (typeof require === "function" ? "commonjs" : "module");
|
|
13
14
|
export const userAgent = () => `${CLIENT_NAME} ${getPlatform()} ${getModuleType()}`;
|
|
14
15
|
//# sourceMappingURL=userAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../../src/api/utils/userAgent.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,MAAM;IACF,CAAC,CAAC,WAAW,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IACpC,CAAC,CAAC,SAAS;
|
|
1
|
+
{"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../../../src/api/utils/userAgent.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,MAAM;IACF,CAAC,CAAC,WAAW,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;IACpC,CAAC,CAAC,sBAAsB;QACxB,SAAS;YACT,CAAC,CAAC,CAAC,GAAG,EAAE;gBACF,MAAM,EACF,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAC7B,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAE7C,OAAO,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,EAAE;YACN,CAAC,CAAC,kBAAkB,CAAC;AAE7B,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,WAAW,IAAI,WAAW,EAAE,IAAI,aAAa,EAAE,EAAE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { APIError, ResponseErrorCode } from "./APIError.js";
|
|
|
6
6
|
import { PathParameterError } from "./PathParameterError.js";
|
|
7
7
|
import { RequestParameterError } from "./RequestParameterError.js";
|
|
8
8
|
import { RequestError, ResponseError } from "./RequestResponseError.js";
|
|
9
|
-
|
|
9
|
+
const getCodeByStatus = (status) => {
|
|
10
10
|
const codeMap = {
|
|
11
11
|
301: ResponseErrorCode.CardNumberNotValid,
|
|
12
12
|
302: ResponseErrorCode.CardExpirationMonthInvalid,
|
|
@@ -69,8 +69,8 @@ function getCodeByStatus(status) {
|
|
|
69
69
|
return codeMap[status];
|
|
70
70
|
}
|
|
71
71
|
return ResponseErrorCode.UnknownError;
|
|
72
|
-
}
|
|
73
|
-
export
|
|
72
|
+
};
|
|
73
|
+
export const fromError = (error) => {
|
|
74
74
|
if (error instanceof PathParameterError || error instanceof RequestParameterError) {
|
|
75
75
|
return new RequestError({
|
|
76
76
|
code: ResponseErrorCode.ValidationError,
|
|
@@ -93,5 +93,5 @@ export function fromError(error) {
|
|
|
93
93
|
code: ResponseErrorCode.UnknownError,
|
|
94
94
|
errors: [],
|
|
95
95
|
});
|
|
96
|
-
}
|
|
96
|
+
};
|
|
97
97
|
//# sourceMappingURL=parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/errors/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAA4B,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAElG,
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/errors/parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAA4B,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAElG,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE;IAC/C,MAAM,OAAO,GAA2B;QACpC,GAAG,EAAE,iBAAiB,CAAC,kBAAkB;QACzC,GAAG,EAAE,iBAAiB,CAAC,0BAA0B;QACjD,GAAG,EAAE,iBAAiB,CAAC,yBAAyB;QAChD,GAAG,EAAE,iBAAiB,CAAC,WAAW;QAClC,GAAG,EAAE,iBAAiB,CAAC,cAAc;QACrC,GAAG,EAAE,iBAAiB,CAAC,YAAY;QACnC,GAAG,EAAE,iBAAiB,CAAC,WAAW;QAClC,GAAG,EAAE,iBAAiB,CAAC,iBAAiB;QACxC,GAAG,EAAE,iBAAiB,CAAC,eAAe;QACtC,GAAG,EAAE,iBAAiB,CAAC,qBAAqB;QAC5C,GAAG,EAAE,iBAAiB,CAAC,iBAAiB;QACxC,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,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC;YAC1E,QAAQ,EAAE,KAAK,CAAC,MAAM;YACtB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;SACxE,CAAC,CAAC;KACN;IAED,OAAO,IAAI,aAAa,CAAC;QACrB,IAAI,EAAE,iBAAiB,CAAC,YAAY;QACpC,MAAM,EAAE,EAAE;KACb,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -138,6 +138,8 @@ export interface UserTransactionsConfiguration {
|
|
|
138
138
|
enabled?: boolean;
|
|
139
139
|
notifyCustomer?: boolean;
|
|
140
140
|
notifyOnTest?: boolean;
|
|
141
|
+
notifyUserOnFailedTransaction?: boolean;
|
|
142
|
+
notifyCustomerOnFailedTransaction?: boolean;
|
|
141
143
|
notifyOnRecurringTokenCreation?: boolean;
|
|
142
144
|
notifyOnWebhookFailure?: boolean;
|
|
143
145
|
notifyOnWebhookDisabled?: boolean;
|
|
@@ -156,6 +158,7 @@ export interface SubscriptionsConfiguration {
|
|
|
156
158
|
enabled?: boolean;
|
|
157
159
|
failedChargesToCancel: number;
|
|
158
160
|
suspendOnCancel: boolean;
|
|
161
|
+
allowMerchantAmountPatch?: boolean;
|
|
159
162
|
}
|
|
160
163
|
export interface DescriptorProvidedConfiguration {
|
|
161
164
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "univapay-node",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,29 +38,29 @@
|
|
|
38
38
|
"module"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/chai": "4.3.
|
|
41
|
+
"@types/chai": "4.3.4",
|
|
42
42
|
"@types/chai-arrays": "2.0.0",
|
|
43
43
|
"@types/chai-as-promised": "7.1.5",
|
|
44
44
|
"@types/fetch-mock": "7.3.5",
|
|
45
45
|
"@types/jsonwebtoken": "8.5.9",
|
|
46
46
|
"@types/mocha": "10.0.0",
|
|
47
|
-
"@types/node": "18.11.
|
|
47
|
+
"@types/node": "18.11.9",
|
|
48
48
|
"@types/sinon": "10.0.13",
|
|
49
49
|
"@types/sinon-chai": "3.2.8",
|
|
50
50
|
"@types/uuid": "8.3.4",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
52
|
-
"@typescript-eslint/parser": "5.42.
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "5.43.0",
|
|
52
|
+
"@typescript-eslint/parser": "5.42.1",
|
|
53
53
|
"c8": "^7.12.0",
|
|
54
|
-
"chai": "4.3.
|
|
54
|
+
"chai": "4.3.7",
|
|
55
55
|
"chai-arrays": "2.2.0",
|
|
56
56
|
"chai-as-promised": "7.1.1",
|
|
57
57
|
"cross-fetch": "3.1.5",
|
|
58
|
-
"eslint": "8.
|
|
58
|
+
"eslint": "8.27.0",
|
|
59
59
|
"eslint-config-prettier": "8.5.0",
|
|
60
60
|
"eslint-plugin-prettier": "4.2.1",
|
|
61
61
|
"eslint-plugin-simple-import-sort": "8.0.0",
|
|
62
62
|
"fetch-mock": "9.11.0",
|
|
63
|
-
"husky": "8.0.
|
|
63
|
+
"husky": "8.0.2",
|
|
64
64
|
"isomorphic-form-data": "2.0.0",
|
|
65
65
|
"jsonwebtoken": "8.5.1",
|
|
66
66
|
"lint-staged": "13.0.3",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"sinon": "14.0.1",
|
|
74
74
|
"sinon-chai": "3.7.0",
|
|
75
75
|
"ts-node": "10.9.1",
|
|
76
|
-
"typedoc": "0.23.
|
|
76
|
+
"typedoc": "0.23.21",
|
|
77
77
|
"typedoc-plugin-internal-external": "2.2.0",
|
|
78
78
|
"typescript": "4.8.4",
|
|
79
79
|
"uuid": "9.0.0"
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"jwt-decode": "^3.1.2",
|
|
91
91
|
"p-timeout": "^4.1.0",
|
|
92
92
|
"query-string": "^5.1.1",
|
|
93
|
-
"tslib": "^2.4.
|
|
93
|
+
"tslib": "^2.4.1"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"lint": "eslint --cache .",
|