globalpayments-api 3.10.11 → 3.10.13
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/CHANGELOG.md +10 -2
- package/appsec.properties +8 -0
- package/lib/src/Builders/AuthorizationBuilder.d.ts +8 -0
- package/lib/src/Builders/AuthorizationBuilder.js +16 -0
- package/lib/src/Builders/AuthorizationBuilder.js.map +1 -1
- package/lib/src/Builders/ManagementBuilder.d.ts +10 -0
- package/lib/src/Builders/ManagementBuilder.js +24 -0
- package/lib/src/Builders/ManagementBuilder.js.map +1 -1
- package/lib/src/Entities/Enums.d.ts +5 -1
- package/lib/src/Entities/Enums.js +8 -3
- package/lib/src/Entities/Enums.js.map +1 -1
- package/lib/src/Entities/ServiceEndpoints.d.ts +3 -0
- package/lib/src/Entities/ServiceEndpoints.js +3 -0
- package/lib/src/Entities/ServiceEndpoints.js.map +1 -1
- package/lib/src/Gateways/GpApiConnector.js +3 -0
- package/lib/src/Gateways/GpApiConnector.js.map +1 -1
- package/lib/src/Gateways/PorticoConnector.d.ts +1 -1
- package/lib/src/Gateways/PorticoConnector.js +12 -4
- package/lib/src/Gateways/PorticoConnector.js.map +1 -1
- package/lib/src/ServiceConfigs/Gateways/GpApiConfig.d.ts +2 -1
- package/lib/src/ServiceConfigs/Gateways/GpApiConfig.js +18 -4
- package/lib/src/ServiceConfigs/Gateways/GpApiConfig.js.map +1 -1
- package/lib/src/Services/GpApiServices.js +17 -4
- package/lib/src/Services/GpApiServices.js.map +1 -1
- package/lib/src/Terminals/UPA/UpaController.d.ts +1 -1
- package/lib/src/Terminals/UPA/UpaController.js +19 -21
- package/lib/src/Terminals/UPA/UpaController.js.map +1 -1
- package/lib/test/Integration/Gateways/CI/GpApiCreditCardNotPresentTests.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/CI/GpApiCreditCardNotPresentTests.test.js +90 -0
- package/lib/test/Integration/Gateways/CI/GpApiCreditCardNotPresentTests.test.js.map +1 -0
- package/lib/test/Integration/Gateways/CI/PorticoCreditTests.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/CI/PorticoCreditTests.test.js +63 -0
- package/lib/test/Integration/Gateways/CI/PorticoCreditTests.test.js.map +1 -0
- package/lib/test/Integration/Gateways/CI/UpaMicTests.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/CI/UpaMicTests.test.js +52 -0
- package/lib/test/Integration/Gateways/CI/UpaMicTests.test.js.map +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DataResidency.test.d.ts +1 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DataResidency.test.js +135 -0
- package/lib/test/Integration/Gateways/GpApiConnector/DataResidency.test.js.map +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +150 -3
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -1
- package/lib/test/Utils/CiTestingHarness.d.ts +22 -0
- package/lib/test/Utils/CiTestingHarness.js +153 -0
- package/lib/test/Utils/CiTestingHarness.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.CiTestingHarness = exports.CacheMode = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
var CacheMode;
|
|
30
|
+
(function (CacheMode) {
|
|
31
|
+
CacheMode["Locked"] = "Locked";
|
|
32
|
+
CacheMode["Unlocked"] = "Unlocked";
|
|
33
|
+
})(CacheMode || (exports.CacheMode = CacheMode = {}));
|
|
34
|
+
const proxyEndpoint = process.env.PROXY_ENDPOINT;
|
|
35
|
+
class CiTestingHarness {
|
|
36
|
+
static PROXY_ENDPOINT = `https://${proxyEndpoint}/proxy`;
|
|
37
|
+
targetServiceUrl;
|
|
38
|
+
cacheMode;
|
|
39
|
+
testName;
|
|
40
|
+
idMap;
|
|
41
|
+
fixedTimestamp;
|
|
42
|
+
constructor(targetServiceUrl, cacheMode, testName) {
|
|
43
|
+
this.targetServiceUrl = targetServiceUrl;
|
|
44
|
+
this.cacheMode = cacheMode;
|
|
45
|
+
this.testName = testName;
|
|
46
|
+
process.env.SDK_TESTING = "true";
|
|
47
|
+
const jsonFilePath = this.getJsonFilePath();
|
|
48
|
+
if (cacheMode === CacheMode.Locked) {
|
|
49
|
+
const raw = fs.readFileSync(jsonFilePath, "utf-8");
|
|
50
|
+
this.idMap = JSON.parse(raw);
|
|
51
|
+
this.fixedTimestamp = parseInt(this.idMap["_fixedTimestamp"], 10);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.idMap = this.loadExistingIds();
|
|
55
|
+
if (!this.idMap["_fixedTimestamp"]) {
|
|
56
|
+
this.idMap["_fixedTimestamp"] = Date.now().toString();
|
|
57
|
+
this.writeJsonFile();
|
|
58
|
+
}
|
|
59
|
+
this.fixedTimestamp = parseInt(this.idMap["_fixedTimestamp"], 10);
|
|
60
|
+
}
|
|
61
|
+
jest.useFakeTimers({
|
|
62
|
+
now: this.fixedTimestamp,
|
|
63
|
+
doNotFake: [
|
|
64
|
+
"setTimeout",
|
|
65
|
+
"setInterval",
|
|
66
|
+
"setImmediate",
|
|
67
|
+
"clearTimeout",
|
|
68
|
+
"clearInterval",
|
|
69
|
+
"clearImmediate",
|
|
70
|
+
"queueMicrotask",
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
getTestingUrl() {
|
|
75
|
+
const cacheReturns = this.cacheMode === CacheMode.Locked;
|
|
76
|
+
let targetHost = this.targetServiceUrl;
|
|
77
|
+
// Strip protocol prefix and replace with https:/
|
|
78
|
+
targetHost = targetHost.replace(/^https?:\/\//, "");
|
|
79
|
+
targetHost = "https:/" + targetHost;
|
|
80
|
+
return `${CiTestingHarness.PROXY_ENDPOINT}/(cacheReturns:${cacheReturns})/${targetHost}`;
|
|
81
|
+
}
|
|
82
|
+
generateRandomId(key) {
|
|
83
|
+
if (this.idMap[key]) {
|
|
84
|
+
return this.idMap[key];
|
|
85
|
+
}
|
|
86
|
+
if (this.cacheMode === CacheMode.Locked) {
|
|
87
|
+
throw new Error(`Harness is locked but no cached ID found for key: ${key}. Run tests in Unlocked mode first.`);
|
|
88
|
+
}
|
|
89
|
+
const id = (Math.floor(Math.random() * 90000000) + 10000000).toString();
|
|
90
|
+
this.idMap[key] = id;
|
|
91
|
+
this.writeJsonFile();
|
|
92
|
+
return id;
|
|
93
|
+
}
|
|
94
|
+
generateRandomAmount(key, min, max, decimals) {
|
|
95
|
+
if (this.idMap[key]) {
|
|
96
|
+
return this.idMap[key];
|
|
97
|
+
}
|
|
98
|
+
if (this.cacheMode === CacheMode.Locked) {
|
|
99
|
+
throw new Error(`Harness is locked but no cached value found for key: ${key}. Run tests in Unlocked mode first.`);
|
|
100
|
+
}
|
|
101
|
+
const raw = min + Math.random() * (max - min);
|
|
102
|
+
const amount = raw.toFixed(decimals);
|
|
103
|
+
this.idMap[key] = amount;
|
|
104
|
+
this.writeJsonFile();
|
|
105
|
+
return amount;
|
|
106
|
+
}
|
|
107
|
+
createRequestIdProvider(key) {
|
|
108
|
+
let counter = 0;
|
|
109
|
+
return {
|
|
110
|
+
getRequestId: () => {
|
|
111
|
+
return parseInt(this.generateRandomId(`${key}_${counter++}`), 10);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
getCurrentTime() {
|
|
116
|
+
return new Date();
|
|
117
|
+
}
|
|
118
|
+
loadExistingIds() {
|
|
119
|
+
const jsonFilePath = this.getJsonFilePath();
|
|
120
|
+
if (fs.existsSync(jsonFilePath)) {
|
|
121
|
+
const raw = fs.readFileSync(jsonFilePath, "utf-8");
|
|
122
|
+
return JSON.parse(raw);
|
|
123
|
+
}
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
getJsonFilePath() {
|
|
127
|
+
// __dirname resolves differently depending on whether we are running the
|
|
128
|
+
// TypeScript source directly (test/Utils/) or the compiled output
|
|
129
|
+
// (lib/test/Utils/). Rather than counting ".." segments, we walk up from
|
|
130
|
+
// __dirname until we find the directory that contains package.json, which
|
|
131
|
+
// is always the project root. From there we can reliably reach the
|
|
132
|
+
// source-controlled test/resources/citesting directory.
|
|
133
|
+
let dir = __dirname;
|
|
134
|
+
while (!fs.existsSync(path.join(dir, "package.json"))) {
|
|
135
|
+
const parent = path.dirname(dir);
|
|
136
|
+
if (parent === dir) {
|
|
137
|
+
throw new Error("Could not locate project root (package.json not found)");
|
|
138
|
+
}
|
|
139
|
+
dir = parent;
|
|
140
|
+
}
|
|
141
|
+
return path.resolve(dir, "test", "resources", "citesting", `${this.testName}.json`);
|
|
142
|
+
}
|
|
143
|
+
writeJsonFile() {
|
|
144
|
+
const jsonFilePath = this.getJsonFilePath();
|
|
145
|
+
const dir = path.dirname(jsonFilePath);
|
|
146
|
+
if (!fs.existsSync(dir)) {
|
|
147
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
148
|
+
}
|
|
149
|
+
fs.writeFileSync(jsonFilePath, JSON.stringify(this.idMap, null, 2));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exports.CiTestingHarness = CiTestingHarness;
|
|
153
|
+
//# sourceMappingURL=CiTestingHarness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CiTestingHarness.js","sourceRoot":"","sources":["../../../test/Utils/CiTestingHarness.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAG7B,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAEjD,MAAa,gBAAgB;IACnB,MAAM,CAAU,cAAc,GAAG,WAAW,aAAa,QAAQ,CAAC;IAElE,gBAAgB,CAAS;IACzB,SAAS,CAAY;IACrB,QAAQ,CAAS;IACjB,KAAK,CAAyB;IAC9B,cAAc,CAAS;IAE/B,YACE,gBAAwB,EACxB,SAAoB,EACpB,QAAgB;QAEhB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC;QAEjC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAE5C,IAAI,SAAS,KAAK,SAAS,CAAC,MAAM,EAA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CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACvB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;SACxC;QACD,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;;AA3JH,4CA4JC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "globalpayments-api",
|
|
3
|
-
"version"
|
|
3
|
+
"version": "3.10.13",
|
|
4
4
|
"description": "Global Payments SDK for NodeJS for Global Payments eCommerce gateways",
|
|
5
5
|
"author": "Global Payments",
|
|
6
6
|
"license": "GPL-2.0",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"test:jest": "jest",
|
|
19
|
-
"test:serial": "jest --runInBand
|
|
19
|
+
"test:serial": "jest --runInBand --testPathPattern=DataResidency.test.ts$ --",
|
|
20
20
|
"build:netsuite": "webpack --env.GP_NETSUITE_BUILD --config config/webpack.netsuite.js && node bin/netsuite-post.js",
|
|
21
21
|
"build:clean": "rimraf lib",
|
|
22
22
|
"docs": "typedoc --mode file --name \"GlobalPayments.Api\" --project tsconfig.json --out docs src",
|