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.
Files changed (112) hide show
  1. package/CHANGELOG.md +184 -177
  2. package/LICENSE.md +257 -257
  3. package/README.md +141 -141
  4. package/appsec.properties +8 -0
  5. package/lib/src/Gateways/PorticoConnector.js +24 -0
  6. package/lib/src/Gateways/PorticoConnector.js.map +1 -1
  7. package/lib/src/Gateways/RealexConnector.d.ts +30 -0
  8. package/lib/src/Gateways/RealexConnector.js +523 -0
  9. package/lib/src/PaymentMethods/Credit.d.ts +2 -1
  10. package/lib/src/PaymentMethods/Credit.js +1 -0
  11. package/lib/src/PaymentMethods/Credit.js.map +1 -1
  12. package/lib/src/ServicesConfig.d.ts +27 -0
  13. package/lib/src/ServicesConfig.js +50 -0
  14. package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js +15 -15
  15. package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js +5 -5
  16. package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js +4 -4
  17. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.d.ts +1 -0
  18. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +112 -0
  19. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +1 -0
  20. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +483 -0
  21. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +1 -0
  22. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +83 -0
  23. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +1 -0
  24. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +1720 -0
  25. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +1 -0
  26. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +83 -0
  27. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +1 -0
  28. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +1757 -0
  29. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +1 -0
  30. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +682 -0
  31. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +1 -0
  32. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +2218 -0
  33. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +32 -0
  34. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -1
  35. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +1 -0
  36. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +707 -0
  37. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +1 -0
  38. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +151 -0
  39. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +1 -0
  40. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +171 -0
  41. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +8 -8
  42. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +1 -0
  43. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +192 -0
  44. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +1 -0
  45. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +377 -0
  46. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +1 -0
  47. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +196 -0
  48. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +1 -0
  49. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +53 -0
  50. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.d.ts +1 -0
  51. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.js +100 -0
  52. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.d.ts +1 -0
  53. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.js +352 -0
  54. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.d.ts +1 -0
  55. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.js +123 -0
  56. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.d.ts +1 -0
  57. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.js +142 -0
  58. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.d.ts +1 -0
  59. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.js +100 -0
  60. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.d.ts +1 -0
  61. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.js +535 -0
  62. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.d.ts +1 -0
  63. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.js +124 -0
  64. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.d.ts +1 -0
  65. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.js +144 -0
  66. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.d.ts +1 -0
  67. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.js +4373 -0
  68. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.d.ts +1 -0
  69. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.js +758 -0
  70. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.d.ts +1 -0
  71. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.js +2399 -0
  72. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.d.ts +1 -0
  73. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.js +1656 -0
  74. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.d.ts +1 -0
  75. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.js +5650 -0
  76. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.d.ts +1 -0
  77. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.js +1985 -0
  78. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.d.ts +1 -0
  79. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.js +2369 -0
  80. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.d.ts +1 -0
  81. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.js +1703 -0
  82. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.d.ts +1 -0
  83. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.js +2053 -0
  84. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.d.ts +1 -0
  85. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.js +2469 -0
  86. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.d.ts +1 -0
  87. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.js +3116 -0
  88. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.d.ts +1 -0
  89. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.js +2031 -0
  90. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.d.ts +1 -0
  91. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.js +322 -0
  92. package/lib/test/Integration/Gateways/RealexConnector/HppTest.d.ts +1 -0
  93. package/lib/test/Integration/Gateways/RealexConnector/HppTest.js +98 -0
  94. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.d.ts +1 -0
  95. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.js +263 -0
  96. package/lib/test/Integration/Services/CheckServiceTest.d.ts +1 -0
  97. package/lib/test/Integration/Services/CheckServiceTest.js +98 -0
  98. package/lib/test/Integration/Services/CreditServiceTest.d.ts +1 -0
  99. package/lib/test/Integration/Services/CreditServiceTest.js +313 -0
  100. package/lib/test/Integration/Services/DebitServiceTest.d.ts +1 -0
  101. package/lib/test/Integration/Services/DebitServiceTest.js +154 -0
  102. package/lib/test/Integration/Services/EBTServiceTest.d.ts +1 -0
  103. package/lib/test/Integration/Services/EBTServiceTest.js +135 -0
  104. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +1 -0
  105. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +161 -0
  106. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +1 -0
  107. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +139 -0
  108. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +1 -0
  109. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +202 -0
  110. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.d.ts +1 -0
  111. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.js +29 -0
  112. package/package.json +62 -62
