globalpayments-api 3.10.2 → 3.10.4

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