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,1720 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ava_1 = require("ava");
4
+ var src_1 = require("../../../../../src/");
5
+ var Data_1 = require("../../../../Data/");
6
+ var config = new src_1.ServicesConfig();
7
+ config.secretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A";
8
+ config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
9
+ var BATCH_NOT_OPEN = "Transaction was rejected because it requires a batch to be open.";
10
+ var BATCH_EMPTY = "Batch close was rejected because no transactions are associated with the currently open batch";
11
+ var useTokens = false;
12
+ var usePrepaid = false;
13
+ var test = useTokens ? ava_1.default.serial : ava_1.default;
14
+ var visaToken = "";
15
+ var mastercardToken = "";
16
+ var discoverToken = "";
17
+ var amexToken = "";
18
+ ava_1.default.before(function (_t) {
19
+ src_1.ServicesContainer.configure(config);
20
+ });
21
+ test.before("000 - close batch", function (t) {
22
+ t.plan(1);
23
+ return new Promise(function (resolve, reject) {
24
+ src_1.BatchService.closeBatch()
25
+ .then(function (response) {
26
+ t.truthy(response);
27
+ resolve();
28
+ })
29
+ .catch(function (e) {
30
+ if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
31
+ e.message.indexOf(BATCH_EMPTY) !== -1) {
32
+ t.pass();
33
+ resolve();
34
+ return;
35
+ }
36
+ reject(e);
37
+ });
38
+ });
39
+ });
40
+ /// CARD VERIFY
41
+ /// Account verification
42
+ test("001 - verify visa", function (t) {
43
+ t.plan(2);
44
+ var card = Data_1.TestCards.visaManual();
45
+ return new Promise(function (resolve, reject) {
46
+ card
47
+ .verify()
48
+ .withRequestMultiUseToken(useTokens)
49
+ .withAllowDuplicates(true)
50
+ .execute()
51
+ .then(function (response) {
52
+ t.truthy(response);
53
+ t.is(response.responseCode, "00");
54
+ resolve();
55
+ })
56
+ .catch(reject);
57
+ });
58
+ });
59
+ test("002 - verify mastercard", function (t) {
60
+ t.plan(2);
61
+ var card = Data_1.TestCards.masterCardManual();
62
+ return new Promise(function (resolve, reject) {
63
+ card
64
+ .verify()
65
+ .withRequestMultiUseToken(useTokens)
66
+ .withAllowDuplicates(true)
67
+ .execute()
68
+ .then(function (response) {
69
+ t.truthy(response);
70
+ t.is(response.responseCode, "00");
71
+ resolve();
72
+ })
73
+ .catch(reject);
74
+ });
75
+ });
76
+ test("003 - verify discover", function (t) {
77
+ t.plan(2);
78
+ var card = Data_1.TestCards.discoverManual();
79
+ var address = new src_1.Address();
80
+ address.postalCode = "75024";
81
+ return new Promise(function (resolve, reject) {
82
+ card
83
+ .verify()
84
+ .withAddress(address)
85
+ .withRequestMultiUseToken(useTokens)
86
+ .withAllowDuplicates(true)
87
+ .execute()
88
+ .then(function (response) {
89
+ t.truthy(response);
90
+ t.is(response.responseCode, "00");
91
+ resolve();
92
+ })
93
+ .catch(reject);
94
+ });
95
+ });
96
+ /// Address verification
97
+ test("004 - verify amex", function (t) {
98
+ t.plan(2);
99
+ var card = Data_1.TestCards.amexManual();
100
+ var address = new src_1.Address();
101
+ address.postalCode = "75024";
102
+ return new Promise(function (resolve, reject) {
103
+ card
104
+ .verify()
105
+ .withAddress(address)
106
+ .withRequestMultiUseToken(useTokens)
107
+ .withAllowDuplicates(true)
108
+ .execute()
109
+ .then(function (response) {
110
+ t.truthy(response);
111
+ t.is(response.responseCode, "00");
112
+ resolve();
113
+ })
114
+ .catch(reject);
115
+ });
116
+ });
117
+ /// Balance Inquiry (for prepaid cards)
118
+ test("005 - balance inquiry visa", function (t) {
119
+ t.plan(2);
120
+ var card = Data_1.TestCards.visaSwipe();
121
+ return new Promise(function (resolve, reject) {
122
+ card
123
+ .balanceInquiry()
124
+ .execute()
125
+ .then(function (response) {
126
+ t.truthy(response);
127
+ t.is(response.responseCode, "00");
128
+ resolve();
129
+ })
130
+ .catch(reject);
131
+ });
132
+ });
133
+ /// CREDIT SALE (for multi-use tokens only)
134
+ test("006 - charge visa token", function (t) {
135
+ t.plan(3);
136
+ var card = Data_1.TestCards.visaManual();
137
+ var address = new src_1.Address();
138
+ address.streetAddress1 = "6860 Dallas Pkwy";
139
+ address.postalCode = "75024";
140
+ return new Promise(function (resolve, reject) {
141
+ card
142
+ .charge()
143
+ .withCurrency("USD")
144
+ .withAmount("13.01")
145
+ .withAddress(address)
146
+ .withRequestMultiUseToken(true)
147
+ .withAllowDuplicates(true)
148
+ .execute()
149
+ .then(function (response) {
150
+ t.truthy(response);
151
+ t.is(response.responseCode, "00");
152
+ t.truthy(response.token);
153
+ visaToken = response.token;
154
+ resolve();
155
+ })
156
+ .catch(reject);
157
+ });
158
+ });
159
+ test("007 - charge mastercard token", function (t) {
160
+ t.plan(3);
161
+ var card = Data_1.TestCards.masterCardManual();
162
+ var address = new src_1.Address();
163
+ address.streetAddress1 = "6860";
164
+ address.postalCode = "75024";
165
+ return new Promise(function (resolve, reject) {
166
+ card
167
+ .charge()
168
+ .withCurrency("USD")
169
+ .withAmount("13.02")
170
+ .withAddress(address)
171
+ .withRequestMultiUseToken(true)
172
+ .withAllowDuplicates(true)
173
+ .execute()
174
+ .then(function (response) {
175
+ t.truthy(response);
176
+ t.is(response.responseCode, "00");
177
+ t.truthy(response.token);
178
+ mastercardToken = response.token;
179
+ resolve();
180
+ })
181
+ .catch(reject);
182
+ });
183
+ });
184
+ test("008 - charge discover token", function (t) {
185
+ t.plan(3);
186
+ var card = Data_1.TestCards.discoverManual();
187
+ var address = new src_1.Address();
188
+ address.streetAddress1 = "6860 Dallas Pkwy";
189
+ address.postalCode = "75024";
190
+ return new Promise(function (resolve, reject) {
191
+ card
192
+ .charge()
193
+ .withCurrency("USD")
194
+ .withAmount("13.03")
195
+ .withAddress(address)
196
+ .withRequestMultiUseToken(true)
197
+ .withAllowDuplicates(true)
198
+ .execute()
199
+ .then(function (response) {
200
+ t.truthy(response);
201
+ t.is(response.responseCode, "00");
202
+ t.truthy(response.token);
203
+ discoverToken = response.token;
204
+ resolve();
205
+ })
206
+ .catch(reject);
207
+ });
208
+ });
209
+ test("009 - charge amex token", function (t) {
210
+ t.plan(3);
211
+ var card = Data_1.TestCards.amexManual();
212
+ var address = new src_1.Address();
213
+ address.streetAddress1 = "6860 Dallas Pkwy";
214
+ address.postalCode = "75024";
215
+ return new Promise(function (resolve, reject) {
216
+ card
217
+ .charge()
218
+ .withCurrency("USD")
219
+ .withAmount("13.04")
220
+ .withAddress(address)
221
+ .withRequestMultiUseToken(true)
222
+ .withAllowDuplicates(true)
223
+ .execute()
224
+ .then(function (response) {
225
+ t.truthy(response);
226
+ t.is(response.responseCode, "00");
227
+ t.truthy(response.token);
228
+ amexToken = response.token;
229
+ resolve();
230
+ })
231
+ .catch(reject);
232
+ });
233
+ });
234
+ /// CREDIT SALE
235
+ test("010 - charge visa", function (t) {
236
+ t.plan(4);
237
+ var card = Data_1.TestCards.visaManual();
238
+ var address = new src_1.Address();
239
+ address.streetAddress1 = "6860 Dallas Pkwy";
240
+ address.postalCode = "75024";
241
+ if (useTokens) {
242
+ card = new src_1.CreditCardData();
243
+ card.token = visaToken;
244
+ }
245
+ return new Promise(function (resolve, reject) {
246
+ card
247
+ .charge()
248
+ .withCurrency("USD")
249
+ .withAmount("17.01")
250
+ .withAddress(address)
251
+ .withInvoiceNumber("123456")
252
+ .withAllowDuplicates(true)
253
+ .execute()
254
+ .then(function (response) {
255
+ t.truthy(response);
256
+ t.is(response.responseCode, "00");
257
+ return response;
258
+ })
259
+ .then(function (response) {
260
+ response
261
+ .void()
262
+ .execute()
263
+ .then(function (voidResponse) {
264
+ t.truthy(voidResponse);
265
+ t.is(voidResponse.responseCode, "00");
266
+ resolve();
267
+ })
268
+ .catch(reject);
269
+ })
270
+ .catch(reject);
271
+ });
272
+ });
273
+ test("011 - charge mastercard", function (t) {
274
+ t.plan(2);
275
+ var card = Data_1.TestCards.masterCardManual();
276
+ var address = new src_1.Address();
277
+ address.streetAddress1 = "6860";
278
+ address.postalCode = "75024";
279
+ if (useTokens) {
280
+ card = new src_1.CreditCardData();
281
+ card.token = mastercardToken;
282
+ }
283
+ return new Promise(function (resolve, reject) {
284
+ card
285
+ .charge()
286
+ .withCurrency("USD")
287
+ .withAmount("17.02")
288
+ .withAddress(address)
289
+ .withInvoiceNumber("123456")
290
+ .withAllowDuplicates(true)
291
+ .execute()
292
+ .then(function (response) {
293
+ t.truthy(response);
294
+ t.is(response.responseCode, "00");
295
+ resolve();
296
+ })
297
+ .catch(reject);
298
+ });
299
+ });
300
+ test("012 - charge discover", function (t) {
301
+ t.plan(2);
302
+ var card = Data_1.TestCards.discoverManual();
303
+ var address = new src_1.Address();
304
+ address.streetAddress1 = "6860";
305
+ address.postalCode = "750241234";
306
+ if (useTokens) {
307
+ card = new src_1.CreditCardData();
308
+ card.token = discoverToken;
309
+ }
310
+ return new Promise(function (resolve, reject) {
311
+ card
312
+ .charge()
313
+ .withCurrency("USD")
314
+ .withAmount("17.03")
315
+ .withAddress(address)
316
+ .withInvoiceNumber("123456")
317
+ .withAllowDuplicates(true)
318
+ .execute()
319
+ .then(function (response) {
320
+ t.truthy(response);
321
+ t.is(response.responseCode, "00");
322
+ resolve();
323
+ })
324
+ .catch(reject);
325
+ });
326
+ });
327
+ test("013 - charge amex", function (t) {
328
+ t.plan(2);
329
+ var card = Data_1.TestCards.amexManual();
330
+ var address = new src_1.Address();
331
+ address.streetAddress1 = "6860 Dallas Pkwy";
332
+ address.postalCode = "75024";
333
+ if (useTokens) {
334
+ card = new src_1.CreditCardData();
335
+ card.token = amexToken;
336
+ }
337
+ return new Promise(function (resolve, reject) {
338
+ card
339
+ .charge()
340
+ .withCurrency("USD")
341
+ .withAmount("17.04")
342
+ .withAddress(address)
343
+ .withInvoiceNumber("123456")
344
+ .withAllowDuplicates(true)
345
+ .execute()
346
+ .then(function (response) {
347
+ t.truthy(response);
348
+ t.is(response.responseCode, "00");
349
+ resolve();
350
+ })
351
+ .catch(reject);
352
+ });
353
+ });
354
+ test("014 - charge jcb", function (t) {
355
+ t.plan(2);
356
+ var card = Data_1.TestCards.jcbManual();
357
+ var address = new src_1.Address();
358
+ address.streetAddress1 = "6860 Dallas Pkwy";
359
+ address.postalCode = "75024";
360
+ return new Promise(function (resolve, reject) {
361
+ card
362
+ .charge()
363
+ .withCurrency("USD")
364
+ .withAmount("17.04")
365
+ .withAddress(address)
366
+ .withInvoiceNumber("123456")
367
+ .withAllowDuplicates(true)
368
+ .execute()
369
+ .then(function (response) {
370
+ t.truthy(response);
371
+ t.is(response.responseCode, "00");
372
+ resolve();
373
+ })
374
+ .catch(reject);
375
+ });
376
+ });
377
+ /// AUTHORIZATION
378
+ test("015 - authorization visa", function (t) {
379
+ t.plan(4);
380
+ // test 015a Authorization
381
+ var card = Data_1.TestCards.visaManual();
382
+ var address = new src_1.Address();
383
+ address.streetAddress1 = "6860 Dallas Pkwy";
384
+ address.postalCode = "75024";
385
+ return new Promise(function (resolve, reject) {
386
+ card
387
+ .authorize("17.06")
388
+ .withCurrency("USD")
389
+ .withAddress(address)
390
+ .withInvoiceNumber("123456")
391
+ .withAllowDuplicates(true)
392
+ .execute()
393
+ .then(function (response) {
394
+ t.truthy(response);
395
+ t.is(response.responseCode, "00");
396
+ return response;
397
+ })
398
+ .then(function (response) {
399
+ // test 015b Capture/AddToBatch
400
+ response
401
+ .capture()
402
+ .execute()
403
+ .then(function (capture) {
404
+ t.truthy(capture);
405
+ t.is(capture.responseCode, "00");
406
+ resolve();
407
+ })
408
+ .catch(reject);
409
+ })
410
+ .catch(reject);
411
+ });
412
+ });
413
+ test("016 - authorization mastercard", function (t) {
414
+ t.plan(4);
415
+ // test 016a Authorization
416
+ var card = Data_1.TestCards.masterCardManual();
417
+ var address = new src_1.Address();
418
+ address.streetAddress1 = "6860 Dallas Pkwy";
419
+ address.postalCode = "750241234";
420
+ return new Promise(function (resolve, reject) {
421
+ card
422
+ .authorize("17.07")
423
+ .withCurrency("USD")
424
+ .withAddress(address)
425
+ .withInvoiceNumber("123456")
426
+ .withAllowDuplicates(true)
427
+ .execute()
428
+ .then(function (response) {
429
+ t.truthy(response);
430
+ t.is(response.responseCode, "00");
431
+ return response;
432
+ })
433
+ .then(function (response) {
434
+ // test 016b Capture/AddToBatch
435
+ response
436
+ .capture()
437
+ .execute()
438
+ .then(function (capture) {
439
+ t.truthy(capture);
440
+ t.is(capture.responseCode, "00");
441
+ resolve();
442
+ })
443
+ .catch(reject);
444
+ })
445
+ .catch(reject);
446
+ });
447
+ });
448
+ test("017 - authorization discover", function (t) {
449
+ t.plan(2);
450
+ // test 017a Authorization
451
+ var card = Data_1.TestCards.discoverManual();
452
+ var address = new src_1.Address();
453
+ address.streetAddress1 = "6860";
454
+ address.postalCode = "75024";
455
+ return new Promise(function (resolve, reject) {
456
+ card
457
+ .authorize("17.08")
458
+ .withCurrency("USD")
459
+ .withAddress(address)
460
+ .withInvoiceNumber("123456")
461
+ .withAllowDuplicates(true)
462
+ .execute()
463
+ .then(function (response) {
464
+ t.truthy(response);
465
+ t.is(response.responseCode, "00");
466
+ return response;
467
+ })
468
+ .then(function (_response) {
469
+ // test 017b Capture/AddToBatch
470
+ // do not capture
471
+ resolve();
472
+ })
473
+ .catch(reject);
474
+ });
475
+ });
476
+ /// PARTIALLY APPROVED SALE
477
+ test("018 - partial approval visa", function (t) {
478
+ t.plan(4);
479
+ var address = new src_1.Address();
480
+ address.streetAddress1 = "6860";
481
+ address.postalCode = "75024";
482
+ var card = Data_1.TestCards.visaManual();
483
+ return new Promise(function (resolve, reject) {
484
+ card
485
+ .charge(130)
486
+ .withCurrency("USD")
487
+ .withAddress(address)
488
+ .withInvoiceNumber("123456")
489
+ .withAllowPartialAuth(true)
490
+ .withAllowDuplicates(true)
491
+ .execute()
492
+ .then(function (response) {
493
+ t.truthy(response);
494
+ t.is(response.responseCode, "10");
495
+ t.truthy(response.authorizedAmount);
496
+ t.is(response.authorizedAmount, "110.00");
497
+ resolve();
498
+ })
499
+ .catch(reject);
500
+ });
501
+ });
502
+ test("019 - partial approval discover", function (t) {
503
+ t.plan(4);
504
+ var address = new src_1.Address();
505
+ address.streetAddress1 = "6860";
506
+ address.postalCode = "75024";
507
+ var card = Data_1.TestCards.discoverManual();
508
+ return new Promise(function (resolve, reject) {
509
+ card
510
+ .charge(145)
511
+ .withCurrency("USD")
512
+ .withAddress(address)
513
+ .withInvoiceNumber("123456")
514
+ .withAllowPartialAuth(true)
515
+ .withAllowDuplicates(true)
516
+ .execute()
517
+ .then(function (response) {
518
+ t.truthy(response);
519
+ t.is(response.responseCode, "10");
520
+ t.truthy(response.authorizedAmount);
521
+ t.is(response.authorizedAmount, "65.00");
522
+ resolve();
523
+ })
524
+ .catch(reject);
525
+ });
526
+ });
527
+ test("020 - partial approval mastercard", function (t) {
528
+ t.plan(4);
529
+ var address = new src_1.Address();
530
+ address.streetAddress1 = "6860";
531
+ address.postalCode = "75024";
532
+ var card = Data_1.TestCards.masterCardManual();
533
+ return new Promise(function (resolve, reject) {
534
+ card
535
+ .charge(155)
536
+ .withCurrency("USD")
537
+ .withAddress(address)
538
+ .withInvoiceNumber("123456")
539
+ .withAllowPartialAuth(true)
540
+ .withAllowDuplicates(true)
541
+ .execute()
542
+ .then(function (response) {
543
+ t.truthy(response);
544
+ t.is(response.responseCode, "10");
545
+ t.truthy(response.authorizedAmount);
546
+ t.is(response.authorizedAmount, "100.00");
547
+ resolve();
548
+ })
549
+ .catch(reject);
550
+ });
551
+ });
552
+ /// LEVEL II CORPORATE PURCHASE CARD
553
+ test("021 - level ii response b", function (t) {
554
+ t.plan(5);
555
+ var address = new src_1.Address();
556
+ address.streetAddress1 = "6860 Dallas Pkwy";
557
+ address.postalCode = "750241234";
558
+ var card = Data_1.TestCards.visaManual();
559
+ return new Promise(function (resolve, reject) {
560
+ card
561
+ .charge(112.34)
562
+ .withCurrency("USD")
563
+ .withAddress(address)
564
+ .withCommercialRequest(true)
565
+ .withAllowDuplicates(true)
566
+ .execute()
567
+ .then(function (response) {
568
+ t.truthy(response);
569
+ t.is(response.responseCode, "00");
570
+ t.is(response.commercialIndicator, "B");
571
+ return response;
572
+ })
573
+ .then(function (response) {
574
+ response
575
+ .edit()
576
+ .withPoNumber("9876543210")
577
+ .withTaxType(src_1.TaxType.NotUsed)
578
+ .execute()
579
+ .then(function (cpcResponse) {
580
+ t.truthy(cpcResponse);
581
+ t.is(cpcResponse.responseCode, "00");
582
+ resolve();
583
+ })
584
+ .catch(reject);
585
+ })
586
+ .catch(reject);
587
+ });
588
+ });
589
+ test("022 - level ii response b", function (t) {
590
+ t.plan(5);
591
+ var address = new src_1.Address();
592
+ address.streetAddress1 = "6860";
593
+ address.postalCode = "750241234";
594
+ var card = Data_1.TestCards.visaManual();
595
+ return new Promise(function (resolve, reject) {
596
+ card
597
+ .charge(112.34)
598
+ .withCurrency("USD")
599
+ .withAddress(address)
600
+ .withCommercialRequest(true)
601
+ .withAllowDuplicates(true)
602
+ .execute()
603
+ .then(function (response) {
604
+ t.truthy(response);
605
+ t.is(response.responseCode, "00");
606
+ t.is(response.commercialIndicator, "B");
607
+ return response;
608
+ })
609
+ .then(function (response) {
610
+ response
611
+ .edit()
612
+ .withTaxType(src_1.TaxType.SalesTax)
613
+ .withTaxAmount(1.0)
614
+ .execute()
615
+ .then(function (cpcResponse) {
616
+ t.truthy(cpcResponse);
617
+ t.is(cpcResponse.responseCode, "00");
618
+ resolve();
619
+ })
620
+ .catch(reject);
621
+ })
622
+ .catch(reject);
623
+ });
624
+ });
625
+ test("023 - level ii response r", function (t) {
626
+ t.plan(5);
627
+ var address = new src_1.Address();
628
+ address.streetAddress1 = "6860";
629
+ address.postalCode = "75024";
630
+ var card = Data_1.TestCards.visaManual();
631
+ return new Promise(function (resolve, reject) {
632
+ card
633
+ .charge(123.45)
634
+ .withCurrency("USD")
635
+ .withAddress(address)
636
+ .withCommercialRequest(true)
637
+ .withAllowDuplicates(true)
638
+ .execute()
639
+ .then(function (response) {
640
+ t.truthy(response);
641
+ t.is(response.responseCode, "00");
642
+ t.is(response.commercialIndicator, "R");
643
+ return response;
644
+ })
645
+ .then(function (response) {
646
+ response
647
+ .edit()
648
+ .withTaxType(src_1.TaxType.TaxExempt)
649
+ .execute()
650
+ .then(function (cpcResponse) {
651
+ t.truthy(cpcResponse);
652
+ t.is(cpcResponse.responseCode, "00");
653
+ resolve();
654
+ })
655
+ .catch(reject);
656
+ })
657
+ .catch(reject);
658
+ });
659
+ });
660
+ test("024 - level ii response s", function (t) {
661
+ t.plan(5);
662
+ var address = new src_1.Address();
663
+ address.streetAddress1 = "6860";
664
+ address.postalCode = "75024";
665
+ var card = Data_1.TestCards.visaManual();
666
+ return new Promise(function (resolve, reject) {
667
+ card
668
+ .charge(134.56)
669
+ .withCurrency("USD")
670
+ .withAddress(address)
671
+ .withCommercialRequest(true)
672
+ .withAllowDuplicates(true)
673
+ .execute()
674
+ .then(function (response) {
675
+ t.truthy(response);
676
+ t.is(response.responseCode, "00");
677
+ t.is(response.commercialIndicator, "S");
678
+ return response;
679
+ })
680
+ .then(function (response) {
681
+ response
682
+ .edit()
683
+ .withPoNumber("9876543210")
684
+ .withTaxType(src_1.TaxType.SalesTax)
685
+ .withTaxAmount(1.0)
686
+ .execute()
687
+ .then(function (cpcResponse) {
688
+ t.truthy(cpcResponse);
689
+ t.is(cpcResponse.responseCode, "00");
690
+ resolve();
691
+ })
692
+ .catch(reject);
693
+ })
694
+ .catch(reject);
695
+ });
696
+ });
697
+ test("025 - level ii response s", function (t) {
698
+ t.plan(5);
699
+ var address = new src_1.Address();
700
+ address.streetAddress1 = "6860";
701
+ address.postalCode = "75024";
702
+ var card = Data_1.TestCards.masterCardManual();
703
+ return new Promise(function (resolve, reject) {
704
+ card
705
+ .charge(111.06)
706
+ .withCurrency("USD")
707
+ .withAddress(address)
708
+ .withCommercialRequest(true)
709
+ .withAllowDuplicates(true)
710
+ .execute()
711
+ .then(function (response) {
712
+ t.truthy(response);
713
+ t.is(response.responseCode, "00");
714
+ t.is(response.commercialIndicator, "S");
715
+ return response;
716
+ })
717
+ .then(function (response) {
718
+ response
719
+ .edit()
720
+ .withPoNumber("9876543210")
721
+ .withTaxType(src_1.TaxType.NotUsed)
722
+ .execute()
723
+ .then(function (cpcResponse) {
724
+ t.truthy(cpcResponse);
725
+ t.is(cpcResponse.responseCode, "00");
726
+ resolve();
727
+ })
728
+ .catch(reject);
729
+ })
730
+ .catch(reject);
731
+ });
732
+ });
733
+ test("026 - level ii response s", function (t) {
734
+ t.plan(5);
735
+ var address = new src_1.Address();
736
+ address.streetAddress1 = "6860";
737
+ address.postalCode = "75024";
738
+ var card = Data_1.TestCards.masterCardManual();
739
+ return new Promise(function (resolve, reject) {
740
+ card
741
+ .charge(111.07)
742
+ .withCurrency("USD")
743
+ .withAddress(address)
744
+ .withCommercialRequest(true)
745
+ .withAllowDuplicates(true)
746
+ .execute()
747
+ .then(function (response) {
748
+ t.truthy(response);
749
+ t.is(response.responseCode, "00");
750
+ t.is(response.commercialIndicator, "S");
751
+ return response;
752
+ })
753
+ .then(function (response) {
754
+ response
755
+ .edit()
756
+ .withTaxType(src_1.TaxType.SalesTax)
757
+ .withTaxAmount(1.0)
758
+ .execute()
759
+ .then(function (cpcResponse) {
760
+ t.truthy(cpcResponse);
761
+ t.is(cpcResponse.responseCode, "00");
762
+ resolve();
763
+ })
764
+ .catch(reject);
765
+ })
766
+ .catch(reject);
767
+ });
768
+ });
769
+ test("027 - level ii response s", function (t) {
770
+ t.plan(5);
771
+ var address = new src_1.Address();
772
+ address.streetAddress1 = "6860";
773
+ address.postalCode = "75024";
774
+ var card = Data_1.TestCards.masterCardManual();
775
+ return new Promise(function (resolve, reject) {
776
+ card
777
+ .charge(111.08)
778
+ .withCurrency("USD")
779
+ .withAddress(address)
780
+ .withCommercialRequest(true)
781
+ .withAllowDuplicates(true)
782
+ .execute()
783
+ .then(function (response) {
784
+ t.truthy(response);
785
+ t.is(response.responseCode, "00");
786
+ t.is(response.commercialIndicator, "S");
787
+ return response;
788
+ })
789
+ .then(function (response) {
790
+ response
791
+ .edit()
792
+ .withPoNumber("9876543210")
793
+ .withTaxType(src_1.TaxType.SalesTax)
794
+ .withTaxAmount(1.0)
795
+ .execute()
796
+ .then(function (cpcResponse) {
797
+ t.truthy(cpcResponse);
798
+ t.is(cpcResponse.responseCode, "00");
799
+ resolve();
800
+ })
801
+ .catch(reject);
802
+ })
803
+ .catch(reject);
804
+ });
805
+ });
806
+ test("028 - level ii response s", function (t) {
807
+ t.plan(5);
808
+ var address = new src_1.Address();
809
+ address.streetAddress1 = "6860";
810
+ address.postalCode = "75024";
811
+ var card = Data_1.TestCards.masterCardManual();
812
+ return new Promise(function (resolve, reject) {
813
+ card
814
+ .charge(111.09)
815
+ .withCurrency("USD")
816
+ .withAddress(address)
817
+ .withCommercialRequest(true)
818
+ .withAllowDuplicates(true)
819
+ .execute()
820
+ .then(function (response) {
821
+ t.truthy(response);
822
+ t.is(response.responseCode, "00");
823
+ t.is(response.commercialIndicator, "S");
824
+ return response;
825
+ })
826
+ .then(function (response) {
827
+ response
828
+ .edit()
829
+ .withPoNumber("9876543210")
830
+ .withTaxType(src_1.TaxType.TaxExempt)
831
+ .execute()
832
+ .then(function (cpcResponse) {
833
+ t.truthy(cpcResponse);
834
+ t.is(cpcResponse.responseCode, "00");
835
+ resolve();
836
+ })
837
+ .catch(reject);
838
+ })
839
+ .catch(reject);
840
+ });
841
+ });
842
+ test("029 - level ii no response", function (t) {
843
+ t.plan(5);
844
+ var address = new src_1.Address();
845
+ address.streetAddress1 = "6860";
846
+ address.postalCode = "75024";
847
+ var card = Data_1.TestCards.amexManual();
848
+ return new Promise(function (resolve, reject) {
849
+ card
850
+ .charge(111.1)
851
+ .withCurrency("USD")
852
+ .withAddress(address)
853
+ .withCommercialRequest(true)
854
+ .withAllowDuplicates(true)
855
+ .execute()
856
+ .then(function (response) {
857
+ t.truthy(response);
858
+ t.is(response.responseCode, "00");
859
+ t.is(response.commercialIndicator, "0");
860
+ return response;
861
+ })
862
+ .then(function (response) {
863
+ response
864
+ .edit()
865
+ .withPoNumber("9876543210")
866
+ .withTaxType(src_1.TaxType.NotUsed)
867
+ .execute()
868
+ .then(function (cpcResponse) {
869
+ t.truthy(cpcResponse);
870
+ t.is(cpcResponse.responseCode, "00");
871
+ resolve();
872
+ })
873
+ .catch(reject);
874
+ })
875
+ .catch(reject);
876
+ });
877
+ });
878
+ test("030 - level ii no response", function (t) {
879
+ t.plan(5);
880
+ var address = new src_1.Address();
881
+ address.streetAddress1 = "6860";
882
+ address.postalCode = "750241234";
883
+ var card = Data_1.TestCards.amexManual();
884
+ return new Promise(function (resolve, reject) {
885
+ card
886
+ .charge(111.11)
887
+ .withCurrency("USD")
888
+ .withAddress(address)
889
+ .withCommercialRequest(true)
890
+ .withAllowDuplicates(true)
891
+ .execute()
892
+ .then(function (response) {
893
+ t.truthy(response);
894
+ t.is(response.responseCode, "00");
895
+ t.is(response.commercialIndicator, "0");
896
+ return response;
897
+ })
898
+ .then(function (response) {
899
+ response
900
+ .edit()
901
+ .withTaxType(src_1.TaxType.SalesTax)
902
+ .withTaxAmount(1.0)
903
+ .execute()
904
+ .then(function (cpcResponse) {
905
+ t.truthy(cpcResponse);
906
+ t.is(cpcResponse.responseCode, "00");
907
+ resolve();
908
+ })
909
+ .catch(reject);
910
+ })
911
+ .catch(reject);
912
+ });
913
+ });
914
+ test("031 - level ii no response", function (t) {
915
+ t.plan(5);
916
+ var address = new src_1.Address();
917
+ address.streetAddress1 = "6860";
918
+ address.postalCode = "75024";
919
+ var card = Data_1.TestCards.amexManual();
920
+ return new Promise(function (resolve, reject) {
921
+ card
922
+ .charge(111.12)
923
+ .withCurrency("USD")
924
+ .withAddress(address)
925
+ .withCommercialRequest(true)
926
+ .withAllowDuplicates(true)
927
+ .execute()
928
+ .then(function (response) {
929
+ t.truthy(response);
930
+ t.is(response.responseCode, "00");
931
+ t.is(response.commercialIndicator, "0");
932
+ return response;
933
+ })
934
+ .then(function (response) {
935
+ response
936
+ .edit()
937
+ .withPoNumber("9876543210")
938
+ .withTaxType(src_1.TaxType.SalesTax)
939
+ .withTaxAmount(1.0)
940
+ .execute()
941
+ .then(function (cpcResponse) {
942
+ t.truthy(cpcResponse);
943
+ t.is(cpcResponse.responseCode, "00");
944
+ resolve();
945
+ })
946
+ .catch(reject);
947
+ })
948
+ .catch(reject);
949
+ });
950
+ });
951
+ test("032 - level ii no response", function (t) {
952
+ t.plan(5);
953
+ var address = new src_1.Address();
954
+ address.streetAddress1 = "6860";
955
+ address.postalCode = "75024";
956
+ var card = Data_1.TestCards.amexManual();
957
+ return new Promise(function (resolve, reject) {
958
+ card
959
+ .charge(111.13)
960
+ .withCurrency("USD")
961
+ .withAddress(address)
962
+ .withCommercialRequest(true)
963
+ .withAllowDuplicates(true)
964
+ .execute()
965
+ .then(function (response) {
966
+ t.truthy(response);
967
+ t.is(response.responseCode, "00");
968
+ t.is(response.commercialIndicator, "0");
969
+ return response;
970
+ })
971
+ .then(function (response) {
972
+ response
973
+ .edit()
974
+ .withPoNumber("9876543210")
975
+ .withTaxType(src_1.TaxType.TaxExempt)
976
+ .execute()
977
+ .then(function (cpcResponse) {
978
+ t.truthy(cpcResponse);
979
+ t.is(cpcResponse.responseCode, "00");
980
+ resolve();
981
+ })
982
+ .catch(reject);
983
+ })
984
+ .catch(reject);
985
+ });
986
+ });
987
+ /// PRIOR / VOICE AUTHORIZATION
988
+ test("033 - offline sale", function (t) {
989
+ t.plan(2);
990
+ var card = Data_1.TestCards.visaManual();
991
+ return new Promise(function (resolve, reject) {
992
+ card
993
+ .charge(17.01)
994
+ .withCurrency("USD")
995
+ .withModifier(src_1.TransactionModifier.Offline)
996
+ .withOfflineAuthCode("654321")
997
+ .withInvoiceNumber("123456")
998
+ .withAllowDuplicates(true)
999
+ .execute()
1000
+ .then(function (response) {
1001
+ t.truthy(response);
1002
+ t.is(response.responseCode, "00");
1003
+ resolve();
1004
+ })
1005
+ .catch(reject);
1006
+ });
1007
+ });
1008
+ test("033 - offline authorization", function (t) {
1009
+ t.plan(2);
1010
+ var card = Data_1.TestCards.visaManual();
1011
+ return new Promise(function (resolve, reject) {
1012
+ card
1013
+ .authorize(17.1)
1014
+ .withCurrency("USD")
1015
+ .withModifier(src_1.TransactionModifier.Offline)
1016
+ .withOfflineAuthCode("654321")
1017
+ .withInvoiceNumber("123456")
1018
+ .withAllowDuplicates(true)
1019
+ .execute()
1020
+ .then(function (response) {
1021
+ t.truthy(response);
1022
+ t.is(response.responseCode, "00");
1023
+ resolve();
1024
+ })
1025
+ .catch(reject);
1026
+ });
1027
+ });
1028
+ /// RETURN
1029
+ test("034 - offline return", function (t) {
1030
+ t.plan(2);
1031
+ var card = Data_1.TestCards.visaManual();
1032
+ return new Promise(function (resolve, reject) {
1033
+ card
1034
+ .refund(15.15)
1035
+ .withCurrency("USD")
1036
+ .withInvoiceNumber("123456")
1037
+ .withAllowDuplicates(true)
1038
+ .execute()
1039
+ .then(function (response) {
1040
+ t.truthy(response);
1041
+ t.is(response.responseCode, "00");
1042
+ resolve();
1043
+ })
1044
+ .catch(reject);
1045
+ });
1046
+ });
1047
+ /// ONLINE VOID / REVERSAL
1048
+ test("035 - void test 10", function () { return true; });
1049
+ test("036 - void test 20", function () { return true; });
1050
+ /// ADVANCED FRAUD SCREENING
1051
+ test.failing("037 - fraud prevention sale", function (t) {
1052
+ t.plan(2);
1053
+ var card = Data_1.TestCards.visaManual();
1054
+ return new Promise(function (resolve, reject) {
1055
+ card
1056
+ .charge(15000)
1057
+ .withCurrency("USD")
1058
+ .withAllowDuplicates(true)
1059
+ .execute()
1060
+ .then(function (response) {
1061
+ t.truthy(response);
1062
+ t.is(response.responseCode, "FR");
1063
+ resolve();
1064
+ })
1065
+ .catch(reject);
1066
+ });
1067
+ });
1068
+ test.failing("038 - fraud prevention return", function (t) {
1069
+ t.plan(2);
1070
+ var card = Data_1.TestCards.visaManual();
1071
+ return new Promise(function (resolve, reject) {
1072
+ card
1073
+ .refund(15000)
1074
+ .withCurrency("USD")
1075
+ .withAllowDuplicates(true)
1076
+ .execute()
1077
+ .then(function (response) {
1078
+ t.truthy(response);
1079
+ t.is(response.responseCode, "41");
1080
+ resolve();
1081
+ })
1082
+ .catch(reject);
1083
+ });
1084
+ });
1085
+ /// ONE CARD - GSB CARD FUNCTIONS
1086
+ /// BALANCE INQUIRY
1087
+ (usePrepaid ? test : test.skip)("037 - balance inquiry gsb", function (t) {
1088
+ t.plan(2);
1089
+ var address = new src_1.Address();
1090
+ address.streetAddress1 = "6860";
1091
+ address.postalCode = "75024";
1092
+ var card = Data_1.TestCards.gsbManual();
1093
+ return new Promise(function (resolve, reject) {
1094
+ card
1095
+ .balanceInquiry()
1096
+ .withAddress(address)
1097
+ .execute()
1098
+ .then(function (response) {
1099
+ t.truthy(response);
1100
+ t.is(response.responseCode, "00");
1101
+ resolve();
1102
+ })
1103
+ .catch(reject);
1104
+ });
1105
+ });
1106
+ /// ADD VALUE
1107
+ (usePrepaid ? test : test.skip)("038 - add value gsb", function (t) {
1108
+ t.plan(2);
1109
+ var address = new src_1.Address();
1110
+ address.streetAddress1 = "6860";
1111
+ address.postalCode = "75024";
1112
+ var card = new src_1.CreditTrackData();
1113
+ card.value =
1114
+ "%B6277220572999800^ / ^49121010557010000016000000?F;6277220572999800=49121010557010000016?";
1115
+ return new Promise(function (resolve, reject) {
1116
+ card
1117
+ .addValue(15.0)
1118
+ .withCurrency("USD")
1119
+ .withAllowDuplicates(true)
1120
+ .execute()
1121
+ .then(function (response) {
1122
+ t.truthy(response);
1123
+ t.is(response.responseCode, "00");
1124
+ resolve();
1125
+ })
1126
+ .catch(reject);
1127
+ });
1128
+ });
1129
+ /// SALE
1130
+ (usePrepaid ? test : test.skip)("039 - charge gsb", function (t) {
1131
+ t.plan(4);
1132
+ var address = new src_1.Address();
1133
+ address.streetAddress1 = "6860";
1134
+ address.postalCode = "75024";
1135
+ var card = Data_1.TestCards.gsbManual();
1136
+ return new Promise(function (resolve, reject) {
1137
+ card
1138
+ .charge(2.05)
1139
+ .withCurrency("USD")
1140
+ .withAddress(address)
1141
+ .withInvoiceNumber("123456")
1142
+ .withAllowDuplicates(true)
1143
+ .execute()
1144
+ .then(function (response) {
1145
+ t.truthy(response);
1146
+ t.is(response.responseCode, "00");
1147
+ return response;
1148
+ })
1149
+ .then(function (response) {
1150
+ response
1151
+ .void()
1152
+ .execute()
1153
+ .then(function (voidResponse) {
1154
+ t.truthy(voidResponse);
1155
+ t.is(voidResponse.responseCode, "00");
1156
+ resolve();
1157
+ })
1158
+ .catch(reject);
1159
+ })
1160
+ .catch(reject);
1161
+ });
1162
+ });
1163
+ (usePrepaid ? test : test.skip)("040 - charge gsb", function (t) {
1164
+ t.plan(2);
1165
+ var address = new src_1.Address();
1166
+ address.streetAddress1 = "6860";
1167
+ address.postalCode = "75024";
1168
+ var card = Data_1.TestCards.gsbManual();
1169
+ return new Promise(function (resolve, reject) {
1170
+ card
1171
+ .charge(2.1)
1172
+ .withCurrency("USD")
1173
+ .withAddress(address)
1174
+ .withInvoiceNumber("123456")
1175
+ .withAllowDuplicates(true)
1176
+ .execute()
1177
+ .then(function (response) {
1178
+ t.truthy(response);
1179
+ t.is(response.responseCode, "00");
1180
+ resolve();
1181
+ })
1182
+ .catch(reject);
1183
+ });
1184
+ });
1185
+ /// ONLINE VOID / REVERSAL
1186
+ test("041 - void gsb", function () { return true; });
1187
+ /// HMS GIFT - REWARDS
1188
+ /// ACTIVATE
1189
+ test("042 - activate gift 1", function (t) {
1190
+ t.plan(2);
1191
+ var card = Data_1.TestCards.giftCard1Swipe();
1192
+ return new Promise(function (resolve, reject) {
1193
+ card
1194
+ .activate(6.0)
1195
+ .withCurrency("USD")
1196
+ .execute()
1197
+ .then(function (response) {
1198
+ t.truthy(response);
1199
+ t.is(response.responseCode, "00");
1200
+ resolve();
1201
+ })
1202
+ .catch(reject);
1203
+ });
1204
+ });
1205
+ test("043 - activate gift 2", function (t) {
1206
+ t.plan(2);
1207
+ var card = Data_1.TestCards.giftCard2Manual();
1208
+ return new Promise(function (resolve, reject) {
1209
+ card
1210
+ .activate(7.0)
1211
+ .withCurrency("USD")
1212
+ .execute()
1213
+ .then(function (response) {
1214
+ t.truthy(response);
1215
+ t.is(response.responseCode, "00");
1216
+ resolve();
1217
+ })
1218
+ .catch(reject);
1219
+ });
1220
+ });
1221
+ /// LOAD / ADD VALUE
1222
+ test("044 - add value gift 1", function (t) {
1223
+ t.plan(2);
1224
+ var card = Data_1.TestCards.giftCard1Swipe();
1225
+ return new Promise(function (resolve, reject) {
1226
+ card
1227
+ .addValue(8.0)
1228
+ .withCurrency("USD")
1229
+ .execute()
1230
+ .then(function (response) {
1231
+ t.truthy(response);
1232
+ t.is(response.responseCode, "00");
1233
+ resolve();
1234
+ })
1235
+ .catch(reject);
1236
+ });
1237
+ });
1238
+ test("045 - add value gift 2", function (t) {
1239
+ t.plan(2);
1240
+ var card = Data_1.TestCards.giftCard2Manual();
1241
+ return new Promise(function (resolve, reject) {
1242
+ card
1243
+ .addValue(9.0)
1244
+ .withCurrency("USD")
1245
+ .execute()
1246
+ .then(function (response) {
1247
+ t.truthy(response);
1248
+ t.is(response.responseCode, "00");
1249
+ resolve();
1250
+ })
1251
+ .catch(reject);
1252
+ });
1253
+ });
1254
+ /// BALANCE INQUIRY
1255
+ test("046 - balance inquiry gift 1", function (t) {
1256
+ t.plan(3);
1257
+ var card = Data_1.TestCards.giftCard1Swipe();
1258
+ return new Promise(function (resolve, reject) {
1259
+ card
1260
+ .balanceInquiry()
1261
+ .execute()
1262
+ .then(function (response) {
1263
+ t.truthy(response);
1264
+ t.is(response.responseCode, "00");
1265
+ t.is(response.balanceAmount, "10.00");
1266
+ resolve();
1267
+ })
1268
+ .catch(reject);
1269
+ });
1270
+ });
1271
+ test("047 - balance inquiry gift 2", function (t) {
1272
+ t.plan(3);
1273
+ var card = Data_1.TestCards.giftCard2Manual();
1274
+ return new Promise(function (resolve, reject) {
1275
+ card
1276
+ .balanceInquiry()
1277
+ .execute()
1278
+ .then(function (response) {
1279
+ t.truthy(response);
1280
+ t.is(response.responseCode, "00");
1281
+ t.is(response.balanceAmount, "10.00");
1282
+ resolve();
1283
+ })
1284
+ .catch(reject);
1285
+ });
1286
+ });
1287
+ /// REPLACE / TRANSFER
1288
+ test("048 - replace gift 1", function (t) {
1289
+ t.plan(2);
1290
+ var card = Data_1.TestCards.giftCard1Swipe();
1291
+ return new Promise(function (resolve, reject) {
1292
+ card
1293
+ .replaceWith(Data_1.TestCards.giftCard2Manual())
1294
+ .execute()
1295
+ .then(function (response) {
1296
+ t.truthy(response);
1297
+ t.is(response.responseCode, "00");
1298
+ resolve();
1299
+ })
1300
+ .catch(reject);
1301
+ });
1302
+ });
1303
+ test("049 - replace gift 2", function (t) {
1304
+ t.plan(2);
1305
+ var card = Data_1.TestCards.giftCard2Manual();
1306
+ return new Promise(function (resolve, reject) {
1307
+ card
1308
+ .replaceWith(Data_1.TestCards.giftCard1Swipe())
1309
+ .execute()
1310
+ .then(function (response) {
1311
+ t.truthy(response);
1312
+ t.is(response.responseCode, "00");
1313
+ resolve();
1314
+ })
1315
+ .catch(reject);
1316
+ });
1317
+ });
1318
+ /// SALE
1319
+ test("050 - sale gift 1", function (t) {
1320
+ t.plan(2);
1321
+ var card = Data_1.TestCards.giftCard1Swipe();
1322
+ return new Promise(function (resolve, reject) {
1323
+ card
1324
+ .charge(1.0)
1325
+ .withCurrency("USD")
1326
+ .execute()
1327
+ .then(function (response) {
1328
+ t.truthy(response);
1329
+ t.is(response.responseCode, "00");
1330
+ resolve();
1331
+ })
1332
+ .catch(reject);
1333
+ });
1334
+ });
1335
+ test("051 - sale gift 2", function (t) {
1336
+ t.plan(2);
1337
+ var card = Data_1.TestCards.giftCard2Manual();
1338
+ return new Promise(function (resolve, reject) {
1339
+ card
1340
+ .charge(2.0)
1341
+ .withCurrency("USD")
1342
+ .execute()
1343
+ .then(function (response) {
1344
+ t.truthy(response);
1345
+ t.is(response.responseCode, "00");
1346
+ resolve();
1347
+ })
1348
+ .catch(reject);
1349
+ });
1350
+ });
1351
+ test("052 - sale gift 1 void", function (t) {
1352
+ t.plan(4);
1353
+ var card = Data_1.TestCards.giftCard1Swipe();
1354
+ return new Promise(function (resolve, reject) {
1355
+ card
1356
+ .charge(3.0)
1357
+ .withCurrency("USD")
1358
+ .execute()
1359
+ .then(function (response) {
1360
+ t.truthy(response);
1361
+ t.is(response.responseCode, "00");
1362
+ return response;
1363
+ })
1364
+ .then(function (response) {
1365
+ response
1366
+ .void()
1367
+ .execute()
1368
+ .then(function (voidResponse) {
1369
+ t.truthy(voidResponse);
1370
+ t.is(voidResponse.responseCode, "00");
1371
+ resolve();
1372
+ })
1373
+ .catch(reject);
1374
+ })
1375
+ .catch(reject);
1376
+ });
1377
+ });
1378
+ test("053 - sale gift 2 void", function (t) {
1379
+ t.plan(4);
1380
+ var card = Data_1.TestCards.giftCard2Manual();
1381
+ return new Promise(function (resolve, reject) {
1382
+ card
1383
+ .charge(4.0)
1384
+ .withCurrency("USD")
1385
+ .execute()
1386
+ .then(function (response) {
1387
+ t.truthy(response);
1388
+ t.is(response.responseCode, "00");
1389
+ return response;
1390
+ })
1391
+ .then(function (response) {
1392
+ response
1393
+ .reverse(4.0)
1394
+ .execute()
1395
+ .then(function (reversalResponse) {
1396
+ t.truthy(reversalResponse);
1397
+ t.is(reversalResponse.responseCode, "00");
1398
+ resolve();
1399
+ })
1400
+ .catch(reject);
1401
+ })
1402
+ .catch(reject);
1403
+ });
1404
+ });
1405
+ /// VOID
1406
+ test("054 - void gift", function () { return true; });
1407
+ /// REVERSAL
1408
+ test("055 - reversal gift", function () { return true; });
1409
+ test("056 - reversal gift 2", function (t) {
1410
+ t.plan(4);
1411
+ var card = Data_1.TestCards.giftCard2Manual();
1412
+ return new Promise(function (resolve, reject) {
1413
+ // setup
1414
+ card
1415
+ .charge(2.0)
1416
+ .withCurrency("USD")
1417
+ .execute()
1418
+ .then(function (response) {
1419
+ t.truthy(response);
1420
+ t.is(response.responseCode, "00");
1421
+ })
1422
+ .then(function () {
1423
+ // reverse based on card, not transaction id
1424
+ card
1425
+ .reverse(2.0)
1426
+ .execute()
1427
+ .then(function (response) {
1428
+ t.truthy(response);
1429
+ t.is(response.responseCode, "00");
1430
+ resolve();
1431
+ })
1432
+ .catch(reject);
1433
+ })
1434
+ .catch(reject);
1435
+ });
1436
+ });
1437
+ /// DEACTIVATE
1438
+ test("057 - deactivate gift 1", function (t) {
1439
+ t.plan(2);
1440
+ var card = Data_1.TestCards.giftCard1Swipe();
1441
+ return new Promise(function (resolve, reject) {
1442
+ card
1443
+ .deactivate()
1444
+ .execute()
1445
+ .then(function (response) {
1446
+ t.truthy(response);
1447
+ t.is(response.responseCode, "00");
1448
+ resolve();
1449
+ })
1450
+ .catch(reject);
1451
+ });
1452
+ });
1453
+ /// RECEIPTS MESSAGING
1454
+ test("058 - receipts messaging", function () { return true; });
1455
+ /// REWARD
1456
+ /// BALANCE INQUIRY
1457
+ test("059 - balance inquiry rewards 1", function (t) {
1458
+ t.plan(3);
1459
+ var card = Data_1.TestCards.giftCard1Swipe();
1460
+ return new Promise(function (resolve, reject) {
1461
+ card
1462
+ .balanceInquiry()
1463
+ .execute()
1464
+ .then(function (response) {
1465
+ t.truthy(response);
1466
+ t.is(response.responseCode, "00");
1467
+ t.is(response.pointsBalanceAmount, "0");
1468
+ resolve();
1469
+ })
1470
+ .catch(reject);
1471
+ });
1472
+ });
1473
+ test("060 - balance inquiry rewards 2", function (t) {
1474
+ t.plan(3);
1475
+ var card = Data_1.TestCards.giftCard2Manual();
1476
+ return new Promise(function (resolve, reject) {
1477
+ card
1478
+ .balanceInquiry()
1479
+ .execute()
1480
+ .then(function (response) {
1481
+ t.truthy(response);
1482
+ t.is(response.responseCode, "00");
1483
+ t.is(response.pointsBalanceAmount, "0");
1484
+ resolve();
1485
+ })
1486
+ .catch(reject);
1487
+ });
1488
+ });
1489
+ /// ALIAS
1490
+ test("061 - create alias gift 1", function (t) {
1491
+ t.plan(1);
1492
+ return new Promise(function (resolve, reject) {
1493
+ src_1.GiftCard.create("9725550100")
1494
+ .then(function (response) {
1495
+ t.truthy(response);
1496
+ resolve();
1497
+ })
1498
+ .catch(reject);
1499
+ });
1500
+ });
1501
+ test("062 - create alias gift 2", function (t) {
1502
+ t.plan(1);
1503
+ return new Promise(function (resolve, reject) {
1504
+ src_1.GiftCard.create("9725550100")
1505
+ .then(function (response) {
1506
+ t.truthy(response);
1507
+ resolve();
1508
+ })
1509
+ .catch(reject);
1510
+ });
1511
+ });
1512
+ test("063 - add alias gift 1", function (t) {
1513
+ t.plan(2);
1514
+ var card = Data_1.TestCards.giftCard1Swipe();
1515
+ return new Promise(function (resolve, reject) {
1516
+ card
1517
+ .addAlias("9725550100")
1518
+ .execute()
1519
+ .then(function (response) {
1520
+ t.truthy(response);
1521
+ t.is(response.responseCode, "00");
1522
+ resolve();
1523
+ })
1524
+ .catch(reject);
1525
+ });
1526
+ });
1527
+ test("064 - add alias gift 2", function (t) {
1528
+ t.plan(2);
1529
+ var card = Data_1.TestCards.giftCard2Manual();
1530
+ return new Promise(function (resolve, reject) {
1531
+ card
1532
+ .addAlias("9725550100")
1533
+ .execute()
1534
+ .then(function (response) {
1535
+ t.truthy(response);
1536
+ t.is(response.responseCode, "00");
1537
+ resolve();
1538
+ })
1539
+ .catch(reject);
1540
+ });
1541
+ });
1542
+ test("065 - delete alias gift 1", function (t) {
1543
+ t.plan(2);
1544
+ var card = Data_1.TestCards.giftCard1Swipe();
1545
+ return new Promise(function (resolve, reject) {
1546
+ card
1547
+ .removeAlias("9725550100")
1548
+ .execute()
1549
+ .then(function (response) {
1550
+ t.truthy(response);
1551
+ t.is(response.responseCode, "00");
1552
+ resolve();
1553
+ })
1554
+ .catch(reject);
1555
+ });
1556
+ });
1557
+ /// SALE
1558
+ test("066 - redeem points gift 1", function (t) {
1559
+ t.plan(2);
1560
+ var card = Data_1.TestCards.giftCard1Swipe();
1561
+ return new Promise(function (resolve, reject) {
1562
+ card
1563
+ .charge(100)
1564
+ .withCurrency("points")
1565
+ .execute()
1566
+ .then(function (response) {
1567
+ t.truthy(response);
1568
+ t.is(response.responseCode, "00");
1569
+ resolve();
1570
+ })
1571
+ .catch(reject);
1572
+ });
1573
+ });
1574
+ test("067 - redeem points gift 2", function (t) {
1575
+ t.plan(2);
1576
+ var card = Data_1.TestCards.giftCard2Manual();
1577
+ return new Promise(function (resolve, reject) {
1578
+ card
1579
+ .charge(200)
1580
+ .withCurrency("points")
1581
+ .execute()
1582
+ .then(function (response) {
1583
+ t.truthy(response);
1584
+ t.is(response.responseCode, "00");
1585
+ resolve();
1586
+ })
1587
+ .catch(reject);
1588
+ });
1589
+ });
1590
+ test("068 - redeem points gift 2", function (t) {
1591
+ t.plan(2);
1592
+ var card = new src_1.GiftCard();
1593
+ card.alias = "9725550100";
1594
+ return new Promise(function (resolve, reject) {
1595
+ card
1596
+ .charge(300)
1597
+ .withCurrency("points")
1598
+ .execute()
1599
+ .then(function (response) {
1600
+ t.truthy(response);
1601
+ t.is(response.responseCode, "00");
1602
+ resolve();
1603
+ })
1604
+ .catch(reject);
1605
+ });
1606
+ });
1607
+ /// REWARDS
1608
+ test("069 - rewards gift 1", function (t) {
1609
+ t.plan(2);
1610
+ var card = Data_1.TestCards.giftCard1Swipe();
1611
+ return new Promise(function (resolve, reject) {
1612
+ card
1613
+ .rewards(10)
1614
+ .execute()
1615
+ .then(function (response) {
1616
+ t.truthy(response);
1617
+ t.is(response.responseCode, "00");
1618
+ resolve();
1619
+ })
1620
+ .catch(reject);
1621
+ });
1622
+ });
1623
+ test("070 - rewards gift 2", function (t) {
1624
+ t.plan(2);
1625
+ var card = Data_1.TestCards.giftCard2Manual();
1626
+ return new Promise(function (resolve, reject) {
1627
+ card
1628
+ .rewards(11)
1629
+ .execute()
1630
+ .then(function (response) {
1631
+ t.truthy(response);
1632
+ t.is(response.responseCode, "00");
1633
+ resolve();
1634
+ })
1635
+ .catch(reject);
1636
+ });
1637
+ });
1638
+ /// REPLACE / TRANSFER
1639
+ test("071 - replace rewards 1", function (t) {
1640
+ t.plan(2);
1641
+ var card = Data_1.TestCards.giftCard1Swipe();
1642
+ return new Promise(function (resolve, reject) {
1643
+ card
1644
+ .replaceWith(Data_1.TestCards.giftCard2Manual())
1645
+ .execute()
1646
+ .then(function (response) {
1647
+ t.truthy(response);
1648
+ t.is(response.responseCode, "00");
1649
+ resolve();
1650
+ })
1651
+ .catch(reject);
1652
+ });
1653
+ });
1654
+ test("072 - replace rewards 2", function (t) {
1655
+ t.plan(2);
1656
+ var card = Data_1.TestCards.giftCard2Manual();
1657
+ return new Promise(function (resolve, reject) {
1658
+ card
1659
+ .replaceWith(Data_1.TestCards.giftCard1Swipe())
1660
+ .execute()
1661
+ .then(function (response) {
1662
+ t.truthy(response);
1663
+ t.is(response.responseCode, "00");
1664
+ resolve();
1665
+ })
1666
+ .catch(reject);
1667
+ });
1668
+ });
1669
+ /// DEACTIVATE
1670
+ test("073 - deactivate rewards 1", function (t) {
1671
+ t.plan(2);
1672
+ var card = Data_1.TestCards.giftCard1Swipe();
1673
+ return new Promise(function (resolve, reject) {
1674
+ card
1675
+ .deactivate()
1676
+ .execute()
1677
+ .then(function (response) {
1678
+ t.truthy(response);
1679
+ t.is(response.responseCode, "00");
1680
+ resolve();
1681
+ })
1682
+ .catch(reject);
1683
+ });
1684
+ });
1685
+ test("074 - deactivate rewards 2", function (t) {
1686
+ t.plan(2);
1687
+ var card = Data_1.TestCards.giftCard2Manual();
1688
+ return new Promise(function (resolve, reject) {
1689
+ card
1690
+ .deactivate()
1691
+ .execute()
1692
+ .then(function (response) {
1693
+ t.truthy(response);
1694
+ t.is(response.responseCode, "00");
1695
+ resolve();
1696
+ })
1697
+ .catch(reject);
1698
+ });
1699
+ });
1700
+ /// RECEIPTS MESSAGING
1701
+ test("075 - receipts messaging", function () { return true; });
1702
+ test.after("999 - close batch", function (t) {
1703
+ t.plan(1);
1704
+ return new Promise(function (resolve, reject) {
1705
+ src_1.BatchService.closeBatch()
1706
+ .then(function (response) {
1707
+ t.truthy(response);
1708
+ resolve();
1709
+ })
1710
+ .catch(function (e) {
1711
+ if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
1712
+ e.message.indexOf(BATCH_EMPTY) !== -1) {
1713
+ t.pass();
1714
+ resolve();
1715
+ return;
1716
+ }
1717
+ reject(e);
1718
+ });
1719
+ });
1720
+ });