@@ -0,0 +1,151 @@
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_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
43
+ config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
44
+ var runSerially = false;
45
+ var test = runSerially ? ava_1.default.serial : ava_1.default;
46
+ var track = new src_1.DebitTrackData();
47
+ // tslint:disable:max-line-length
48
+ track.value =
49
+ "&lt;E1050711%B4012001000000016^VI TEST CREDIT^251200000000000000000000?|LO04K0WFOmdkDz0um+GwUkILL8ZZOP6Zc4rCpZ9+kg2T3JBT4AEOilWTI|+++++++Dbbn04ekG|11;4012001000000016=25120000000000000000?|1u2F/aEhbdoPixyAPGyIDv3gBfF|+++++++Dbbn04ekG|00|||/wECAQECAoFGAgEH2wYcShV78RZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0PX50qfj4dt0lu9oFBESQQNkpoxEVpCW3ZKmoIV3T93zphPS3XKP4+DiVlM8VIOOmAuRrpzxNi0TN/DWXWSjUC8m/PI2dACGdl/hVJ/imfqIs68wYDnp8j0ZfgvM26MlnDbTVRrSx68Nzj2QAgpBCHcaBb/FZm9T7pfMr2Mlh2YcAt6gGG1i2bJgiEJn8IiSDX5M2ybzqRT86PCbKle/XCTwFFe1X|&gt;";
50
+ // tslint:enable:max-line-length
51
+ track.pinBlock = "32539F50C245A6A93D123412324000AA";
52
+ track.encryptionData = new src_1.EncryptionData();
53
+ track.encryptionData.version = "01";
54
+ ava_1.default.before(function (_t) {
55
+ src_1.ServicesContainer.configure(config);
56
+ });
57
+ test("debit sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
58
+ var response;
59
+ return __generator(this, function (_a) {
60
+ switch (_a.label) {
61
+ case 0:
62
+ t.plan(2);
63
+ return [4 /*yield*/, track
64
+ .charge(17.01)
65
+ .withCurrency("USD")
66
+ .withAllowDuplicates(true)
67
+ .execute()];
68
+ case 1:
69
+ response = _a.sent();
70
+ t.truthy(response);
71
+ t.is(response.responseCode, "00", response.responseMessage);
72
+ return [2 /*return*/];
73
+ }
74
+ });
75
+ }); });
76
+ test.failing("debit add value", function (t) { return __awaiter(void 0, void 0, void 0, function () {
77
+ var response;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ t.plan(2);
82
+ return [4 /*yield*/, track
83
+ .addValue(15.01)
84
+ .withCurrency("USD")
85
+ .withAllowDuplicates(true)
86
+ .execute()];
87
+ case 1:
88
+ response = _a.sent();
89
+ t.truthy(response);
90
+ t.is(response.responseCode, "00", response.responseMessage);
91
+ return [2 /*return*/];
92
+ }
93
+ });
94
+ }); });
95
+ test("debit refund", function (t) { return __awaiter(void 0, void 0, void 0, function () {
96
+ var response;
97
+ return __generator(this, function (_a) {
98
+ switch (_a.label) {
99
+ case 0:
100
+ t.plan(2);
101
+ return [4 /*yield*/, track
102
+ .refund(16.01)
103
+ .withCurrency("USD")
104
+ .withAllowDuplicates(true)
105
+ .execute()];
106
+ case 1:
107
+ response = _a.sent();
108
+ t.truthy(response);
109
+ t.is(response.responseCode, "00", response.responseMessage);
110
+ return [2 /*return*/];
111
+ }
112
+ });
113
+ }); });
114
+ test("debit reverse", function (t) { return __awaiter(void 0, void 0, void 0, function () {
115
+ var response;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ t.plan(2);
120
+ return [4 /*yield*/, track
121
+ .reverse(17.01)
122
+ .withCurrency("USD")
123
+ .withAllowDuplicates(true)
124
+ .execute()];
125
+ case 1:
126
+ response = _a.sent();
127
+ t.truthy(response);
128
+ t.is(response.responseCode, "00", response.responseMessage);
129
+ return [2 /*return*/];
130
+ }
131
+ });
132
+ }); });
133
+ test("debit cannot refund from transaction id only", function (t) {
134
+ t.plan(2);
135
+ var error = t.throws(function () {
136
+ src_1.Transaction.fromId("1234567890", src_1.PaymentMethodType.Debit)
137
+ .refund()
138
+ .withCurrency("USD")
139
+ .execute();
140
+ }, src_1.UnsupportedTransactionError);
141
+ t.truthy(error.message);
142
+ });
143
+ test("debit cannot reverse from transaction id only", function (t) {
144
+ t.plan(2);
145
+ var error = t.throws(function () {
146
+ src_1.Transaction.fromId("1234567890", src_1.PaymentMethodType.Debit)
147
+ .reverse()
148
+ .execute();
149
+ }, src_1.UnsupportedTransactionError);
150
+ t.truthy(error.message);
151
+ });
@@ -0,0 +1,171 @@
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_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
43
+ config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
44
+ var runSerially = false;
45
+ var test = runSerially ? ava_1.default.serial : ava_1.default;
46
+ var card = new src_1.EBTCardData();
47
+ card.number = "4012002000060016";
48
+ card.expMonth = "12";
49
+ card.expYear = "2025";
50
+ card.cvn = "123";
51
+ card.pinBlock = "32539F50C245A6A93D123412324000AA";
52
+ var track = new src_1.EBTTrackData();
53
+ track.value =
54
+ "%B4012002000060016^VI TEST CREDIT^251210118039000000000396?;4012002000060016=25121011803939600000?";
55
+ track.pinBlock = "32539F50C245A6A93D123412324000AA";
56
+ track.encryptionData = new src_1.EncryptionData();
57
+ track.encryptionData.version = "01";
58
+ ava_1.default.before(function (_t) {
59
+ src_1.ServicesContainer.configure(config);
60
+ });
61
+ test("ebt balance inquiry", function (t) { return __awaiter(void 0, void 0, void 0, function () {
62
+ var response;
63
+ return __generator(this, function (_a) {
64
+ switch (_a.label) {
65
+ case 0:
66
+ t.plan(2);
67
+ return [4 /*yield*/, card.balanceInquiry().execute()];
68
+ case 1:
69
+ response = _a.sent();
70
+ t.truthy(response);
71
+ t.is(response.responseCode, "00", response.responseMessage);
72
+ return [2 /*return*/];
73
+ }
74
+ });
75
+ }); });
76
+ test("ebt sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
77
+ var response;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ t.plan(2);
82
+ return [4 /*yield*/, card
83
+ .charge(10)
84
+ .withCurrency("USD")
85
+ .execute()];
86
+ case 1:
87
+ response = _a.sent();
88
+ t.truthy(response);
89
+ t.is(response.responseCode, "00", response.responseMessage);
90
+ return [2 /*return*/];
91
+ }
92
+ });
93
+ }); });
94
+ test("ebt refund", function (t) { return __awaiter(void 0, void 0, void 0, function () {
95
+ var response;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0:
99
+ t.plan(2);
100
+ return [4 /*yield*/, card
101
+ .refund(10)
102
+ .withCurrency("USD")
103
+ .execute()];
104
+ case 1:
105
+ response = _a.sent();
106
+ t.truthy(response);
107
+ t.is(response.responseCode, "00", response.responseMessage);
108
+ return [2 /*return*/];
109
+ }
110
+ });
111
+ }); });
112
+ test("ebt track balance inquiry", function (t) { return __awaiter(void 0, void 0, void 0, function () {
113
+ var response;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ t.plan(2);
118
+ return [4 /*yield*/, track.balanceInquiry().execute()];
119
+ case 1:
120
+ response = _a.sent();
121
+ t.truthy(response);
122
+ t.is(response.responseCode, "00", response.responseMessage);
123
+ return [2 /*return*/];
124
+ }
125
+ });
126
+ }); });
127
+ test("ebt track sale", function (t) { return __awaiter(void 0, void 0, void 0, function () {
128
+ var response;
129
+ return __generator(this, function (_a) {
130
+ switch (_a.label) {
131
+ case 0:
132
+ t.plan(2);
133
+ return [4 /*yield*/, track
134
+ .charge(11)
135
+ .withCurrency("USD")
136
+ .execute()];
137
+ case 1:
138
+ response = _a.sent();
139
+ t.truthy(response);
140
+ t.is(response.responseCode, "00", response.responseMessage);
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ }); });
145
+ test("ebt track refund", function (t) { return __awaiter(void 0, void 0, void 0, function () {
146
+ var response;
147
+ return __generator(this, function (_a) {
148
+ switch (_a.label) {
149
+ case 0:
150
+ t.plan(2);
151
+ return [4 /*yield*/, track
152
+ .refund(11)
153
+ .withCurrency("USD")
154
+ .execute()];
155
+ case 1:
156
+ response = _a.sent();
157
+ t.truthy(response);
158
+ t.is(response.responseCode, "00", response.responseMessage);
159
+ return [2 /*return*/];
160
+ }
161
+ });
162
+ }); });
163
+ test("ebt refund fails from transaction id only", function (t) {
164
+ t.plan(2);
165
+ var error = t.throws(function () {
166
+ src_1.Transaction.fromId("1234567890", src_1.PaymentMethodType.EBT)
167
+ .refund()
168
+ .execute();
169
+ }, src_1.UnsupportedTransactionError);
170
+ t.truthy(error.message);
171
+ });
@@ -78,14 +78,14 @@ test("ecom with secure ecommerce", async () => {
78
78
  test.skip("ecom with walletdata", async () => {
79
79
  card.mobileType = src_1.MobilePaymentMethodType.GOOGLEPAY;
80
80
  card.paymentSource = src_1.PaymentDataSourceType.GOOGLEPAYWEB;
81
- card.token = `{
82
- "signature": "MEQCICd1jRuaiWW5z9olPR+xBi6Z7CmW019Ys+EOKO2RIgy9AiA2d/hWKuRYtayJl//Cc1r2wifxv69lRrRHTTPbelKhzA==",
83
- "protocolVersion": "ECv1",
84
- "signedMessage": {
85
- "encryptedMessage": "wuSFSWEDYmECYdL57Glj1jtQ4hVN69cp82vsXyWN7Nw05ocSTqh6dYBb1FRboq1IjYhPf4MPOliBSJHugiHbeYilrT8HeXD+cU+rF9nNtucMFjMIFltik9aOSnpM0E8t9AJ60CFBwLebhHXvA53TlrziBTCQbhoVk2IAMO/tJKl1mI5rR+7sUI+BlIXFBcUba6T8eLz4z7wYwPxuBptP20u5C5QqMV5kY4aF6mCKwbLT5AzDLBiKA+eW9VtlP9icuxigYMOTP6wsrdiW7FMtHc0o3/MnBpZwWRpcponfnoNQnQMjOSiROZVHcHUK0i/lFUJg9p1Xi20qSyXIjq2WjCF7hSoDw1KzRnYO7uyx1yHN9vmLo+NqVfipRSpT7AtBt9CR8yHQftNQlady+VKSIhmigPTXVIapIf7CA27hiRysVGpWbrMZrJJYilFXh6eFPbk2",
86
- "ephemeralPublicKey": "BFe4YpEa1hfmaYlcWR4eyVxZmanOCzDak9yy90PCIAfIMeeRCT9zX5KAnj2k/vWa+oZIv1McjgBIKAp/BoWKNkM=",
87
- "tag": "IpXW8ECpNCLzN36M3S7nbQ1YnXxDeMx1RLwElW0xCg0="
88
- }
81
+ card.token = `{
82
+ "signature": "MEQCICd1jRuaiWW5z9olPR+xBi6Z7CmW019Ys+EOKO2RIgy9AiA2d/hWKuRYtayJl//Cc1r2wifxv69lRrRHTTPbelKhzA==",
83
+ "protocolVersion": "ECv1",
84
+ "signedMessage": {
85
+ "encryptedMessage": "wuSFSWEDYmECYdL57Glj1jtQ4hVN69cp82vsXyWN7Nw05ocSTqh6dYBb1FRboq1IjYhPf4MPOliBSJHugiHbeYilrT8HeXD+cU+rF9nNtucMFjMIFltik9aOSnpM0E8t9AJ60CFBwLebhHXvA53TlrziBTCQbhoVk2IAMO/tJKl1mI5rR+7sUI+BlIXFBcUba6T8eLz4z7wYwPxuBptP20u5C5QqMV5kY4aF6mCKwbLT5AzDLBiKA+eW9VtlP9icuxigYMOTP6wsrdiW7FMtHc0o3/MnBpZwWRpcponfnoNQnQMjOSiROZVHcHUK0i/lFUJg9p1Xi20qSyXIjq2WjCF7hSoDw1KzRnYO7uyx1yHN9vmLo+NqVfipRSpT7AtBt9CR8yHQftNQlady+VKSIhmigPTXVIapIf7CA27hiRysVGpWbrMZrJJYilFXh6eFPbk2",
86
+ "ephemeralPublicKey": "BFe4YpEa1hfmaYlcWR4eyVxZmanOCzDak9yy90PCIAfIMeeRCT9zX5KAnj2k/vWa+oZIv1McjgBIKAp/BoWKNkM=",
87
+ "tag": "IpXW8ECpNCLzN36M3S7nbQ1YnXxDeMx1RLwElW0xCg0="
88
+ }
89
89
  }`;
90
90
  const response = await card
91
91
  .charge(10)
@@ -0,0 +1,192 @@
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_MY5OAAAQrmIF_IZDKbr1ecycRr7n1Q1SxNkVgzDhwg";
44
+ config.serviceUrl = "https://cert.api2.heartlandportico.com";
45
+ var runSerially = false;
46
+ var test = runSerially ? ava_1.default.serial : ava_1.default;
47
+ var card = Data_1.TestCards.visaManual();
48
+ card.tokenize();
49
+ ava_1.default.before(function (_t) {
50
+ src_1.ServicesContainer.configure(config);
51
+ });
52
+ test("ecom with moto", function (t) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var ecom, response;
54
+ return __generator(this, function (_a) {
55
+ switch (_a.label) {
56
+ case 0:
57
+ t.plan(4);
58
+ ecom = new src_1.EcommerceInfo();
59
+ ecom.channel = src_1.EcommerceChannel.Moto;
60
+ return [4 /*yield*/, card
61
+ .charge(9)
62
+ .withCurrency("USD")
63
+ .withEcommerceInfo(ecom)
64
+ .withAllowDuplicates(true)
65
+ .execute()];
66
+ case 1:
67
+ response = _a.sent();
68
+ t.truthy(response);
69
+ t.is(response.responseCode, "00");
70
+ t.truthy(response.batchId);
71
+ t.truthy(response.batchSeqNbr);
72
+ return [2 /*return*/];
73
+ }
74
+ });
75
+ }); });
76
+ test("ecom with direct market ship date", function (t) { return __awaiter(void 0, void 0, void 0, function () {
77
+ var ecom, response;
78
+ return __generator(this, function (_a) {
79
+ switch (_a.label) {
80
+ case 0:
81
+ t.plan(2);
82
+ ecom = new src_1.EcommerceInfo();
83
+ ecom.shipDay = "25";
84
+ ecom.shipMonth = "12";
85
+ return [4 /*yield*/, card
86
+ .charge(9)
87
+ .withCurrency("USD")
88
+ .withEcommerceInfo(ecom)
89
+ .withAllowDuplicates(true)
90
+ .execute()];
91
+ case 1:
92
+ response = _a.sent();
93
+ t.truthy(response);
94
+ t.is(response.responseCode, "00");
95
+ return [2 /*return*/];
96
+ }
97
+ });
98
+ }); });
99
+ test("ecom with direct market invoice no ship date", function (t) { return __awaiter(void 0, void 0, void 0, function () {
100
+ var response;
101
+ return __generator(this, function (_a) {
102
+ switch (_a.label) {
103
+ case 0:
104
+ t.plan(2);
105
+ return [4 /*yield*/, card
106
+ .charge(9)
107
+ .withCurrency("USD")
108
+ .withEcommerceInfo(new src_1.EcommerceInfo())
109
+ .withInvoiceNumber("1234567890")
110
+ .withAllowDuplicates(true)
111
+ .execute()];
112
+ case 1:
113
+ response = _a.sent();
114
+ t.truthy(response);
115
+ t.is(response.responseCode, "00");
116
+ return [2 /*return*/];
117
+ }
118
+ });
119
+ }); });
120
+ test("ecom with direct market invoice and ship date", function (t) { return __awaiter(void 0, void 0, void 0, function () {
121
+ var ecom, response;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0:
125
+ t.plan(2);
126
+ ecom = new src_1.EcommerceInfo();
127
+ ecom.channel = src_1.EcommerceChannel.Moto;
128
+ ecom.shipDay = "25";
129
+ ecom.shipMonth = "12";
130
+ return [4 /*yield*/, card
131
+ .charge(9)
132
+ .withCurrency("USD")
133
+ .withEcommerceInfo(ecom)
134
+ .withInvoiceNumber("1234567890")
135
+ .withAllowDuplicates(true)
136
+ .execute()];
137
+ case 1:
138
+ response = _a.sent();
139
+ t.truthy(response);
140
+ t.is(response.responseCode, "00");
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ }); });
145
+ test("ecom with secure ecommerce", function (t) { return __awaiter(void 0, void 0, void 0, function () {
146
+ var ecom, response;
147
+ return __generator(this, function (_a) {
148
+ switch (_a.label) {
149
+ case 0:
150
+ t.plan(2);
151
+ ecom = new src_1.EcommerceInfo();
152
+ ecom.paymentDataSource = "ApplePay";
153
+ ecom.cavv = "XXXXf98AAajXbDRg3HSUMAACAAA=";
154
+ ecom.eci = "5";
155
+ return [4 /*yield*/, card
156
+ .charge(9)
157
+ .withCurrency("USD")
158
+ .withEcommerceInfo(ecom)
159
+ .withInvoiceNumber("1234567890")
160
+ .withAllowDuplicates(true)
161
+ .execute()];
162
+ case 1:
163
+ response = _a.sent();
164
+ t.truthy(response);
165
+ t.is(response.responseCode, "00");
166
+ return [2 /*return*/];
167
+ }
168
+ });
169
+ }); });
170
+ test("ecom with walletdata", function (t) { return __awaiter(void 0, void 0, void 0, function () {
171
+ var response;
172
+ return __generator(this, function (_a) {
173
+ switch (_a.label) {
174
+ case 0:
175
+ t.plan(2);
176
+ card.mobileType = src_1.MobilePaymentMethodType.GOOGLEPAY;
177
+ card.paymentSource = src_1.PaymentDataSourceType.GOOGLEPAYWEB;
178
+ card.token = "{\"signature\":\"MEYCIQChbD9dizRQSTaboSQmp3GD3TSSKLd8kupbOr0IlL+AVgIhAKAbqM0PPn7WPTXZf7nXJPqq29h0hTQiRfusScTToLg8\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"S3P/E0IEZ32pUM1u737Susaj2kQst7cAXUw1bK7Lp9VM8GEqXTD6uaSCKSggFwhV9XNnOMvt9QYgEY69PHc5EFJBR4n9cB6QGrVjARGbUtANTXgSSJy08FFYwjFQ+/CqkHllY3JpnNjGsY5lny5cimatjkB4laTqIZv05mqc0KIzb4aUSfYQzukx6hfmDRDdrEGOfrKHiSx2EOkBguJ7r69BwcBAq58SL6Wpuvh99d8MJyhGSZLyozpD4gmhEVpyDZX5vdG5k6V0e6O6/Y53RPsnaKOH5nourzCLBMm28YBUY8TcqGY/TzRr7SNBDTXkem339CPlRYrFJNYhPRYJcutcf/Akfcrrj9NMBUMQ+Ab4bzbbcAyR/mneNGoWh/W5HFW7n8aYieZwFO2Of8TMOaUxLqpMyZv2UTguCHfSQdSKHt/fv9JxKPszlF0JuGkZmiv7ONDEaw\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BE0mGDo9yPUYbC7ERwX3JBNmnyRXRvJ9Nwj/N7B5VE+aN3yKe5UcCgUi8eUfJCwapGu0C8Rf2/9y4+rIY+72s0c\\\\u003d\\\",\\\"tag\\\":\\\"SBp7NAyNPgZ7lfyi8lIFGbo8S1sf/6ADqOqD1ZYT6y0\\\\u003d\\\"}\"}";
179
+ return [4 /*yield*/, card
180
+ .charge(10)
181
+ .withCurrency("USD")
182
+ .withInvoiceNumber("1234567890")
183
+ .withAllowDuplicates(true)
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
+ }); });