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,263 @@
|
|
|
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.merchantId = "heartlandgpsandbox";
|
|
43
|
+
config.accountId = "api";
|
|
44
|
+
config.sharedSecret = "secret";
|
|
45
|
+
config.rebatePassword = "rebate";
|
|
46
|
+
config.refundPassword = "refund";
|
|
47
|
+
config.serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi";
|
|
48
|
+
var test = ava_1.default.serial;
|
|
49
|
+
var card = new src_1.CreditCardData();
|
|
50
|
+
card.number = "4263970000005262";
|
|
51
|
+
card.expMonth = "5";
|
|
52
|
+
card.expYear = "2019";
|
|
53
|
+
card.cardHolderName = "James Mason";
|
|
54
|
+
var customerId = src_1.GenerationUtils.generateTimestamp() + "-Realex";
|
|
55
|
+
var paymentId = function (t) {
|
|
56
|
+
return src_1.GenerationUtils.generateTimestamp() + "-Realex-" + t;
|
|
57
|
+
};
|
|
58
|
+
var customer = new src_1.Customer();
|
|
59
|
+
customer.key = customerId;
|
|
60
|
+
customer.title = "Mr.";
|
|
61
|
+
customer.firstName = "James";
|
|
62
|
+
customer.lastName = "Mason";
|
|
63
|
+
customer.company = "Realex Payments";
|
|
64
|
+
customer.address = new src_1.Address();
|
|
65
|
+
customer.address.streetAddress1 = "Flat 123";
|
|
66
|
+
customer.address.streetAddress2 = "House 456";
|
|
67
|
+
customer.address.streetAddress3 = "The Cul-De-Sac";
|
|
68
|
+
customer.address.city = "Halifax";
|
|
69
|
+
customer.address.province = "West Yorkshire";
|
|
70
|
+
customer.address.postalCode = "W6 9HR";
|
|
71
|
+
customer.address.country = "United Kingdom";
|
|
72
|
+
customer.homePhone = "+35312345678";
|
|
73
|
+
customer.workPhone = "+3531987654321";
|
|
74
|
+
customer.fax = "+124546871258";
|
|
75
|
+
customer.mobilePhone = "+25544778544";
|
|
76
|
+
customer.email = "text@example.com";
|
|
77
|
+
customer.comments = "Campaign Ref E7373G";
|
|
78
|
+
test.before(function (_t) {
|
|
79
|
+
src_1.ServicesContainer.configure(config);
|
|
80
|
+
});
|
|
81
|
+
test("001a - create customer", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var newCustomer, e_1;
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0:
|
|
86
|
+
t.plan(1);
|
|
87
|
+
_a.label = 1;
|
|
88
|
+
case 1:
|
|
89
|
+
_a.trys.push([1, 3, , 4]);
|
|
90
|
+
return [4 /*yield*/, customer.create()];
|
|
91
|
+
case 2:
|
|
92
|
+
newCustomer = _a.sent();
|
|
93
|
+
t.truthy(newCustomer);
|
|
94
|
+
return [3 /*break*/, 4];
|
|
95
|
+
case 3:
|
|
96
|
+
e_1 = _a.sent();
|
|
97
|
+
console.log(e_1);
|
|
98
|
+
if (e_1.responseCode !== "520") {
|
|
99
|
+
t.fail(e_1.message);
|
|
100
|
+
}
|
|
101
|
+
return [3 /*break*/, 4];
|
|
102
|
+
case 4: return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); });
|
|
106
|
+
test("001b - create payment method", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
+
var paymentMethod, e_2;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
t.plan(1);
|
|
112
|
+
_a.label = 1;
|
|
113
|
+
case 1:
|
|
114
|
+
_a.trys.push([1, 3, , 4]);
|
|
115
|
+
return [4 /*yield*/, customer.addPaymentMethod(paymentId("Credit"), card)];
|
|
116
|
+
case 2:
|
|
117
|
+
paymentMethod = _a.sent();
|
|
118
|
+
t.truthy(paymentMethod);
|
|
119
|
+
return [3 /*break*/, 4];
|
|
120
|
+
case 3:
|
|
121
|
+
e_2 = _a.sent();
|
|
122
|
+
if (e_2.responseCode !== "520") {
|
|
123
|
+
t.fail(e_2.message);
|
|
124
|
+
}
|
|
125
|
+
return [3 /*break*/, 4];
|
|
126
|
+
case 4: return [2 /*return*/];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}); });
|
|
130
|
+
test("002a - edit customer from id", function (_t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
+
var editCustomer;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0:
|
|
135
|
+
editCustomer = new src_1.Customer();
|
|
136
|
+
editCustomer.key = customerId;
|
|
137
|
+
return [4 /*yield*/, customer.saveChanges()];
|
|
138
|
+
case 1:
|
|
139
|
+
_a.sent();
|
|
140
|
+
return [2 /*return*/];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}); });
|
|
144
|
+
test("002b - edit payment method from id", function (_t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
+
var newCard, paymentMethod;
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
switch (_a.label) {
|
|
148
|
+
case 0:
|
|
149
|
+
newCard = new src_1.CreditCardData();
|
|
150
|
+
newCard.number = "5425230000004415";
|
|
151
|
+
newCard.expMonth = "10";
|
|
152
|
+
newCard.expYear = "2020";
|
|
153
|
+
newCard.cardHolderName = "Philip Marlowe";
|
|
154
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
155
|
+
paymentMethod.paymentMethod = newCard;
|
|
156
|
+
return [4 /*yield*/, paymentMethod.saveChanges()];
|
|
157
|
+
case 1:
|
|
158
|
+
_a.sent();
|
|
159
|
+
return [2 /*return*/];
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}); });
|
|
163
|
+
test("003 - find", function (_t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
switch (_a.label) {
|
|
166
|
+
case 0: return [4 /*yield*/, src_1.Customer.find(customerId)];
|
|
167
|
+
case 1:
|
|
168
|
+
_a.sent();
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}); });
|
|
173
|
+
test("004a - charge stored card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
var paymentMethod, response;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
t.plan(2);
|
|
179
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
180
|
+
return [4 /*yield*/, paymentMethod
|
|
181
|
+
.charge(10)
|
|
182
|
+
.withCurrency("USD")
|
|
183
|
+
.withCvn("123")
|
|
184
|
+
.execute()];
|
|
185
|
+
case 1:
|
|
186
|
+
response = _a.sent();
|
|
187
|
+
t.truthy(response);
|
|
188
|
+
t.is(response.responseCode, "00");
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}); });
|
|
193
|
+
test("004b - verify stored card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
+
var paymentMethod, response;
|
|
195
|
+
return __generator(this, function (_a) {
|
|
196
|
+
switch (_a.label) {
|
|
197
|
+
case 0:
|
|
198
|
+
t.plan(2);
|
|
199
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
200
|
+
return [4 /*yield*/, paymentMethod
|
|
201
|
+
.verify()
|
|
202
|
+
.withCvn("123")
|
|
203
|
+
.execute()];
|
|
204
|
+
case 1:
|
|
205
|
+
response = _a.sent();
|
|
206
|
+
t.truthy(response);
|
|
207
|
+
t.is(response.responseCode, "00");
|
|
208
|
+
return [2 /*return*/];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}); });
|
|
212
|
+
test("004c - refund stored card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
213
|
+
var paymentMethod, response;
|
|
214
|
+
return __generator(this, function (_a) {
|
|
215
|
+
switch (_a.label) {
|
|
216
|
+
case 0:
|
|
217
|
+
t.plan(2);
|
|
218
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
219
|
+
return [4 /*yield*/, paymentMethod
|
|
220
|
+
.refund(10.01)
|
|
221
|
+
.withCurrency("USD")
|
|
222
|
+
.execute()];
|
|
223
|
+
case 1:
|
|
224
|
+
response = _a.sent();
|
|
225
|
+
t.truthy(response);
|
|
226
|
+
t.is(response.responseCode, "00");
|
|
227
|
+
return [2 /*return*/];
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}); });
|
|
231
|
+
test("005 - delete payment method", function (_t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
|
+
var paymentMethod;
|
|
233
|
+
return __generator(this, function (_a) {
|
|
234
|
+
switch (_a.label) {
|
|
235
|
+
case 0:
|
|
236
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
237
|
+
return [4 /*yield*/, paymentMethod.delete()];
|
|
238
|
+
case 1:
|
|
239
|
+
_a.sent();
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}); });
|
|
244
|
+
test("006 - recurring payment", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
245
|
+
var paymentMethod, response;
|
|
246
|
+
return __generator(this, function (_a) {
|
|
247
|
+
switch (_a.label) {
|
|
248
|
+
case 0:
|
|
249
|
+
t.plan(2);
|
|
250
|
+
paymentMethod = new src_1.RecurringPaymentMethod(customerId, paymentId("Credit"));
|
|
251
|
+
return [4 /*yield*/, paymentMethod
|
|
252
|
+
.charge(12)
|
|
253
|
+
.withRecurringInfo(src_1.RecurringType.Fixed, src_1.RecurringSequence.First)
|
|
254
|
+
.withCurrency("USD")
|
|
255
|
+
.execute()];
|
|
256
|
+
case 1:
|
|
257
|
+
response = _a.sent();
|
|
258
|
+
t.truthy(response);
|
|
259
|
+
t.is(response.responseCode, "00");
|
|
260
|
+
return [2 /*return*/];
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
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_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A";
|
|
44
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
45
|
+
var service = new src_1.CheckService(config);
|
|
46
|
+
var runSerially = false;
|
|
47
|
+
var test = runSerially ? ava_1.default.serial : ava_1.default;
|
|
48
|
+
var check = Data_1.TestChecks.certification();
|
|
49
|
+
var address = new src_1.Address();
|
|
50
|
+
address.streetAddress1 = "123 Main St.";
|
|
51
|
+
address.city = "Downtown";
|
|
52
|
+
address.state = "NJ";
|
|
53
|
+
address.postalCode = "12345";
|
|
54
|
+
test("sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var response;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
t.plan(2);
|
|
60
|
+
return [4 /*yield*/, service
|
|
61
|
+
.charge(10)
|
|
62
|
+
.withCurrency("USD")
|
|
63
|
+
.withPaymentMethod(check)
|
|
64
|
+
.withAddress(address)
|
|
65
|
+
.execute()];
|
|
66
|
+
case 1:
|
|
67
|
+
response = _a.sent();
|
|
68
|
+
t.truthy(response);
|
|
69
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); });
|
|
74
|
+
test("void", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var response, voidResponse;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
t.plan(4);
|
|
80
|
+
return [4 /*yield*/, service
|
|
81
|
+
.charge(10)
|
|
82
|
+
.withCurrency("USD")
|
|
83
|
+
.withPaymentMethod(check)
|
|
84
|
+
.withAddress(address)
|
|
85
|
+
.execute()];
|
|
86
|
+
case 1:
|
|
87
|
+
response = _a.sent();
|
|
88
|
+
t.truthy(response);
|
|
89
|
+
t.is(response.responseCode, "00", response.responseMessage);
|
|
90
|
+
return [4 /*yield*/, service.void(response.transactionId).execute()];
|
|
91
|
+
case 2:
|
|
92
|
+
voidResponse = _a.sent();
|
|
93
|
+
t.truthy(voidResponse);
|
|
94
|
+
t.is(voidResponse.responseCode, "00", voidResponse.responseMessage);
|
|
95
|
+
return [2 /*return*/];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,313 @@
|
|
|
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_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A";
|
|
44
|
+
config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
|
|
45
|
+
var service = new src_1.CreditService(config);
|
|
46
|
+
var runSerially = false;
|
|
47
|
+
var test = runSerially ? ava_1.default.serial : ava_1.default;
|
|
48
|
+
var card = Data_1.TestCards.visaManual();
|
|
49
|
+
test("auth capture", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var response, capture;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
t.plan(4);
|
|
55
|
+
return [4 /*yield*/, service
|
|
56
|
+
.authorize(10)
|
|
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");
|
|
65
|
+
return [4 /*yield*/, service.capture(response.transactionId).execute()];
|
|
66
|
+
case 2:
|
|
67
|
+
capture = _a.sent();
|
|
68
|
+
t.truthy(capture);
|
|
69
|
+
t.is(capture.responseCode, "00");
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); });
|
|
74
|
+
test("sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var response;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
t.plan(2);
|
|
80
|
+
return [4 /*yield*/, service
|
|
81
|
+
.charge(11.01)
|
|
82
|
+
.withCurrency("USD")
|
|
83
|
+
.withPaymentMethod(card)
|
|
84
|
+
.withAllowDuplicates(true)
|
|
85
|
+
.execute()];
|
|
86
|
+
case 1:
|
|
87
|
+
response = _a.sent();
|
|
88
|
+
t.truthy(response);
|
|
89
|
+
t.is(response.responseCode, "00");
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}); });
|
|
94
|
+
test("edit", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
var response, edit;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
t.plan(4);
|
|
100
|
+
return [4 /*yield*/, service
|
|
101
|
+
.charge(12)
|
|
102
|
+
.withCurrency("USD")
|
|
103
|
+
.withPaymentMethod(card)
|
|
104
|
+
.withAllowDuplicates(true)
|
|
105
|
+
.execute()];
|
|
106
|
+
case 1:
|
|
107
|
+
response = _a.sent();
|
|
108
|
+
t.truthy(response);
|
|
109
|
+
t.is(response.responseCode, "00");
|
|
110
|
+
return [4 /*yield*/, service
|
|
111
|
+
.edit(response.transactionId)
|
|
112
|
+
.withAmount(14)
|
|
113
|
+
.withGratuity(2)
|
|
114
|
+
.execute()];
|
|
115
|
+
case 2:
|
|
116
|
+
edit = _a.sent();
|
|
117
|
+
t.truthy(edit);
|
|
118
|
+
t.is(edit.responseCode, "00");
|
|
119
|
+
return [2 /*return*/];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}); });
|
|
123
|
+
test("commercial edit", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var response, edit;
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
switch (_a.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
t.plan(4);
|
|
129
|
+
return [4 /*yield*/, service
|
|
130
|
+
.charge(13)
|
|
131
|
+
.withCurrency("USD")
|
|
132
|
+
.withPaymentMethod(card)
|
|
133
|
+
.withCommercialRequest(true)
|
|
134
|
+
.withAllowDuplicates(true)
|
|
135
|
+
.execute()];
|
|
136
|
+
case 1:
|
|
137
|
+
response = _a.sent();
|
|
138
|
+
t.truthy(response);
|
|
139
|
+
t.is(response.responseCode, "00");
|
|
140
|
+
return [4 /*yield*/, service
|
|
141
|
+
.edit(response.transactionId)
|
|
142
|
+
.withTaxType(src_1.TaxType.SalesTax)
|
|
143
|
+
.withTaxAmount(1)
|
|
144
|
+
.execute()];
|
|
145
|
+
case 2:
|
|
146
|
+
edit = _a.sent();
|
|
147
|
+
t.truthy(edit);
|
|
148
|
+
t.is(edit.responseCode, "00");
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); });
|
|
153
|
+
test("refund by card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var response, refund;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
t.plan(4);
|
|
159
|
+
return [4 /*yield*/, service
|
|
160
|
+
.charge(14)
|
|
161
|
+
.withCurrency("USD")
|
|
162
|
+
.withPaymentMethod(card)
|
|
163
|
+
.withAllowDuplicates(true)
|
|
164
|
+
.execute()];
|
|
165
|
+
case 1:
|
|
166
|
+
response = _a.sent();
|
|
167
|
+
t.truthy(response);
|
|
168
|
+
t.is(response.responseCode, "00");
|
|
169
|
+
return [4 /*yield*/, service
|
|
170
|
+
.refund(14)
|
|
171
|
+
.withCurrency("USD")
|
|
172
|
+
.withPaymentMethod(card)
|
|
173
|
+
.execute()];
|
|
174
|
+
case 2:
|
|
175
|
+
refund = _a.sent();
|
|
176
|
+
t.truthy(refund);
|
|
177
|
+
t.is(refund.responseCode, "00");
|
|
178
|
+
return [2 /*return*/];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}); });
|
|
182
|
+
test("refund by transaction ID", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
183
|
+
var response, refund;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
t.plan(4);
|
|
188
|
+
return [4 /*yield*/, service
|
|
189
|
+
.charge(15)
|
|
190
|
+
.withCurrency("USD")
|
|
191
|
+
.withPaymentMethod(card)
|
|
192
|
+
.withAllowDuplicates(true)
|
|
193
|
+
.execute()];
|
|
194
|
+
case 1:
|
|
195
|
+
response = _a.sent();
|
|
196
|
+
t.truthy(response);
|
|
197
|
+
t.is(response.responseCode, "00");
|
|
198
|
+
return [4 /*yield*/, service
|
|
199
|
+
.refund(15)
|
|
200
|
+
.withCurrency("USD")
|
|
201
|
+
.withTransactionId(response.transactionId)
|
|
202
|
+
.execute()];
|
|
203
|
+
case 2:
|
|
204
|
+
refund = _a.sent();
|
|
205
|
+
t.truthy(refund);
|
|
206
|
+
t.is(refund.responseCode, "00");
|
|
207
|
+
return [2 /*return*/];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}); });
|
|
211
|
+
test("reverse by card", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
|
+
var response, reverse;
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
215
|
+
case 0:
|
|
216
|
+
t.plan(4);
|
|
217
|
+
return [4 /*yield*/, service
|
|
218
|
+
.charge(16)
|
|
219
|
+
.withCurrency("USD")
|
|
220
|
+
.withPaymentMethod(card)
|
|
221
|
+
.withAllowDuplicates(true)
|
|
222
|
+
.execute()];
|
|
223
|
+
case 1:
|
|
224
|
+
response = _a.sent();
|
|
225
|
+
t.truthy(response);
|
|
226
|
+
t.is(response.responseCode, "00");
|
|
227
|
+
return [4 /*yield*/, service
|
|
228
|
+
.reverse(16)
|
|
229
|
+
.withCurrency("USD")
|
|
230
|
+
.withPaymentMethod(card)
|
|
231
|
+
.execute()];
|
|
232
|
+
case 2:
|
|
233
|
+
reverse = _a.sent();
|
|
234
|
+
t.truthy(reverse);
|
|
235
|
+
t.is(reverse.responseCode, "00");
|
|
236
|
+
return [2 /*return*/];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}); });
|
|
240
|
+
test("reverse by transaction ID", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
241
|
+
var response, reverse;
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
switch (_a.label) {
|
|
244
|
+
case 0:
|
|
245
|
+
t.plan(4);
|
|
246
|
+
return [4 /*yield*/, service
|
|
247
|
+
.charge(17)
|
|
248
|
+
.withCurrency("USD")
|
|
249
|
+
.withPaymentMethod(card)
|
|
250
|
+
.withAllowDuplicates(true)
|
|
251
|
+
.execute()];
|
|
252
|
+
case 1:
|
|
253
|
+
response = _a.sent();
|
|
254
|
+
t.truthy(response);
|
|
255
|
+
t.is(response.responseCode, "00");
|
|
256
|
+
return [4 /*yield*/, service
|
|
257
|
+
.reverse(17)
|
|
258
|
+
.withCurrency("USD")
|
|
259
|
+
.withTransactionId(response.transactionId)
|
|
260
|
+
.execute()];
|
|
261
|
+
case 2:
|
|
262
|
+
reverse = _a.sent();
|
|
263
|
+
t.truthy(reverse);
|
|
264
|
+
t.is(reverse.responseCode, "00");
|
|
265
|
+
return [2 /*return*/];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}); });
|
|
269
|
+
test("verify", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
270
|
+
var response;
|
|
271
|
+
return __generator(this, function (_a) {
|
|
272
|
+
switch (_a.label) {
|
|
273
|
+
case 0:
|
|
274
|
+
t.plan(2);
|
|
275
|
+
return [4 /*yield*/, service
|
|
276
|
+
.verify()
|
|
277
|
+
.withCurrency("USD")
|
|
278
|
+
.withPaymentMethod(card)
|
|
279
|
+
.execute()];
|
|
280
|
+
case 1:
|
|
281
|
+
response = _a.sent();
|
|
282
|
+
t.truthy(response);
|
|
283
|
+
t.is(response.responseCode, "00");
|
|
284
|
+
return [2 /*return*/];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}); });
|
|
288
|
+
test("reverse by client transaction ID", function (t) { return __awaiter(void 0, void 0, void 0, function () {
|
|
289
|
+
var response, voidResponse;
|
|
290
|
+
return __generator(this, function (_a) {
|
|
291
|
+
switch (_a.label) {
|
|
292
|
+
case 0:
|
|
293
|
+
t.plan(4);
|
|
294
|
+
return [4 /*yield*/, service
|
|
295
|
+
.charge(19)
|
|
296
|
+
.withCurrency("USD")
|
|
297
|
+
.withPaymentMethod(card)
|
|
298
|
+
.withClientTransactionId("123456789")
|
|
299
|
+
.withAllowDuplicates(true)
|
|
300
|
+
.execute()];
|
|
301
|
+
case 1:
|
|
302
|
+
response = _a.sent();
|
|
303
|
+
t.truthy(response);
|
|
304
|
+
t.is(response.responseCode, "00");
|
|
305
|
+
return [4 /*yield*/, service.void(response.transactionId).execute()];
|
|
306
|
+
case 2:
|
|
307
|
+
voidResponse = _a.sent();
|
|
308
|
+
t.truthy(voidResponse);
|
|
309
|
+
t.is(voidResponse.responseCode, "00");
|
|
310
|
+
return [2 /*return*/];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}); });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|