globalpayments-api 3.10.1 → 3.10.2
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 +184 -177
- package/LICENSE.md +257 -257
- package/README.md +141 -141
- package/appsec.properties +8 -0
- package/lib/src/Gateways/PorticoConnector.js +24 -0
- package/lib/src/Gateways/PorticoConnector.js.map +1 -1
- package/lib/src/Gateways/RealexConnector.d.ts +30 -0
- package/lib/src/Gateways/RealexConnector.js +523 -0
- package/lib/src/PaymentMethods/Credit.d.ts +2 -1
- package/lib/src/PaymentMethods/Credit.js +1 -0
- package/lib/src/PaymentMethods/Credit.js.map +1 -1
- package/lib/src/ServicesConfig.d.ts +27 -0
- package/lib/src/ServicesConfig.js +50 -0
- package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js +15 -15
- package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js +5 -5
- package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js +4 -4
- package/lib/test/Integration/Gateways/PorticoConnector/AchTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +112 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +483 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +83 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +1720 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +83 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +1757 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +682 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +2218 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +32 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -1
- package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +707 -0
- package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +151 -0
- package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +171 -0
- package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +8 -8
- package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +192 -0
- package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +377 -0
- package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +196 -0
- package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +53 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.js +100 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.js +352 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.js +123 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.js +142 -0
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.js +100 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.js +535 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.js +124 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.d.ts +1 -0
- package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.js +144 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.js +4373 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.js +758 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.js +2399 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.js +1656 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.js +5650 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.js +1985 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.js +2369 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.js +1703 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.js +2053 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.js +2469 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.js +3116 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.js +2031 -0
- package/lib/test/Integration/Gateways/RealexConnector/CreditTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/CreditTest.js +322 -0
- package/lib/test/Integration/Gateways/RealexConnector/HppTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/HppTest.js +98 -0
- package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.d.ts +1 -0
- package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.js +263 -0
- package/lib/test/Integration/Services/CheckServiceTest.d.ts +1 -0
- package/lib/test/Integration/Services/CheckServiceTest.js +98 -0
- package/lib/test/Integration/Services/CreditServiceTest.d.ts +1 -0
- package/lib/test/Integration/Services/CreditServiceTest.js +313 -0
- package/lib/test/Integration/Services/DebitServiceTest.d.ts +1 -0
- package/lib/test/Integration/Services/DebitServiceTest.js +154 -0
- package/lib/test/Integration/Services/EBTServiceTest.d.ts +1 -0
- package/lib/test/Integration/Services/EBTServiceTest.js +135 -0
- package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +1 -0
- package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +161 -0
- package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +1 -0
- package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +139 -0
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +1 -0
- package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +202 -0
- package/lib/test/Unit/Gateways/RealexConnector/CreditTest.d.ts +1 -0
- package/lib/test/Unit/Gateways/RealexConnector/CreditTest.js +29 -0
- package/package.json +62 -62
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ava_1 = require("ava");
|
|
40
|
+
var src_1 = require("../../../src/");
|
|
41
|
+
var Data_1 = require("../../Data");
|
|
42
|
+
var config = new src_1.ServicesConfig();
|
|
43
|
+
config.secretApiKey = "skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
|
|
44
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
45
|
+
var service = new src_1.DebitService(config);
|
|
46
|
+
var runSerially = false;
|
|
47
|
+
var test = runSerially ? ava_1.default.serial : ava_1.default;
|
|
48
|
+
var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
|
|
49
|
+
test("sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var response;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
t.plan(2);
|
|
55
|
+
return [4 /*yield*/, service
|
|
56
|
+
.charge(14)
|
|
57
|
+
.withCurrency("USD")
|
|
58
|
+
.withPaymentMethod(card)
|
|
59
|
+
.withAllowDuplicates(true)
|
|
60
|
+
.execute()];
|
|
61
|
+
case 1:
|
|
62
|
+
response = _a.sent();
|
|
63
|
+
t.truthy(response);
|
|
64
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
65
|
+
return [2 /*return*/];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}); });
|
|
69
|
+
test("refund by card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
+
var response, refund;
|
|
71
|
+
return __generator(this, function (_a) {
|
|
72
|
+
switch (_a.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
t.plan(4);
|
|
75
|
+
return [4 /*yield*/, service
|
|
76
|
+
.charge(15)
|
|
77
|
+
.withCurrency("USD")
|
|
78
|
+
.withPaymentMethod(card)
|
|
79
|
+
.withAllowDuplicates(true)
|
|
80
|
+
.execute()];
|
|
81
|
+
case 1:
|
|
82
|
+
response = _a.sent();
|
|
83
|
+
t.truthy(response);
|
|
84
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
85
|
+
return [4 /*yield*/, service
|
|
86
|
+
.refund(15)
|
|
87
|
+
.withCurrency("USD")
|
|
88
|
+
.withPaymentMethod(card)
|
|
89
|
+
.execute()];
|
|
90
|
+
case 2:
|
|
91
|
+
refund = _a.sent();
|
|
92
|
+
t.truthy(refund);
|
|
93
|
+
t.is(refund.responseCode, "00", refund.responseMessage);
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}); });
|
|
98
|
+
test("reverse by card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
99
|
+
var response, reverse;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
t.plan(4);
|
|
104
|
+
return [4 /*yield*/, service
|
|
105
|
+
.charge(16)
|
|
106
|
+
.withCurrency("USD")
|
|
107
|
+
.withPaymentMethod(card)
|
|
108
|
+
.withAllowDuplicates(true)
|
|
109
|
+
.execute()];
|
|
110
|
+
case 1:
|
|
111
|
+
response = _a.sent();
|
|
112
|
+
t.truthy(response);
|
|
113
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
114
|
+
return [4 /*yield*/, service
|
|
115
|
+
.reverse(16)
|
|
116
|
+
.withCurrency("USD")
|
|
117
|
+
.withPaymentMethod(card)
|
|
118
|
+
.execute()];
|
|
119
|
+
case 2:
|
|
120
|
+
reverse = _a.sent();
|
|
121
|
+
t.truthy(reverse);
|
|
122
|
+
t.is(reverse.responseCode, "00", reverse.responseMessage);
|
|
123
|
+
return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}); });
|
|
127
|
+
test("reverse by transaction id fails", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
+
var response, error;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
t.plan(4);
|
|
133
|
+
return [4 /*yield*/, service
|
|
134
|
+
.charge(17)
|
|
135
|
+
.withCurrency("USD")
|
|
136
|
+
.withPaymentMethod(card)
|
|
137
|
+
.withAllowDuplicates(true)
|
|
138
|
+
.execute()];
|
|
139
|
+
case 1:
|
|
140
|
+
response = _a.sent();
|
|
141
|
+
t.truthy(response);
|
|
142
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
143
|
+
error = t.throws(function () {
|
|
144
|
+
service
|
|
145
|
+
.reverse(17)
|
|
146
|
+
.withCurrency("USD")
|
|
147
|
+
.withTransactionId(response.transactionId)
|
|
148
|
+
.execute();
|
|
149
|
+
}, src_1.UnsupportedTransactionError);
|
|
150
|
+
t.truthy(error.message);
|
|
151
|
+
return [2 /*return*/];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ava_1 = require("ava");
|
|
40
|
+
var src_1 = require("../../../src/");
|
|
41
|
+
var Data_1 = require("../../Data");
|
|
42
|
+
var config = new src_1.ServicesConfig();
|
|
43
|
+
config.secretApiKey = "skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
|
|
44
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
45
|
+
var service = new src_1.EBTService(config);
|
|
46
|
+
var runSerially = false;
|
|
47
|
+
var test = runSerially ? ava_1.default.serial : ava_1.default;
|
|
48
|
+
var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
|
|
49
|
+
test("balance inquiry", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var response;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
t.plan(2);
|
|
55
|
+
return [4 /*yield*/, service
|
|
56
|
+
.balanceInquiry()
|
|
57
|
+
.withPaymentMethod(card)
|
|
58
|
+
.execute()];
|
|
59
|
+
case 1:
|
|
60
|
+
response = _a.sent();
|
|
61
|
+
t.truthy(response);
|
|
62
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); });
|
|
67
|
+
test("benefits withdrawal", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var response;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
t.plan(2);
|
|
73
|
+
return [4 /*yield*/, service
|
|
74
|
+
.benefitWithdrawal(10)
|
|
75
|
+
.withCurrency("USD")
|
|
76
|
+
.withPaymentMethod(card)
|
|
77
|
+
.withAllowDuplicates(true)
|
|
78
|
+
.execute()];
|
|
79
|
+
case 1:
|
|
80
|
+
response = _a.sent();
|
|
81
|
+
t.truthy(response);
|
|
82
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
83
|
+
return [2 /*return*/];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); });
|
|
87
|
+
test("sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
var response;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
t.plan(2);
|
|
93
|
+
return [4 /*yield*/, service
|
|
94
|
+
.charge(11)
|
|
95
|
+
.withCurrency("USD")
|
|
96
|
+
.withPaymentMethod(card)
|
|
97
|
+
.withAllowDuplicates(true)
|
|
98
|
+
.execute()];
|
|
99
|
+
case 1:
|
|
100
|
+
response = _a.sent();
|
|
101
|
+
t.truthy(response);
|
|
102
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
103
|
+
return [2 /*return*/];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}); });
|
|
107
|
+
test("refund by card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
+
var response, refund;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
t.plan(4);
|
|
113
|
+
return [4 /*yield*/, service
|
|
114
|
+
.charge(12)
|
|
115
|
+
.withCurrency("USD")
|
|
116
|
+
.withPaymentMethod(card)
|
|
117
|
+
.withAllowDuplicates(true)
|
|
118
|
+
.execute()];
|
|
119
|
+
case 1:
|
|
120
|
+
response = _a.sent();
|
|
121
|
+
t.truthy(response);
|
|
122
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
123
|
+
return [4 /*yield*/, service
|
|
124
|
+
.refund(12)
|
|
125
|
+
.withCurrency("USD")
|
|
126
|
+
.withPaymentMethod(card)
|
|
127
|
+
.execute()];
|
|
128
|
+
case 2:
|
|
129
|
+
refund = _a.sent();
|
|
130
|
+
t.truthy(refund);
|
|
131
|
+
t.is(refund.responseCode, "00", refund.responseMessage);
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ava_1 = require("ava");
|
|
40
|
+
var src_1 = require("../../../../src/");
|
|
41
|
+
var config = new src_1.ServicesConfig();
|
|
42
|
+
config.secretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w";
|
|
43
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
44
|
+
var card = new src_1.CreditCardData();
|
|
45
|
+
card.number = "4111111111111111";
|
|
46
|
+
card.expMonth = "12";
|
|
47
|
+
card.expYear = "2025";
|
|
48
|
+
card.cvn = "123";
|
|
49
|
+
card.cardHolderName = "Joe Smith";
|
|
50
|
+
ava_1.default.before(function (_t) {
|
|
51
|
+
src_1.ServicesContainer.configure(config);
|
|
52
|
+
});
|
|
53
|
+
ava_1.default("credit auth no amount", function (t) {
|
|
54
|
+
t.plan(3);
|
|
55
|
+
var error = t.throws(function () {
|
|
56
|
+
return card.authorize().execute();
|
|
57
|
+
}, src_1.ArgumentError);
|
|
58
|
+
t.is(error.name, "ArgumentError");
|
|
59
|
+
t.true(-1 !== error.message.indexOf("amount cannot be null"));
|
|
60
|
+
});
|
|
61
|
+
ava_1.default("credit auth no currency", function (t) {
|
|
62
|
+
t.plan(3);
|
|
63
|
+
var error = t.throws(function () {
|
|
64
|
+
return card.authorize(14).execute();
|
|
65
|
+
}, src_1.ArgumentError);
|
|
66
|
+
t.is(error.name, "ArgumentError");
|
|
67
|
+
t.true(-1 !== error.message.indexOf("currency cannot be null"));
|
|
68
|
+
});
|
|
69
|
+
ava_1.default("credit sale no amount", function (t) {
|
|
70
|
+
t.plan(3);
|
|
71
|
+
var error = t.throws(function () {
|
|
72
|
+
return card.charge().execute();
|
|
73
|
+
}, src_1.ArgumentError);
|
|
74
|
+
t.is(error.name, "ArgumentError");
|
|
75
|
+
t.true(-1 !== error.message.indexOf("amount cannot be null"));
|
|
76
|
+
});
|
|
77
|
+
ava_1.default("credit sale no currency", function (t) {
|
|
78
|
+
t.plan(3);
|
|
79
|
+
var error = t.throws(function () {
|
|
80
|
+
return card.charge(14).execute();
|
|
81
|
+
}, src_1.ArgumentError);
|
|
82
|
+
t.is(error.name, "ArgumentError");
|
|
83
|
+
t.true(-1 !== error.message.indexOf("currency cannot be null"));
|
|
84
|
+
});
|
|
85
|
+
ava_1.default("credit sale no payment method", function (t) {
|
|
86
|
+
t.plan(3);
|
|
87
|
+
var error = t.throws(function () {
|
|
88
|
+
return card
|
|
89
|
+
.charge(14)
|
|
90
|
+
.withCurrency("USD")
|
|
91
|
+
.withPaymentMethod({})
|
|
92
|
+
.execute();
|
|
93
|
+
}, src_1.UnsupportedTransactionError);
|
|
94
|
+
t.is(error.name, "UnsupportedTransactionError");
|
|
95
|
+
t.true(-1 !== error.message.indexOf("not supported for this payment method"));
|
|
96
|
+
});
|
|
97
|
+
ava_1.default("credit offline no amount", function (t) {
|
|
98
|
+
t.plan(3);
|
|
99
|
+
var error = t.throws(function () {
|
|
100
|
+
return card
|
|
101
|
+
.charge()
|
|
102
|
+
.withOfflineAuthCode("123456")
|
|
103
|
+
.execute();
|
|
104
|
+
}, src_1.ArgumentError);
|
|
105
|
+
t.is(error.name, "ArgumentError");
|
|
106
|
+
t.true(-1 !== error.message.indexOf("amount cannot be null"));
|
|
107
|
+
});
|
|
108
|
+
ava_1.default("credit offline no currency", function (t) {
|
|
109
|
+
t.plan(3);
|
|
110
|
+
var error = t.throws(function () {
|
|
111
|
+
return card
|
|
112
|
+
.charge(14)
|
|
113
|
+
.withOfflineAuthCode("123456")
|
|
114
|
+
.execute();
|
|
115
|
+
}, src_1.ArgumentError);
|
|
116
|
+
t.is(error.name, "ArgumentError");
|
|
117
|
+
t.true(-1 !== error.message.indexOf("currency cannot be null"));
|
|
118
|
+
});
|
|
119
|
+
ava_1.default("credit offline no auth code", function (t) {
|
|
120
|
+
t.plan(3);
|
|
121
|
+
var error = t.throws(function () {
|
|
122
|
+
return card
|
|
123
|
+
.charge(14)
|
|
124
|
+
.withCurrency("USD")
|
|
125
|
+
.withOfflineAuthCode("")
|
|
126
|
+
.execute();
|
|
127
|
+
}, src_1.ArgumentError);
|
|
128
|
+
t.is(error.name, "ArgumentError");
|
|
129
|
+
t.true(-1 !== error.message.indexOf("offlineAuthCode cannot be empty"));
|
|
130
|
+
});
|
|
131
|
+
ava_1.default("gift replace no replacement card", function (t) {
|
|
132
|
+
t.plan(3);
|
|
133
|
+
var error = t.throws(function () {
|
|
134
|
+
var gift = new src_1.GiftCard();
|
|
135
|
+
gift.alias = "1234567890";
|
|
136
|
+
return gift.replaceWith(undefined).execute();
|
|
137
|
+
}, src_1.ArgumentError);
|
|
138
|
+
t.is(error.name, "ArgumentError");
|
|
139
|
+
t.true(-1 !== error.message.indexOf("replacementCard cannot be null"));
|
|
140
|
+
});
|
|
141
|
+
ava_1.default("check sale no address", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
142
|
+
var error;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
t.plan(3);
|
|
147
|
+
return [4 /*yield*/, t.throws(function () {
|
|
148
|
+
var check = new src_1.ECheck();
|
|
149
|
+
return check
|
|
150
|
+
.charge(14)
|
|
151
|
+
.withCurrency("USD")
|
|
152
|
+
.execute();
|
|
153
|
+
}, src_1.ArgumentError)];
|
|
154
|
+
case 1:
|
|
155
|
+
error = _a.sent();
|
|
156
|
+
t.is(error.name, "ArgumentError");
|
|
157
|
+
t.true(-1 !== error.message.indexOf("billingAddress cannot be null"));
|
|
158
|
+
return [2 /*return*/];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ava_1 = require("ava");
|
|
40
|
+
var src_1 = require("../../../../src/");
|
|
41
|
+
var config = new src_1.ServicesConfig();
|
|
42
|
+
config.secretApiKey = "skapi_cert_MTeSAQAfG1UA9qQDrzl-kz4toXvARyieptFwSKP24w";
|
|
43
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
44
|
+
ava_1.default.before(function (_t) {
|
|
45
|
+
src_1.ServicesContainer.configure(config);
|
|
46
|
+
});
|
|
47
|
+
ava_1.default("report transaction details no transaction id", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
var error;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
t.plan(3);
|
|
53
|
+
return [4 /*yield*/, t.throws(function () {
|
|
54
|
+
return src_1.ReportingService.transactionDetail("").execute();
|
|
55
|
+
}, src_1.ArgumentError)];
|
|
56
|
+
case 1:
|
|
57
|
+
error = _a.sent();
|
|
58
|
+
t.is(error.name, "ArgumentError");
|
|
59
|
+
t.true(-1 !== error.message.indexOf("transactionId cannot be empty"));
|
|
60
|
+
return [2 /*return*/];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}); });
|
|
64
|
+
ava_1.default("report transaction details with device id", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
var error;
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
t.plan(3);
|
|
70
|
+
return [4 /*yield*/, t.throws(function () {
|
|
71
|
+
return src_1.ReportingService.transactionDetail("1234567890")
|
|
72
|
+
.withDeviceId("123456")
|
|
73
|
+
.execute();
|
|
74
|
+
}, src_1.ArgumentError)];
|
|
75
|
+
case 1:
|
|
76
|
+
error = _a.sent();
|
|
77
|
+
t.is(error.name, "ArgumentError");
|
|
78
|
+
t.true(-1 !== error.message.indexOf("deviceId cannot be set"));
|
|
79
|
+
return [2 /*return*/];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); });
|
|
83
|
+
ava_1.default("report transaction details with start date", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
+
var error;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
t.plan(3);
|
|
89
|
+
return [4 /*yield*/, t.throws(function () {
|
|
90
|
+
return src_1.ReportingService.transactionDetail("1234567890")
|
|
91
|
+
.withStartDate(new Date())
|
|
92
|
+
.execute();
|
|
93
|
+
}, src_1.ArgumentError)];
|
|
94
|
+
case 1:
|
|
95
|
+
error = _a.sent();
|
|
96
|
+
t.is(error.name, "ArgumentError");
|
|
97
|
+
t.true(-1 !== error.message.indexOf("startDate cannot be set"));
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}); });
|
|
102
|
+
ava_1.default("report transaction details with end date", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
+
var error;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
t.plan(3);
|
|
108
|
+
return [4 /*yield*/, t.throws(function () {
|
|
109
|
+
return src_1.ReportingService.transactionDetail("1234567890")
|
|
110
|
+
.withEndDate(new Date())
|
|
111
|
+
.execute();
|
|
112
|
+
}, src_1.ArgumentError)];
|
|
113
|
+
case 1:
|
|
114
|
+
error = _a.sent();
|
|
115
|
+
t.is(error.name, "ArgumentError");
|
|
116
|
+
t.true(-1 !== error.message.indexOf("endDate cannot be set"));
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}); });
|
|
121
|
+
ava_1.default("report activity with transaction id", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
122
|
+
var error;
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
switch (_a.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
t.plan(3);
|
|
127
|
+
return [4 /*yield*/, t.throws(function () {
|
|
128
|
+
return src_1.ReportingService.activity()
|
|
129
|
+
.withTransactionId("1234567890")
|
|
130
|
+
.execute();
|
|
131
|
+
}, src_1.ArgumentError)];
|
|
132
|
+
case 1:
|
|
133
|
+
error = _a.sent();
|
|
134
|
+
t.is(error.name, "ArgumentError");
|
|
135
|
+
t.true(-1 !== error.message.indexOf("transactionId cannot be set"));
|
|
136
|
+
return [2 /*return*/];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|