globalpayments-api 3.10.0 → 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 (214) hide show
  1. package/CHANGELOG.md +184 -170
  2. package/appsec.properties +8 -0
  3. package/lib/src/Entities/index.d.ts +4 -0
  4. package/lib/src/Entities/index.js +4 -0
  5. package/lib/src/Entities/index.js.map +1 -1
  6. package/lib/src/Gateways/PorticoConnector.d.ts +3 -3
  7. package/lib/src/Gateways/PorticoConnector.js +24 -0
  8. package/lib/src/Gateways/PorticoConnector.js.map +1 -1
  9. package/lib/src/Gateways/RealexConnector.d.ts +30 -0
  10. package/lib/src/Gateways/RealexConnector.js +523 -0
  11. package/lib/src/PaymentMethods/Credit.d.ts +2 -1
  12. package/lib/src/PaymentMethods/Credit.js +1 -0
  13. package/lib/src/PaymentMethods/Credit.js.map +1 -1
  14. package/lib/src/ServicesConfig.d.ts +27 -0
  15. package/lib/src/ServicesConfig.js +50 -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/AchTest.d.ts +1 -1
  20. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +112 -59
  21. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +1 -1
  22. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +483 -378
  23. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +1 -1
  24. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +83 -86
  25. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +1 -1
  26. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +1720 -1723
  27. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +1 -1
  28. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +83 -86
  29. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +1 -1
  30. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +1757 -1760
  31. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +1 -1
  32. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +682 -420
  33. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +1 -1
  34. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +2218 -2221
  35. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +36 -8
  36. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -1
  37. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +1 -1
  38. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +707 -392
  39. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +1 -1
  40. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +151 -88
  41. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +1 -1
  42. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +171 -72
  43. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +8 -8
  44. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +1 -1
  45. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +192 -143
  46. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +1 -1
  47. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +377 -147
  48. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +1 -1
  49. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +196 -101
  50. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +1 -1
  51. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +53 -50
  52. package/lib/test/Integration/Gateways/{GpApiConnector/3DS2Test.d.ts → ProPayConnector/Certifications/GetInformationCertificationTests.d.ts} +1 -1
  53. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.js +100 -0
  54. package/lib/test/Integration/Gateways/{GpApiConnector/AccessTokenTest.d.ts → ProPayConnector/Certifications/ProPayAccountCertificationTests.d.ts} +1 -1
  55. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.js +352 -0
  56. package/lib/test/Integration/Gateways/{GpApiConnector/CreditCardNotPresentTest.d.ts → ProPayConnector/Certifications/ProPayFundCertificationTests.d.ts} +1 -1
  57. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.js +123 -0
  58. package/lib/test/Integration/Gateways/{GpApiConnector/3DSecureTest.d.ts → ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.d.ts} +1 -1
  59. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.js +142 -0
  60. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.d.ts +1 -0
  61. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.js +100 -0
  62. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.d.ts +1 -0
  63. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.js +535 -0
  64. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.d.ts +1 -0
  65. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.js +124 -0
  66. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.d.ts +1 -0
  67. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.js +144 -0
  68. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/AuthTest.d.ts +1 -1
  69. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.js +4373 -0
  70. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/AvsTest.d.ts +1 -1
  71. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.js +758 -0
  72. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/CreditTest.d.ts +1 -1
  73. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.js +2399 -0
  74. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/HoldTest.d.ts +1 -1
  75. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.js +1656 -0
  76. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.d.ts +1 -0
  77. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.js +5650 -0
  78. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.d.ts +1 -0
  79. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.js +1985 -0
  80. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.d.ts +1 -0
  81. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.js +2369 -0
  82. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.d.ts +1 -0
  83. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.js +1703 -0
  84. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.d.ts +1 -0
  85. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.js +2053 -0
  86. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.d.ts +1 -0
  87. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.js +2469 -0
  88. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.d.ts +1 -0
  89. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.js +3116 -0
  90. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.d.ts +1 -0
  91. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.js +2031 -0
  92. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/CreditTest.d.ts +1 -1
  93. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.js +322 -0
  94. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/HppTest.d.ts +1 -1
  95. package/lib/test/Integration/Gateways/RealexConnector/HppTest.js +98 -0
  96. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/RecurringTest.d.ts +1 -1
  97. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.js +263 -0
  98. package/lib/test/Integration/Services/CheckServiceTest.d.ts +1 -1
  99. package/lib/test/Integration/Services/CheckServiceTest.js +98 -45
  100. package/lib/test/Integration/Services/CreditServiceTest.d.ts +1 -1
  101. package/lib/test/Integration/Services/CreditServiceTest.js +313 -174
  102. package/lib/test/Integration/Services/DebitServiceTest.d.ts +1 -1
  103. package/lib/test/Integration/Services/DebitServiceTest.js +154 -81
  104. package/lib/test/Integration/Services/EBTServiceTest.d.ts +1 -1
  105. package/lib/test/Integration/Services/EBTServiceTest.js +135 -64
  106. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +1 -1
  107. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +161 -111
  108. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +1 -1
  109. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +139 -62
  110. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +1 -1
  111. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +202 -125
  112. package/lib/test/Unit/Gateways/{GpEcomConnector → RealexConnector}/CreditTest.d.ts +1 -1
  113. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.js +29 -0
  114. package/package.json +62 -62
  115. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js +0 -1029
  116. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js.map +0 -1
  117. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js +0 -649
  118. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js.map +0 -1
  119. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js +0 -109
  120. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js.map +0 -1
  121. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js +0 -1025
  122. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js.map +0 -1
  123. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.d.ts +0 -1
  124. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js +0 -439
  125. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js.map +0 -1
  126. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.d.ts +0 -1
  127. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js +0 -143
  128. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js.map +0 -1
  129. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.d.ts +0 -1
  130. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js +0 -639
  131. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js.map +0 -1
  132. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.d.ts +0 -1
  133. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js +0 -149
  134. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js.map +0 -1
  135. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.d.ts +0 -1
  136. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js +0 -226
  137. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js.map +0 -1
  138. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.d.ts +0 -1
  139. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js +0 -434
  140. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js.map +0 -1
  141. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.d.ts +0 -1
  142. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js +0 -217
  143. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js.map +0 -1
  144. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.d.ts +0 -1
  145. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js +0 -338
  146. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js.map +0 -1
  147. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js +0 -2446
  148. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js.map +0 -1
  149. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js +0 -506
  150. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js.map +0 -1
  151. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js +0 -1296
  152. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js.map +0 -1
  153. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js +0 -847
  154. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js.map +0 -1
  155. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js +0 -215
  156. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
  157. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js +0 -99
  158. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js.map +0 -1
  159. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js +0 -133
  160. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js.map +0 -1
  161. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js.map +0 -1
  162. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js.map +0 -1
  163. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js.map +0 -1
  164. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js.map +0 -1
  165. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js.map +0 -1
  166. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js.map +0 -1
  167. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js.map +0 -1
  168. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js.map +0 -1
  169. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js.map +0 -1
  170. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js.map +0 -1
  171. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js.map +0 -1
  172. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js.map +0 -1
  173. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js.map +0 -1
  174. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.d.ts +0 -1
  175. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js +0 -48
  176. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js.map +0 -1
  177. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js.map +0 -1
  178. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js.map +0 -1
  179. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.d.ts +0 -1
  180. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js +0 -44
  181. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js.map +0 -1
  182. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.d.ts +0 -1
  183. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js +0 -221
  184. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js.map +0 -1
  185. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.d.ts +0 -1
  186. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js +0 -60
  187. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js.map +0 -1
  188. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.d.ts +0 -1
  189. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js +0 -80
  190. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js.map +0 -1
  191. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.d.ts +0 -1
  192. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js +0 -44
  193. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js.map +0 -1
  194. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.d.ts +0 -1
  195. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js +0 -330
  196. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js.map +0 -1
  197. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.d.ts +0 -1
  198. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js +0 -60
  199. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js.map +0 -1
  200. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.d.ts +0 -1
  201. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js +0 -80
  202. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js.map +0 -1
  203. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.d.ts +0 -1
  204. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js +0 -149
  205. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js.map +0 -1
  206. package/lib/test/Integration/Services/CheckServiceTest.js.map +0 -1
  207. package/lib/test/Integration/Services/CreditServiceTest.js.map +0 -1
  208. package/lib/test/Integration/Services/DebitServiceTest.js.map +0 -1
  209. package/lib/test/Integration/Services/EBTServiceTest.js.map +0 -1
  210. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js.map +0 -1
  211. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js.map +0 -1
  212. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js +0 -34
  213. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
  214. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js.map +0 -1
@@ -1,2221 +1,2218 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ava_1 = __importDefault(require("ava"));
7
- const src_1 = require("../../../../../src/");
8
- const Data_1 = require("../../../../Data/");
9
- const config = new src_1.PorticoConfig();
10
- config.secretApiKey = "skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
11
- const BATCH_NOT_OPEN = "Transaction was rejected because it requires a batch to be open.";
12
- const BATCH_EMPTY = "Batch close was rejected because no transactions are associated with the currently open batch";
13
- const runSerially = false;
14
- const test = runSerially ? ava_1.default.serial : ava_1.default;
15
- const useTokens = false;
16
- let visaToken = "";
17
- let masterCardToken = "";
18
- let discoverToken = "";
19
- let amexToken = "";
20
- ava_1.default.before(() => {
21
- src_1.ServicesContainer.configureService(config);
22
- });
23
- test.before("000 - close batch", (t) => {
24
- t.plan(1);
25
- return new Promise((resolve, reject) => {
26
- src_1.BatchService.closeBatch()
27
- .then((response) => {
28
- t.truthy(response);
29
- resolve();
30
- })
31
- .catch((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
- /// CREDIT CARD FUNCTIONS
43
- /// CARD VERIFY
44
- /// ACCOUNT VERIFICATION
45
- test("001 - card verify visa", (t) => {
46
- t.plan(5);
47
- const card = Data_1.TestCards.visaSwipeEncrypted();
48
- return card
49
- .verify()
50
- .withAllowDuplicates(true)
51
- .withRequestMultiUseToken(useTokens)
52
- .execute()
53
- .then((response) => {
54
- t.truthy(response);
55
- t.is(response.responseCode, "00");
56
- return response;
57
- })
58
- .then((response) => {
59
- if (!useTokens) {
60
- t.plan(2);
61
- return;
62
- }
63
- t.truthy(response.token);
64
- const token = new src_1.CreditCardData();
65
- token.token = response.token;
66
- return token
67
- .charge(15.01)
68
- .withAllowDuplicates(true)
69
- .execute()
70
- .then((chargeResponse) => {
71
- t.truthy(chargeResponse);
72
- t.is(chargeResponse.responseCode, "00");
73
- });
74
- });
75
- });
76
- test("002 - card verify mastercard", (t) => {
77
- t.plan(5);
78
- const card = Data_1.TestCards.masterCardSwipeEncrypted();
79
- return card
80
- .verify()
81
- .withAllowDuplicates(true)
82
- .withRequestMultiUseToken(useTokens)
83
- .execute()
84
- .then((response) => {
85
- t.truthy(response);
86
- t.is(response.responseCode, "00");
87
- return response;
88
- })
89
- .then((response) => {
90
- if (!useTokens) {
91
- t.plan(2);
92
- return;
93
- }
94
- t.truthy(response.token);
95
- const token = new src_1.CreditCardData();
96
- token.token = response.token;
97
- return token
98
- .charge(15.02)
99
- .withAllowDuplicates(true)
100
- .execute()
101
- .then((chargeResponse) => {
102
- t.truthy(chargeResponse);
103
- t.is(chargeResponse.responseCode, "00");
104
- });
105
- });
106
- });
107
- test("003 - card verify discover", (t) => {
108
- t.plan(5);
109
- const card = Data_1.TestCards.discoverSwipeEncrypted();
110
- return card
111
- .verify()
112
- .withAllowDuplicates(true)
113
- .withRequestMultiUseToken(useTokens)
114
- .execute()
115
- .then((response) => {
116
- t.truthy(response);
117
- t.is(response.responseCode, "00");
118
- return response;
119
- })
120
- .then((response) => {
121
- if (!useTokens) {
122
- t.plan(2);
123
- return;
124
- }
125
- t.truthy(response.token);
126
- const token = new src_1.CreditCardData();
127
- token.token = response.token;
128
- return token
129
- .charge(15.03)
130
- .withAllowDuplicates(true)
131
- .execute()
132
- .then((chargeResponse) => {
133
- t.truthy(chargeResponse);
134
- t.is(chargeResponse.responseCode, "00");
135
- });
136
- });
137
- });
138
- /// Address Verification
139
- test("004 - card verify amex", (t) => {
140
- t.plan(5);
141
- const address = new src_1.Address();
142
- address.postalCode = "75024";
143
- const card = Data_1.TestCards.amexManual(false, true);
144
- return card
145
- .verify()
146
- .withAllowDuplicates(true)
147
- .withAddress(address)
148
- .withRequestMultiUseToken(useTokens)
149
- .execute()
150
- .then((response) => {
151
- t.truthy(response);
152
- t.is(response.responseCode, "00");
153
- return response;
154
- })
155
- .then((response) => {
156
- if (!useTokens) {
157
- t.plan(2);
158
- return;
159
- }
160
- t.truthy(response.token);
161
- const token = new src_1.CreditCardData();
162
- token.token = response.token;
163
- return token
164
- .charge(15.04)
165
- .withAllowDuplicates(true)
166
- .execute()
167
- .then((chargeResponse) => {
168
- t.truthy(chargeResponse);
169
- t.is(chargeResponse.responseCode, "00");
170
- });
171
- });
172
- });
173
- /// Balance Inquiry (for Prepaid)
174
- test("005 - balance inquiry visa", (t) => {
175
- t.plan(2);
176
- const card = Data_1.TestCards.visaSwipeEncrypted();
177
- return card
178
- .balanceInquiry()
179
- .execute()
180
- .then((response) => {
181
- t.truthy(response);
182
- t.is(response.responseCode, "00");
183
- });
184
- });
185
- /// CREDIT SALE (for multi-use token only)
186
- test("006 - charge visa swipe token", (t) => {
187
- t.plan(2);
188
- const card = Data_1.TestCards.visaSwipe();
189
- return card
190
- .charge(15.01)
191
- .withCurrency("USD")
192
- .withRequestMultiUseToken(true)
193
- .withAllowDuplicates(true)
194
- .execute()
195
- .then((response) => {
196
- t.truthy(response);
197
- t.is(response.responseCode, "00");
198
- visaToken = response.token;
199
- });
200
- });
201
- test("007 - charge mastercard swipe token", (t) => {
202
- t.plan(2);
203
- const card = Data_1.TestCards.masterCardSwipe();
204
- return card
205
- .charge(15.02)
206
- .withCurrency("USD")
207
- .withRequestMultiUseToken(true)
208
- .withAllowDuplicates(true)
209
- .execute()
210
- .then((response) => {
211
- t.truthy(response);
212
- t.is(response.responseCode, "00");
213
- masterCardToken = response.token;
214
- });
215
- });
216
- test("008 - charge discover swipe token", (t) => {
217
- t.plan(2);
218
- const card = Data_1.TestCards.discoverSwipe();
219
- return card
220
- .charge(15.03)
221
- .withCurrency("USD")
222
- .withRequestMultiUseToken(true)
223
- .withAllowDuplicates(true)
224
- .execute()
225
- .then((response) => {
226
- t.truthy(response);
227
- t.is(response.responseCode, "00");
228
- discoverToken = response.token;
229
- });
230
- });
231
- test("009 - charge amex swipe token", (t) => {
232
- t.plan(2);
233
- const card = Data_1.TestCards.amexSwipe();
234
- return card
235
- .charge(15.04)
236
- .withCurrency("USD")
237
- .withRequestMultiUseToken(true)
238
- .withAllowDuplicates(true)
239
- .execute()
240
- .then((response) => {
241
- t.truthy(response);
242
- t.is(response.responseCode, "00");
243
- amexToken = response.token;
244
- });
245
- });
246
- /// CREDIT SALE
247
- /// SWIPED
248
- test("010 - charge visa swipe", (t) => {
249
- t.plan(4);
250
- const card = Data_1.TestCards.visaSwipe();
251
- return card
252
- .charge(15.01)
253
- .withCurrency("USD")
254
- .withAllowDuplicates(true)
255
- .execute()
256
- .then((response) => {
257
- t.truthy(response);
258
- t.is(response.responseCode, "00");
259
- return response;
260
- })
261
- .then((response) => {
262
- // test 059
263
- return (response
264
- .reverse(15.01)
265
- // .withAllowDuplicates(true)
266
- .execute()
267
- .then((reverseResponse) => {
268
- t.truthy(reverseResponse);
269
- t.is(reverseResponse.responseCode, "00");
270
- }));
271
- });
272
- });
273
- test("011 - charge mastercard swipe", (t) => {
274
- t.plan(2);
275
- const card = Data_1.TestCards.masterCardSwipe();
276
- return card
277
- .charge(15.02)
278
- .withCurrency("USD")
279
- .withAllowDuplicates(true)
280
- .execute()
281
- .then((response) => {
282
- t.truthy(response);
283
- t.is(response.responseCode, "00");
284
- });
285
- });
286
- test("012 - charge discover swipe", (t) => {
287
- t.plan(2);
288
- const card = Data_1.TestCards.discoverSwipe();
289
- return card
290
- .charge(15.02)
291
- .withCurrency("USD")
292
- .withAllowDuplicates(true)
293
- .execute()
294
- .then((response) => {
295
- t.truthy(response);
296
- t.is(response.responseCode, "00");
297
- });
298
- });
299
- test("013 - charge amex swipe", (t) => {
300
- t.plan(2);
301
- const card = Data_1.TestCards.amexSwipe();
302
- return card
303
- .charge(15.02)
304
- .withCurrency("USD")
305
- .withAllowDuplicates(true)
306
- .execute()
307
- .then((response) => {
308
- t.truthy(response);
309
- t.is(response.responseCode, "00");
310
- });
311
- });
312
- test("014 - charge jcb swipe", (t) => {
313
- t.plan(4);
314
- const card = Data_1.TestCards.visaSwipe();
315
- return card
316
- .charge(15.05)
317
- .withCurrency("USD")
318
- .withAllowDuplicates(true)
319
- .execute()
320
- .then((response) => {
321
- t.truthy(response);
322
- t.is(response.responseCode, "00");
323
- return response;
324
- })
325
- .then((response) => {
326
- // test 058
327
- return (response
328
- .refund(15.05)
329
- // .withAllowDuplicates(true)
330
- .withCurrency("USD")
331
- .execute()
332
- .then((refundResponse) => {
333
- t.truthy(refundResponse);
334
- t.is(refundResponse.responseCode, "00");
335
- }));
336
- });
337
- });
338
- test("014a - charge mastercard 24 swipe", (t) => {
339
- t.plan(2);
340
- const card = Data_1.TestCards.masterCard24Swipe();
341
- return card
342
- .charge(15.34)
343
- .withCurrency("USD")
344
- .withAllowDuplicates(true)
345
- .execute()
346
- .then((response) => {
347
- t.truthy(response);
348
- t.is(response.responseCode, "00");
349
- });
350
- });
351
- test("014b - charge mastercard 25 swipe", (t) => {
352
- t.plan(2);
353
- const card = Data_1.TestCards.masterCard25Swipe();
354
- return card
355
- .charge(15.34)
356
- .withCurrency("USD")
357
- .withAllowDuplicates(true)
358
- .execute()
359
- .then((response) => {
360
- t.truthy(response);
361
- t.is(response.responseCode, "00");
362
- });
363
- });
364
- test("015 - charge visa swipe", (t) => {
365
- t.plan(4);
366
- const card = Data_1.TestCards.visaSwipe();
367
- return card
368
- .charge(15.06)
369
- .withCurrency("USD")
370
- .withAllowDuplicates(true)
371
- .execute()
372
- .then((response) => {
373
- t.truthy(response);
374
- t.is(response.responseCode, "00");
375
- return response;
376
- })
377
- .then((response) => {
378
- // test 063
379
- return (response
380
- .reverse(15.06)
381
- // .withAllowDuplicates(true)
382
- .withAuthAmount(5.06)
383
- .execute()
384
- .then((reverseResponse) => {
385
- t.truthy(reverseResponse);
386
- t.is(reverseResponse.responseCode, "00");
387
- }));
388
- });
389
- });
390
- /// Manually Entered - Card Present
391
- test("016 - charge visa manual card present", (t) => {
392
- t.plan(2);
393
- const address = new src_1.Address();
394
- address.postalCode = "750241234";
395
- address.streetAddress1 = "6860 Dallas Pkwy";
396
- const card = Data_1.TestCards.visaManual(true, true);
397
- return card
398
- .charge(16.01)
399
- .withAllowDuplicates(true)
400
- .withCurrency("USD")
401
- .withAddress(address)
402
- .execute()
403
- .then((response) => {
404
- t.truthy(response);
405
- t.is(response.responseCode, "00");
406
- });
407
- });
408
- test("017 - charge mastercard manual card present", (t) => {
409
- t.plan(4);
410
- const address = new src_1.Address();
411
- address.postalCode = "75024";
412
- address.streetAddress1 = "6860 Dallas Pkwy";
413
- const card = Data_1.TestCards.masterCardManual(true, true);
414
- return card
415
- .charge(16.02)
416
- .withAllowDuplicates(true)
417
- .withCurrency("USD")
418
- .withAddress(address)
419
- .execute()
420
- .then((response) => {
421
- t.truthy(response);
422
- t.is(response.responseCode, "00");
423
- return response;
424
- })
425
- .then((response) => {
426
- // test case 60
427
- return (response
428
- .reverse(16.02)
429
- // .withAllowDuplicates(true)
430
- .execute()
431
- .then((reverseResponse) => {
432
- t.truthy(reverseResponse);
433
- t.is(reverseResponse.responseCode, "00");
434
- }));
435
- });
436
- });
437
- test("018 - charge discover manual card present", (t) => {
438
- t.plan(2);
439
- const address = new src_1.Address();
440
- address.postalCode = "750241234";
441
- const card = Data_1.TestCards.discoverManual(true, true);
442
- return card
443
- .charge(16.03)
444
- .withAllowDuplicates(true)
445
- .withCurrency("USD")
446
- .withAddress(address)
447
- .execute()
448
- .then((response) => {
449
- t.truthy(response);
450
- t.is(response.responseCode, "00");
451
- });
452
- });
453
- test("019 - charge amex manual card present", (t) => {
454
- t.plan(2);
455
- const address = new src_1.Address();
456
- address.postalCode = "75024";
457
- address.streetAddress1 = "6860";
458
- const card = Data_1.TestCards.amexManual(true, true);
459
- return card
460
- .charge(16.04)
461
- .withAllowDuplicates(true)
462
- .withCurrency("USD")
463
- .withAddress(address)
464
- .execute()
465
- .then((response) => {
466
- t.truthy(response);
467
- t.is(response.responseCode, "00");
468
- });
469
- });
470
- test("020 - charge jcb manual card present", (t) => {
471
- t.plan(2);
472
- const address = new src_1.Address();
473
- address.postalCode = "75024";
474
- const card = Data_1.TestCards.jcbManual(true, true);
475
- return card
476
- .charge(16.05)
477
- .withAllowDuplicates(true)
478
- .withCurrency("USD")
479
- .withAddress(address)
480
- .execute()
481
- .then((response) => {
482
- t.truthy(response);
483
- t.is(response.responseCode, "00");
484
- });
485
- });
486
- test("021 - charge discover manual card present", (t) => {
487
- t.plan(4);
488
- const address = new src_1.Address();
489
- address.postalCode = "750241234";
490
- address.streetAddress1 = "6860 Dallas Pkwy";
491
- const card = Data_1.TestCards.discoverManual(true, true);
492
- return card
493
- .charge(16.07)
494
- .withAllowDuplicates(true)
495
- .withCurrency("USD")
496
- .withAddress(address)
497
- .execute()
498
- .then((response) => {
499
- t.truthy(response);
500
- t.is(response.responseCode, "00");
501
- return response;
502
- })
503
- .then((response) => {
504
- // test case 64
505
- return (response
506
- .reverse(16.07)
507
- // .withAllowDuplicates(true)
508
- .withAuthAmount(6.07)
509
- .execute()
510
- .then((reverseResponse) => {
511
- t.truthy(reverseResponse);
512
- t.is(reverseResponse.responseCode, "00");
513
- }));
514
- });
515
- });
516
- /// Manually Entered - Card Not Present
517
- test("022 - charge visa manual card not present", (t) => {
518
- t.plan(2);
519
- const address = new src_1.Address();
520
- address.postalCode = "750241234";
521
- address.streetAddress1 = "6860 Dallas Pkwy";
522
- let card;
523
- if (useTokens) {
524
- card = new src_1.CreditCardData();
525
- card.token = visaToken;
526
- }
527
- else {
528
- card = Data_1.TestCards.visaManual(false, true);
529
- }
530
- return card
531
- .charge(17.01)
532
- .withAllowDuplicates(true)
533
- .withCurrency("USD")
534
- .withAddress(address)
535
- .execute()
536
- .then((response) => {
537
- t.truthy(response);
538
- t.is(response.responseCode, "00");
539
- });
540
- });
541
- test("023 - charge mastercard manual card not present", (t) => {
542
- t.plan(4);
543
- const address = new src_1.Address();
544
- address.postalCode = "75024";
545
- address.streetAddress1 = "6860 Dallas Pkwy";
546
- let card;
547
- if (useTokens) {
548
- card = new src_1.CreditCardData();
549
- card.token = masterCardToken;
550
- }
551
- else {
552
- card = Data_1.TestCards.masterCardManual(false, true);
553
- }
554
- return card
555
- .charge(17.02)
556
- .withAllowDuplicates(true)
557
- .withCurrency("USD")
558
- .withAddress(address)
559
- .execute()
560
- .then((response) => {
561
- t.truthy(response);
562
- t.is(response.responseCode, "00");
563
- return response;
564
- })
565
- .then((response) => {
566
- // test case 61
567
- return (response
568
- .reverse(17.02)
569
- // .withAllowDuplicates(true)
570
- .execute()
571
- .then((reverseResponse) => {
572
- t.truthy(reverseResponse);
573
- t.is(reverseResponse.responseCode, "00");
574
- }));
575
- });
576
- });
577
- test("024 - charge discover manual card not present", (t) => {
578
- t.plan(2);
579
- const address = new src_1.Address();
580
- address.postalCode = "750241234";
581
- let card;
582
- if (useTokens) {
583
- card = new src_1.CreditCardData();
584
- card.token = discoverToken;
585
- }
586
- else {
587
- card = Data_1.TestCards.discoverManual(false, true);
588
- }
589
- return card
590
- .charge(17.03)
591
- .withAllowDuplicates(true)
592
- .withCurrency("USD")
593
- .withAddress(address)
594
- .execute()
595
- .then((response) => {
596
- t.truthy(response);
597
- t.is(response.responseCode, "00");
598
- });
599
- });
600
- test("025 - charge amex manual card not present", (t) => {
601
- t.plan(2);
602
- const address = new src_1.Address();
603
- address.postalCode = "75024";
604
- address.streetAddress1 = "6860";
605
- let card;
606
- if (useTokens) {
607
- card = new src_1.CreditCardData();
608
- card.token = amexToken;
609
- }
610
- else {
611
- card = Data_1.TestCards.amexManual(false, true);
612
- }
613
- return card
614
- .charge(17.04)
615
- .withAllowDuplicates(true)
616
- .withCurrency("USD")
617
- .withAddress(address)
618
- .execute()
619
- .then((response) => {
620
- t.truthy(response);
621
- t.is(response.responseCode, "00");
622
- });
623
- });
624
- test("026 - charge jcb manual card not present", (t) => {
625
- t.plan(2);
626
- const address = new src_1.Address();
627
- address.postalCode = "75024";
628
- const card = Data_1.TestCards.jcbManual(false, true);
629
- return card
630
- .charge(17.05)
631
- .withAllowDuplicates(true)
632
- .withCurrency("USD")
633
- .withAddress(address)
634
- .execute()
635
- .then((response) => {
636
- t.truthy(response);
637
- t.is(response.responseCode, "00");
638
- });
639
- });
640
- /// Contactless
641
- test("027 - charge visa contactless", (t) => {
642
- t.plan(2);
643
- const card = Data_1.TestCards.visaSwipe(src_1.EntryMethod.Proximity);
644
- return card
645
- .charge(18.01)
646
- .withAllowDuplicates(true)
647
- .withCurrency("USD")
648
- .execute()
649
- .then((response) => {
650
- t.truthy(response);
651
- t.is(response.responseCode, "00");
652
- });
653
- });
654
- test("028 - charge mastercard contactless", (t) => {
655
- t.plan(2);
656
- const card = Data_1.TestCards.masterCardSwipe(src_1.EntryMethod.Proximity);
657
- return card
658
- .charge(18.02)
659
- .withAllowDuplicates(true)
660
- .withCurrency("USD")
661
- .execute()
662
- .then((response) => {
663
- t.truthy(response);
664
- t.is(response.responseCode, "00");
665
- });
666
- });
667
- test("029 - charge discover contactless", (t) => {
668
- t.plan(2);
669
- const card = Data_1.TestCards.discoverSwipe(src_1.EntryMethod.Proximity);
670
- return card
671
- .charge(18.03)
672
- .withAllowDuplicates(true)
673
- .withCurrency("USD")
674
- .execute()
675
- .then((response) => {
676
- t.truthy(response);
677
- t.is(response.responseCode, "00");
678
- });
679
- });
680
- test("030 - charge amex contactless", (t) => {
681
- t.plan(2);
682
- const card = Data_1.TestCards.amexSwipe(src_1.EntryMethod.Proximity);
683
- return card
684
- .charge(18.04)
685
- .withAllowDuplicates(true)
686
- .withCurrency("USD")
687
- .execute()
688
- .then((response) => {
689
- t.truthy(response);
690
- t.is(response.responseCode, "00");
691
- });
692
- });
693
- /// AUTHORIZATION
694
- test("031 - authorize visa swipe", (t) => {
695
- t.plan(4);
696
- const card = Data_1.TestCards.visaSwipe();
697
- // 031a authorize
698
- return (card
699
- .authorize(15.08)
700
- .withAllowDuplicates(true)
701
- .withCurrency("USD")
702
- .execute()
703
- .then((response) => {
704
- t.truthy(response);
705
- t.is(response.responseCode, "00");
706
- return response;
707
- })
708
- // 031b capture
709
- .then((response) => {
710
- return response
711
- .capture()
712
- .execute()
713
- .then((captureResponse) => {
714
- t.truthy(captureResponse);
715
- t.is(captureResponse.responseCode, "00");
716
- });
717
- }));
718
- });
719
- test("032 - authorize visa swipe additional auth", (t) => {
720
- t.plan(4);
721
- const card = Data_1.TestCards.visaSwipe();
722
- // 032a authorize
723
- return (card
724
- .authorize(15.09)
725
- .withAllowDuplicates(true)
726
- .withCurrency("USD")
727
- .execute()
728
- .then((response) => {
729
- t.truthy(response);
730
- t.is(response.responseCode, "00");
731
- return response;
732
- })
733
- // 032b Additional Auth (restaurant only)
734
- // 032c Add to batch
735
- .then((response) => {
736
- return response
737
- .capture()
738
- .execute()
739
- .then((captureResponse) => {
740
- t.truthy(captureResponse);
741
- t.is(captureResponse.responseCode, "00");
742
- });
743
- }));
744
- });
745
- test("033 - authorize mastercard swipe", (t) => {
746
- t.plan(4);
747
- const card = Data_1.TestCards.masterCardSwipe();
748
- // 033a authorize
749
- return (card
750
- .authorize(15.1)
751
- .withAllowDuplicates(true)
752
- .withCurrency("USD")
753
- .execute()
754
- .then((response) => {
755
- t.truthy(response);
756
- t.is(response.responseCode, "00");
757
- return response;
758
- })
759
- // 033b capture
760
- .then((response) => {
761
- return response
762
- .capture()
763
- .execute()
764
- .then((captureResponse) => {
765
- t.truthy(captureResponse);
766
- t.is(captureResponse.responseCode, "00");
767
- });
768
- }));
769
- });
770
- test("033a - authorize discover swipe", (t) => {
771
- t.plan(2);
772
- const card = Data_1.TestCards.discoverSwipe();
773
- return card
774
- .authorize(15.1)
775
- .withCurrency("USD")
776
- .withAllowDuplicates(true)
777
- .execute()
778
- .then((response) => {
779
- t.truthy(response);
780
- t.is(response.responseCode, "00");
781
- });
782
- });
783
- /// AUTHORIZATION - Manually Entered, Card Present
784
- test("034 - authorize visa manual card present", (t) => {
785
- t.plan(4);
786
- const address = new src_1.Address();
787
- address.postalCode = "75024";
788
- address.streetAddress1 = "6860 Dallas Pkwy";
789
- const card = Data_1.TestCards.visaManual(true, true);
790
- // 034a authorize
791
- return (card
792
- .authorize(16.08)
793
- .withAllowDuplicates(true)
794
- .withCurrency("USD")
795
- .withAddress(address)
796
- .execute()
797
- .then((response) => {
798
- t.truthy(response);
799
- t.is(response.responseCode, "00");
800
- return response;
801
- })
802
- // 034b capture
803
- .then((response) => {
804
- return response
805
- .capture()
806
- .execute()
807
- .then((captureResponse) => {
808
- t.truthy(captureResponse);
809
- t.is(captureResponse.responseCode, "00");
810
- });
811
- }));
812
- });
813
- test("035 - authorize visa manual card present additional auth", (t) => {
814
- t.plan(4);
815
- const address = new src_1.Address();
816
- address.postalCode = "75024";
817
- address.streetAddress1 = "6860 Dallas Pkwy";
818
- const card = Data_1.TestCards.visaManual(true, true);
819
- // 035a authorize
820
- return (card
821
- .authorize(16.09)
822
- .withAllowDuplicates(true)
823
- .withCurrency("USD")
824
- .withAddress(address)
825
- .execute()
826
- .then((response) => {
827
- t.truthy(response);
828
- t.is(response.responseCode, "00");
829
- return response;
830
- })
831
- // 035b Additional Auth (restaurant only)
832
- // 035c Add to batch
833
- .then((response) => {
834
- return response
835
- .capture()
836
- .execute()
837
- .then((captureResponse) => {
838
- t.truthy(captureResponse);
839
- t.is(captureResponse.responseCode, "00");
840
- });
841
- }));
842
- });
843
- test("036 - authorize mastercard manual card present", (t) => {
844
- t.plan(4);
845
- const address = new src_1.Address();
846
- address.postalCode = "75024";
847
- address.streetAddress1 = "6860 Dallas Pkwy";
848
- const card = Data_1.TestCards.masterCardManual(true, true);
849
- // 036a authorize
850
- return (card
851
- .authorize(16.1)
852
- .withAllowDuplicates(true)
853
- .withCurrency("USD")
854
- .withAddress(address)
855
- .execute()
856
- .then((response) => {
857
- t.truthy(response);
858
- t.is(response.responseCode, "00");
859
- return response;
860
- })
861
- // 036b capture
862
- .then((response) => {
863
- return response
864
- .capture()
865
- .execute()
866
- .then((captureResponse) => {
867
- t.truthy(captureResponse);
868
- t.is(captureResponse.responseCode, "00");
869
- });
870
- }));
871
- });
872
- test("036a - authorize discover manual card present", (t) => {
873
- t.plan(2);
874
- const address = new src_1.Address();
875
- address.postalCode = "750241234";
876
- const card = Data_1.TestCards.discoverManual(true, true);
877
- return card
878
- .authorize(16.1)
879
- .withAllowDuplicates(true)
880
- .withCurrency("USD")
881
- .withAddress(address)
882
- .execute()
883
- .then((response) => {
884
- t.truthy(response);
885
- t.is(response.responseCode, "00");
886
- });
887
- });
888
- /// AUTHORIZATION - Manually Entered, Card Not Present
889
- test("037 - authorize visa manual", (t) => {
890
- t.plan(4);
891
- const address = new src_1.Address();
892
- address.postalCode = "750241234";
893
- address.streetAddress1 = "6860 Dallas Pkwy";
894
- const card = Data_1.TestCards.visaManual(false, true);
895
- // 034a authorize
896
- return (card
897
- .authorize(17.08)
898
- .withAllowDuplicates(true)
899
- .withCurrency("USD")
900
- .withAddress(address)
901
- .execute()
902
- .then((response) => {
903
- t.truthy(response);
904
- t.is(response.responseCode, "00");
905
- return response;
906
- })
907
- // 034b capture
908
- .then((response) => {
909
- return response
910
- .capture()
911
- .execute()
912
- .then((captureResponse) => {
913
- t.truthy(captureResponse);
914
- t.is(captureResponse.responseCode, "00");
915
- });
916
- }));
917
- });
918
- test("038 - authorize mastercard manual", (t) => {
919
- t.plan(4);
920
- const address = new src_1.Address();
921
- address.postalCode = "750241234";
922
- address.streetAddress1 = "6860";
923
- const card = Data_1.TestCards.masterCardManual(false, true);
924
- // 036a authorize
925
- return (card
926
- .authorize(17.09)
927
- .withAllowDuplicates(true)
928
- .withCurrency("USD")
929
- .withAddress(address)
930
- .execute()
931
- .then((response) => {
932
- t.truthy(response);
933
- t.is(response.responseCode, "00");
934
- return response;
935
- })
936
- // 036b capture
937
- .then((response) => {
938
- return response
939
- .capture()
940
- .execute()
941
- .then((captureResponse) => {
942
- t.truthy(captureResponse);
943
- t.is(captureResponse.responseCode, "00");
944
- });
945
- }));
946
- });
947
- test("038a - authorize discover manual", (t) => {
948
- t.plan(2);
949
- const address = new src_1.Address();
950
- address.postalCode = "750241234";
951
- const card = Data_1.TestCards.discoverManual(false, true);
952
- return card
953
- .authorize(17.1)
954
- .withAllowDuplicates(true)
955
- .withCurrency("USD")
956
- .withAddress(address)
957
- .execute()
958
- .then((response) => {
959
- t.truthy(response);
960
- t.is(response.responseCode, "00");
961
- });
962
- });
963
- /// PARTIALLY APPROVED SALE (Required)
964
- test("039 - charge discover swipe partial approval", (t) => {
965
- t.plan(3);
966
- const card = Data_1.TestCards.discoverSwipe();
967
- return card
968
- .charge(40.0)
969
- .withAllowDuplicates(true)
970
- .withCurrency("USD")
971
- .withAllowPartialAuth(true)
972
- .execute()
973
- .then((response) => {
974
- t.truthy(response);
975
- t.is(response.responseCode, "10");
976
- t.is(response.authorizedAmount, "40.00");
977
- });
978
- });
979
- test("040 - charge visa swipe partial approval", (t) => {
980
- t.plan(3);
981
- const card = Data_1.TestCards.visaSwipe();
982
- return card
983
- .charge(130.0)
984
- .withAllowDuplicates(true)
985
- .withCurrency("USD")
986
- .withAllowPartialAuth(true)
987
- .execute()
988
- .then((response) => {
989
- t.truthy(response);
990
- t.is(response.responseCode, "10");
991
- t.is(response.authorizedAmount, "110.00");
992
- });
993
- });
994
- test("041 - charge discover manual partial approval", (t) => {
995
- t.plan(3);
996
- const address = new src_1.Address();
997
- address.postalCode = "75024";
998
- const card = Data_1.TestCards.discoverManual(true, true);
999
- return card
1000
- .charge(145.0)
1001
- .withAllowDuplicates(true)
1002
- .withCurrency("USD")
1003
- .withAllowPartialAuth(true)
1004
- .withAddress(address)
1005
- .execute()
1006
- .then((response) => {
1007
- t.truthy(response);
1008
- t.is(response.responseCode, "10");
1009
- t.is(response.authorizedAmount, "65.00");
1010
- });
1011
- });
1012
- test("042 - charge mastercard swipe partial approval", (t) => {
1013
- t.plan(5);
1014
- const card = Data_1.TestCards.masterCardSwipe();
1015
- return (card
1016
- .charge(155.0)
1017
- .withAllowDuplicates(true)
1018
- .withCurrency("USD")
1019
- .withAllowPartialAuth(true)
1020
- .execute()
1021
- .then((response) => {
1022
- t.truthy(response);
1023
- t.is(response.responseCode, "10");
1024
- t.is(response.authorizedAmount, "100.00");
1025
- return response;
1026
- })
1027
- // test case 62
1028
- .then((response) => {
1029
- return (response
1030
- .reverse(100.0)
1031
- // .withAllowDuplicates(true)
1032
- .execute()
1033
- .then((reverseResponse) => {
1034
- t.truthy(reverseResponse);
1035
- t.is(reverseResponse.responseCode, "00");
1036
- }));
1037
- }));
1038
- });
1039
- /// SALE WITH GRATUITY
1040
- /// Tip Edit (Tip at Settlement)
1041
- test("043 - charge visa swipe edit gratuity", (t) => {
1042
- const card = Data_1.TestCards.visaSwipe();
1043
- return card
1044
- .charge(15.12)
1045
- .withAllowDuplicates(true)
1046
- .withCurrency("USD")
1047
- .execute()
1048
- .then((response) => {
1049
- t.truthy(response);
1050
- t.is(response.responseCode, "00");
1051
- return response;
1052
- })
1053
- .then((response) => {
1054
- return (response
1055
- .edit()
1056
- // .withAllowDuplicates(true)
1057
- .withAmount(18.12)
1058
- .withGratuity(3.0)
1059
- .execute()
1060
- .then((editResponse) => {
1061
- t.truthy(editResponse);
1062
- t.is(editResponse.responseCode, "00");
1063
- }));
1064
- });
1065
- });
1066
- test("044 - charge mastercard manual edit gratuity", (t) => {
1067
- t.plan(4);
1068
- const address = new src_1.Address();
1069
- address.postalCode = "75024";
1070
- const card = Data_1.TestCards.masterCardManual(true, true);
1071
- return card
1072
- .charge(15.13)
1073
- .withAllowDuplicates(true)
1074
- .withCurrency("USD")
1075
- .withAddress(address)
1076
- .execute()
1077
- .then((response) => {
1078
- t.truthy(response);
1079
- t.is(response.responseCode, "00");
1080
- return response;
1081
- })
1082
- .then((response) => {
1083
- return (response
1084
- .edit()
1085
- // .withAllowDuplicates(true)
1086
- .withAmount(18.13)
1087
- .withGratuity(3.0)
1088
- .execute()
1089
- .then((editResponse) => {
1090
- t.truthy(editResponse);
1091
- t.is(editResponse.responseCode, "00");
1092
- }));
1093
- });
1094
- });
1095
- /// Tip on Purchase
1096
- test("045 - charge visa manual gratuity", (t) => {
1097
- t.plan(2);
1098
- const address = new src_1.Address();
1099
- address.postalCode = "75024";
1100
- const card = Data_1.TestCards.visaManual(true, true);
1101
- return card
1102
- .charge(18.61)
1103
- .withAllowDuplicates(true)
1104
- .withCurrency("USD")
1105
- .withAddress(address)
1106
- .withGratuity(3.5)
1107
- .execute()
1108
- .then((response) => {
1109
- t.truthy(response);
1110
- t.is(response.responseCode, "00");
1111
- });
1112
- });
1113
- test("046 - charge mastercard swipe gratuity", (t) => {
1114
- t.plan(4);
1115
- const card = Data_1.TestCards.masterCardSwipe();
1116
- return card
1117
- .charge(18.62)
1118
- .withAllowDuplicates(true)
1119
- .withCurrency("USD")
1120
- .withGratuity(3.5)
1121
- .execute()
1122
- .then((response) => {
1123
- t.truthy(response);
1124
- t.is(response.responseCode, "00");
1125
- return response;
1126
- })
1127
- .then((response) => {
1128
- return (response
1129
- .edit()
1130
- // .withAllowDuplicates(true)
1131
- .withAmount(18.12)
1132
- .withGratuity(3.0)
1133
- .execute()
1134
- .then((editResponse) => {
1135
- t.truthy(editResponse);
1136
- t.is(editResponse.responseCode, "00");
1137
- }));
1138
- });
1139
- });
1140
- /// LEVEL II CORPORATE PURCHASE CARD
1141
- test("047 - level ii visa swipe response b", (t) => {
1142
- t.plan(5);
1143
- const card = Data_1.TestCards.visaSwipe();
1144
- return card
1145
- .charge(112.34)
1146
- .withAllowDuplicates(true)
1147
- .withCurrency("USD")
1148
- .withCommercialRequest(true)
1149
- .execute()
1150
- .then((response) => {
1151
- t.truthy(response);
1152
- t.is(response.responseCode, "00");
1153
- t.is(response.commercialIndicator, "B");
1154
- return response;
1155
- })
1156
- .then((response) => {
1157
- return (response
1158
- .edit()
1159
- // .withAllowDuplicates(true)
1160
- .withTaxType(src_1.TaxType.SalesTax)
1161
- .withTaxAmount(1)
1162
- .execute()
1163
- .then((cpcResponse) => {
1164
- t.truthy(cpcResponse);
1165
- t.is(cpcResponse.responseCode, "00");
1166
- }));
1167
- });
1168
- });
1169
- test("047a - level ii visa swipe response b", (t) => {
1170
- t.plan(5);
1171
- const card = Data_1.TestCards.visaSwipe();
1172
- return card
1173
- .charge(112.34)
1174
- .withAllowDuplicates(true)
1175
- .withCurrency("USD")
1176
- .withCommercialRequest(true)
1177
- .execute()
1178
- .then((response) => {
1179
- t.truthy(response);
1180
- t.is(response.responseCode, "00");
1181
- t.is(response.commercialIndicator, "B");
1182
- return response;
1183
- })
1184
- .then((response) => {
1185
- return (response
1186
- .edit()
1187
- // .withAllowDuplicates(true)
1188
- .withTaxType(src_1.TaxType.NotUsed)
1189
- .execute()
1190
- .then((cpcResponse) => {
1191
- t.truthy(cpcResponse);
1192
- t.is(cpcResponse.responseCode, "00");
1193
- }));
1194
- });
1195
- });
1196
- test("048 - level ii visa swipe response r", (t) => {
1197
- t.plan(5);
1198
- const card = Data_1.TestCards.visaSwipe();
1199
- return card
1200
- .charge(123.45)
1201
- .withAllowDuplicates(true)
1202
- .withCurrency("USD")
1203
- .withCommercialRequest(true)
1204
- .execute()
1205
- .then((response) => {
1206
- t.truthy(response);
1207
- t.is(response.responseCode, "00");
1208
- t.is(response.commercialIndicator, "R");
1209
- return response;
1210
- })
1211
- .then((response) => {
1212
- return (response
1213
- .edit()
1214
- // .withAllowDuplicates(true)
1215
- .withTaxType(src_1.TaxType.TaxExempt)
1216
- .execute()
1217
- .then((cpcResponse) => {
1218
- t.truthy(cpcResponse);
1219
- t.is(cpcResponse.responseCode, "00");
1220
- }));
1221
- });
1222
- });
1223
- test("049 - level ii visa manual response s", (t) => {
1224
- t.plan(5);
1225
- const address = new src_1.Address();
1226
- address.postalCode = "75024";
1227
- const card = Data_1.TestCards.visaManual(true, true);
1228
- return card
1229
- .charge(134.56)
1230
- .withAllowDuplicates(true)
1231
- .withCurrency("USD")
1232
- .withAddress(address)
1233
- .withCommercialRequest(true)
1234
- .execute()
1235
- .then((response) => {
1236
- t.truthy(response);
1237
- t.is(response.responseCode, "00");
1238
- t.is(response.commercialIndicator, "S");
1239
- return response;
1240
- })
1241
- .then((response) => {
1242
- return (response
1243
- .edit()
1244
- // .withAllowDuplicates(true)
1245
- .withPoNumber("9876543210")
1246
- .withTaxType(src_1.TaxType.SalesTax)
1247
- .withTaxAmount(1)
1248
- .execute()
1249
- .then((cpcResponse) => {
1250
- t.truthy(cpcResponse);
1251
- t.is(cpcResponse.responseCode, "00");
1252
- }));
1253
- });
1254
- });
1255
- test("050 - level ii mastercard swipe response s", (t) => {
1256
- t.plan(5);
1257
- const card = Data_1.TestCards.masterCardSwipe();
1258
- return card
1259
- .charge(111.06)
1260
- .withAllowDuplicates(true)
1261
- .withCurrency("USD")
1262
- .withCommercialRequest(true)
1263
- .execute()
1264
- .then((response) => {
1265
- t.truthy(response);
1266
- t.is(response.responseCode, "00");
1267
- t.is(response.commercialIndicator, "S");
1268
- return response;
1269
- })
1270
- .then((response) => {
1271
- return (response
1272
- .edit()
1273
- // .withAllowDuplicates(true)
1274
- .withPoNumber("9876543210")
1275
- .withTaxType(src_1.TaxType.NotUsed)
1276
- .execute()
1277
- .then((cpcResponse) => {
1278
- t.truthy(cpcResponse);
1279
- t.is(cpcResponse.responseCode, "00");
1280
- }));
1281
- });
1282
- });
1283
- test("051 - level ii mastercard manual response s", (t) => {
1284
- t.plan(5);
1285
- const address = new src_1.Address();
1286
- address.postalCode = "75024";
1287
- const card = Data_1.TestCards.masterCardManual(true, true);
1288
- return card
1289
- .charge(111.07)
1290
- .withAllowDuplicates(true)
1291
- .withCurrency("USD")
1292
- .withAddress(address)
1293
- .withCommercialRequest(true)
1294
- .execute()
1295
- .then((response) => {
1296
- t.truthy(response);
1297
- t.is(response.responseCode, "00");
1298
- t.is(response.commercialIndicator, "S");
1299
- return response;
1300
- })
1301
- .then((response) => {
1302
- return (response
1303
- .edit()
1304
- // .withAllowDuplicates(true)
1305
- .withPoNumber("9876543210")
1306
- .withTaxType(src_1.TaxType.SalesTax)
1307
- .withTaxAmount(1)
1308
- .execute()
1309
- .then((cpcResponse) => {
1310
- t.truthy(cpcResponse);
1311
- t.is(cpcResponse.responseCode, "00");
1312
- }));
1313
- });
1314
- });
1315
- test("051a - level ii mastercard manual response s", (t) => {
1316
- t.plan(5);
1317
- const address = new src_1.Address();
1318
- address.postalCode = "75024";
1319
- const card = Data_1.TestCards.masterCardManual(true, true);
1320
- return card
1321
- .charge(111.08)
1322
- .withAllowDuplicates(true)
1323
- .withCurrency("USD")
1324
- .withAddress(address)
1325
- .withCommercialRequest(true)
1326
- .execute()
1327
- .then((response) => {
1328
- t.truthy(response);
1329
- t.is(response.responseCode, "00");
1330
- t.is(response.commercialIndicator, "S");
1331
- return response;
1332
- })
1333
- .then((response) => {
1334
- return (response
1335
- .edit()
1336
- // .withAllowDuplicates(true)
1337
- .withPoNumber("9876543210")
1338
- .withTaxType(src_1.TaxType.SalesTax)
1339
- .withTaxAmount(1)
1340
- .execute()
1341
- .then((cpcResponse) => {
1342
- t.truthy(cpcResponse);
1343
- t.is(cpcResponse.responseCode, "00");
1344
- }));
1345
- });
1346
- });
1347
- test("052 - level ii mastercard manual response s", (t) => {
1348
- t.plan(5);
1349
- const address = new src_1.Address();
1350
- address.postalCode = "75024";
1351
- const card = Data_1.TestCards.masterCardManual(true, true);
1352
- return card
1353
- .charge(111.09)
1354
- .withAllowDuplicates(true)
1355
- .withCurrency("USD")
1356
- .withAddress(address)
1357
- .withCommercialRequest(true)
1358
- .execute()
1359
- .then((response) => {
1360
- t.truthy(response);
1361
- t.is(response.responseCode, "00");
1362
- t.is(response.commercialIndicator, "S");
1363
- return response;
1364
- })
1365
- .then((response) => {
1366
- return (response
1367
- .edit()
1368
- // .withAllowDuplicates(true)
1369
- .withPoNumber("9876543210")
1370
- .withTaxType(src_1.TaxType.TaxExempt)
1371
- .execute()
1372
- .then((cpcResponse) => {
1373
- t.truthy(cpcResponse);
1374
- t.is(cpcResponse.responseCode, "00");
1375
- }));
1376
- });
1377
- });
1378
- test("053 - level ii amex swipe no response", (t) => {
1379
- t.plan(5);
1380
- const card = Data_1.TestCards.amexSwipe();
1381
- return card
1382
- .charge(111.1)
1383
- .withAllowDuplicates(true)
1384
- .withCurrency("USD")
1385
- .withCommercialRequest(true)
1386
- .execute()
1387
- .then((response) => {
1388
- t.truthy(response);
1389
- t.is(response.responseCode, "00");
1390
- t.is(response.commercialIndicator, "0");
1391
- return response;
1392
- })
1393
- .then((response) => {
1394
- return (response
1395
- .edit()
1396
- // .withAllowDuplicates(true)
1397
- .withTaxType(src_1.TaxType.SalesTax)
1398
- .withTaxAmount(1)
1399
- .execute()
1400
- .then((cpcResponse) => {
1401
- t.truthy(cpcResponse);
1402
- t.is(cpcResponse.responseCode, "00");
1403
- }));
1404
- });
1405
- });
1406
- test("054 - level ii amex manual no response", (t) => {
1407
- t.plan(5);
1408
- const address = new src_1.Address();
1409
- address.postalCode = "75024";
1410
- const card = Data_1.TestCards.amexManual(true, true);
1411
- return card
1412
- .charge(111.11)
1413
- .withAllowDuplicates(true)
1414
- .withCurrency("USD")
1415
- .withAddress(address)
1416
- .withCommercialRequest(true)
1417
- .execute()
1418
- .then((response) => {
1419
- t.truthy(response);
1420
- t.is(response.responseCode, "00");
1421
- t.is(response.commercialIndicator, "0");
1422
- return response;
1423
- })
1424
- .then((response) => {
1425
- return (response
1426
- .edit()
1427
- // .withAllowDuplicates(true)
1428
- .withPoNumber("9876543210")
1429
- .withTaxType(src_1.TaxType.NotUsed)
1430
- .execute()
1431
- .then((cpcResponse) => {
1432
- t.truthy(cpcResponse);
1433
- t.is(cpcResponse.responseCode, "00");
1434
- }));
1435
- });
1436
- });
1437
- test("055 - level ii amex manual no response", (t) => {
1438
- t.plan(5);
1439
- const address = new src_1.Address();
1440
- address.postalCode = "75024";
1441
- const card = Data_1.TestCards.amexManual(true, true);
1442
- return card
1443
- .charge(111.12)
1444
- .withAllowDuplicates(true)
1445
- .withCurrency("USD")
1446
- .withAddress(address)
1447
- .withCommercialRequest(true)
1448
- .execute()
1449
- .then((response) => {
1450
- t.truthy(response);
1451
- t.is(response.responseCode, "00");
1452
- t.is(response.commercialIndicator, "0");
1453
- return response;
1454
- })
1455
- .then((response) => {
1456
- return (response
1457
- .edit()
1458
- // .withAllowDuplicates(true)
1459
- .withPoNumber("9876543210")
1460
- .withTaxType(src_1.TaxType.NotUsed)
1461
- .execute()
1462
- .then((cpcResponse) => {
1463
- t.truthy(cpcResponse);
1464
- t.is(cpcResponse.responseCode, "00");
1465
- }));
1466
- });
1467
- });
1468
- test("055a - level ii amex manual no response", (t) => {
1469
- t.plan(5);
1470
- const address = new src_1.Address();
1471
- address.postalCode = "75024";
1472
- const card = Data_1.TestCards.amexManual(true, true);
1473
- return card
1474
- .charge(111.13)
1475
- .withAllowDuplicates(true)
1476
- .withCurrency("USD")
1477
- .withAddress(address)
1478
- .withCommercialRequest(true)
1479
- .execute()
1480
- .then((response) => {
1481
- t.truthy(response);
1482
- t.is(response.responseCode, "00");
1483
- t.is(response.commercialIndicator, "0");
1484
- return response;
1485
- })
1486
- .then((response) => {
1487
- return (response
1488
- .edit()
1489
- // .withAllowDuplicates(true)
1490
- .withPoNumber("9876543210")
1491
- .withTaxType(src_1.TaxType.TaxExempt)
1492
- .execute()
1493
- .then((cpcResponse) => {
1494
- t.truthy(cpcResponse);
1495
- t.is(cpcResponse.responseCode, "00");
1496
- }));
1497
- });
1498
- });
1499
- /// OFFLINE SALE / AUTHORIZATION
1500
- test("056 - offline charge visa manual", (t) => {
1501
- t.plan(2);
1502
- const card = Data_1.TestCards.visaManual(false, true);
1503
- return card
1504
- .charge(15.12)
1505
- .withAllowDuplicates(true)
1506
- .withCurrency("USD")
1507
- .withOfflineAuthCode("654321")
1508
- .execute()
1509
- .then((response) => {
1510
- t.truthy(response);
1511
- t.is(response.responseCode, "00");
1512
- });
1513
- });
1514
- test("056 - offline auth visa manual", (t) => {
1515
- t.plan(2);
1516
- const card = Data_1.TestCards.visaManual(false, true);
1517
- return card
1518
- .authorize(15.11)
1519
- .withAllowDuplicates(true)
1520
- .withCurrency("USD")
1521
- .withOfflineAuthCode("654321")
1522
- .execute()
1523
- .then((response) => {
1524
- t.truthy(response);
1525
- t.is(response.responseCode, "00");
1526
- });
1527
- });
1528
- /// RETURN
1529
- test("057 - return mastercard", (t) => {
1530
- t.plan(2);
1531
- const card = Data_1.TestCards.masterCardManual(false, true);
1532
- return card
1533
- .refund(15.11)
1534
- .withAllowDuplicates(true)
1535
- .withCurrency("USD")
1536
- .execute()
1537
- .then((response) => {
1538
- t.truthy(response);
1539
- t.is(response.responseCode, "00");
1540
- });
1541
- });
1542
- test("057a - return mastercard swipe", (t) => {
1543
- t.plan(2);
1544
- const card = Data_1.TestCards.masterCardSwipe();
1545
- return card
1546
- .refund(15.15)
1547
- .withAllowDuplicates(true)
1548
- .withCurrency("USD")
1549
- .execute()
1550
- .then((response) => {
1551
- t.truthy(response);
1552
- t.is(response.responseCode, "00");
1553
- });
1554
- });
1555
- test("058 - return jcb transaction id", () => {
1556
- // see test 14
1557
- });
1558
- /// ONLINE VOID / REVERSAL (Required)
1559
- test("059 - reversal visa", () => {
1560
- // see test 10
1561
- });
1562
- test("060 - reversal mastercard", () => {
1563
- // see test case 17
1564
- });
1565
- test("061 - reversal mastercard", () => {
1566
- // see test case 23
1567
- });
1568
- test("062 - reversal mastercard", () => {
1569
- // see test case 42
1570
- });
1571
- test("063 - reversal visa partial", () => {
1572
- // see test case 15
1573
- });
1574
- test("064 - reversal discover partial", () => {
1575
- // see test 21
1576
- });
1577
- /// PIN DEBIT CARD FUNCTIONS
1578
- test("065 - debit sale visa swipe", (t) => {
1579
- t.plan(2);
1580
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1581
- return card
1582
- .charge(14.01)
1583
- .withAllowDuplicates(true)
1584
- .withCurrency("USD")
1585
- .execute()
1586
- .then((response) => {
1587
- t.truthy(response);
1588
- t.is(response.responseCode, "00");
1589
- });
1590
- });
1591
- test("066 - debit sale mastercard swipe", (t) => {
1592
- t.plan(4);
1593
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1594
- return card
1595
- .charge(14.02)
1596
- .withAllowDuplicates(true)
1597
- .withCurrency("USD")
1598
- .execute()
1599
- .then((response) => {
1600
- t.truthy(response);
1601
- t.is(response.responseCode, "00");
1602
- return response;
1603
- })
1604
- .then(() => {
1605
- // test case 71
1606
- return (card
1607
- .reverse(14.02)
1608
- // .withAllowDuplicates(true)
1609
- .execute()
1610
- .then((reverseResponse) => {
1611
- t.truthy(reverseResponse);
1612
- t.is(reverseResponse.responseCode, "00");
1613
- }));
1614
- });
1615
- });
1616
- test("067 - debit sale visa swipe cashback", (t) => {
1617
- t.plan(2);
1618
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1619
- return card
1620
- .charge(14.03)
1621
- .withAllowDuplicates(true)
1622
- .withCurrency("USD")
1623
- .withCashBack(5.0)
1624
- .execute()
1625
- .then((response) => {
1626
- t.truthy(response);
1627
- t.is(response.responseCode, "00");
1628
- });
1629
- });
1630
- test("067a - debit sale mastercard", (t) => {
1631
- t.plan(2);
1632
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1633
- return card
1634
- .charge(14.04)
1635
- .withAllowDuplicates(true)
1636
- .withCurrency("USD")
1637
- .execute()
1638
- .then((response) => {
1639
- t.truthy(response);
1640
- t.is(response.responseCode, "00");
1641
- });
1642
- });
1643
- /// PARTIALLY APPROVED PURCHASE
1644
- test("068 - debit sale mastercard partial approval", (t) => {
1645
- t.plan(3);
1646
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1647
- return card
1648
- .charge(33.0)
1649
- .withAllowDuplicates(true)
1650
- .withCurrency("USD")
1651
- .withAllowPartialAuth(true)
1652
- .execute()
1653
- .then((response) => {
1654
- t.truthy(response);
1655
- t.is(response.responseCode, "10");
1656
- t.is(response.authorizedAmount, "22.00");
1657
- });
1658
- });
1659
- test("069 - debit sale visa partial approval", (t) => {
1660
- t.plan(5);
1661
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1662
- return card
1663
- .charge(44.0)
1664
- .withAllowDuplicates(true)
1665
- .withCurrency("USD")
1666
- .withAllowPartialAuth(true)
1667
- .execute()
1668
- .then((response) => {
1669
- t.truthy(response);
1670
- t.is(response.responseCode, "10");
1671
- t.is(response.authorizedAmount, "33.00");
1672
- return response;
1673
- })
1674
- .then(() => {
1675
- // test case 72
1676
- return (card
1677
- .reverse(33.0)
1678
- // .withAllowDuplicates(true)
1679
- .execute()
1680
- .then((reverseResponse) => {
1681
- t.truthy(reverseResponse);
1682
- t.is(reverseResponse.responseCode, "00");
1683
- }));
1684
- });
1685
- });
1686
- /// RETURN
1687
- test("070 - debit return visa swipe", (t) => {
1688
- t.plan(2);
1689
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1690
- return card
1691
- .refund(14.07)
1692
- .withAllowDuplicates(true)
1693
- .withCurrency("USD")
1694
- .execute()
1695
- .then((response) => {
1696
- t.truthy(response);
1697
- t.is(response.responseCode, "00");
1698
- });
1699
- });
1700
- test("070a - debit return visa swipe", (t) => {
1701
- t.plan(4);
1702
- const card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1703
- return card
1704
- .refund(14.08)
1705
- .withAllowDuplicates(true)
1706
- .withCurrency("USD")
1707
- .execute()
1708
- .then((response) => {
1709
- t.truthy(response);
1710
- t.is(response.responseCode, "00");
1711
- return response;
1712
- })
1713
- .then(() => {
1714
- return (card
1715
- .reverse(14.08)
1716
- // .withAllowDuplicates(true)
1717
- .execute()
1718
- .then((reverseResponse) => {
1719
- t.truthy(reverseResponse);
1720
- t.is(reverseResponse.responseCode, "00");
1721
- }));
1722
- });
1723
- });
1724
- /// REVERSAL
1725
- test("071 - debit reversal mastercard", () => {
1726
- // see test case 66
1727
- });
1728
- test("072 - debit reversal visa", () => {
1729
- // see test case 96
1730
- });
1731
- /// EBT FUNCTIONS
1732
- /// Food Stamp Purchase
1733
- test("080 - ebt fs purchase visa swipe", (t) => {
1734
- t.plan(2);
1735
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1736
- return card
1737
- .charge(101.01)
1738
- .withAllowDuplicates(true)
1739
- .withCurrency("USD")
1740
- .execute()
1741
- .then((response) => {
1742
- t.truthy(response);
1743
- t.is(response.responseCode, "00");
1744
- });
1745
- });
1746
- test("081 - ebt fs purchase visa manual", (t) => {
1747
- t.plan(2);
1748
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1749
- return card
1750
- .charge(102.01)
1751
- .withAllowDuplicates(true)
1752
- .withCurrency("USD")
1753
- .execute()
1754
- .then((response) => {
1755
- t.truthy(response);
1756
- t.is(response.responseCode, "00");
1757
- });
1758
- });
1759
- /// Food Stamp Electronic Voucher (Manual Entry Only)
1760
- test("082 - ebt voucher purchase visa", (t) => {
1761
- t.plan(2);
1762
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1763
- card.serialNumber = "123456789012345";
1764
- card.approvalCode = "123456";
1765
- return card
1766
- .charge(103.01)
1767
- .withAllowDuplicates(true)
1768
- .withCurrency("USD")
1769
- .execute()
1770
- .then((response) => {
1771
- t.truthy(response);
1772
- t.is(response.responseCode, "00");
1773
- });
1774
- });
1775
- /// Food Stamp Balance Inquiry
1776
- test("083 - ebt fs return visa swipe", (t) => {
1777
- t.plan(2);
1778
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1779
- return card
1780
- .refund(104.01)
1781
- .withAllowDuplicates(true)
1782
- .withCurrency("USD")
1783
- .execute()
1784
- .then((response) => {
1785
- t.truthy(response);
1786
- t.is(response.responseCode, "00");
1787
- });
1788
- });
1789
- test("084 - ebt fs return visa manual", (t) => {
1790
- t.plan(2);
1791
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1792
- return card
1793
- .refund(105.01)
1794
- .withAllowDuplicates(true)
1795
- .withCurrency("USD")
1796
- .execute()
1797
- .then((response) => {
1798
- t.truthy(response);
1799
- t.is(response.responseCode, "00");
1800
- });
1801
- });
1802
- /// Food Stamp Balance Inquiry
1803
- test("085 - ebt balance inquiry visa swipe", (t) => {
1804
- t.plan(2);
1805
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1806
- return card
1807
- .balanceInquiry()
1808
- .execute()
1809
- .then((response) => {
1810
- t.truthy(response);
1811
- t.is(response.responseCode, "00");
1812
- });
1813
- });
1814
- test("086 - ebt balance inquiry visa manual", (t) => {
1815
- t.plan(2);
1816
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(true, true), "32539F50C245A6A93D123412324000AA");
1817
- return card
1818
- .balanceInquiry()
1819
- .execute()
1820
- .then((response) => {
1821
- t.truthy(response);
1822
- t.is(response.responseCode, "00");
1823
- });
1824
- });
1825
- /// EBT CASH BENEFITS
1826
- /// Cash Back Purchase
1827
- test("087 - ebt cash back purchase visa swipe", (t) => {
1828
- t.plan(2);
1829
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1830
- return card
1831
- .charge(106.01)
1832
- .withAllowDuplicates(true)
1833
- .withCurrency("USD")
1834
- .withCashBack(5.0)
1835
- .execute()
1836
- .then((response) => {
1837
- t.truthy(response);
1838
- t.is(response.responseCode, "00");
1839
- });
1840
- });
1841
- test("088 - ebt cash back purchase visa manual", (t) => {
1842
- t.plan(2);
1843
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1844
- return card
1845
- .charge(107.01)
1846
- .withAllowDuplicates(true)
1847
- .withCurrency("USD")
1848
- .withCashBack(5.0)
1849
- .execute()
1850
- .then((response) => {
1851
- t.truthy(response);
1852
- t.is(response.responseCode, "00");
1853
- });
1854
- });
1855
- /// No Cash Back Purchase
1856
- test("089 - ebt cash back purchase visa swipe no cash back", (t) => {
1857
- t.plan(2);
1858
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1859
- return card
1860
- .charge(108.01)
1861
- .withAllowDuplicates(true)
1862
- .withCurrency("USD")
1863
- .withCashBack(0)
1864
- .execute()
1865
- .then((response) => {
1866
- t.truthy(response);
1867
- t.is(response.responseCode, "00");
1868
- });
1869
- });
1870
- test("090 - ebt cash back purchase visa manual no cash back", (t) => {
1871
- t.plan(2);
1872
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1873
- return card
1874
- .charge(109.01)
1875
- .withAllowDuplicates(true)
1876
- .withCurrency("USD")
1877
- .withCashBack(0)
1878
- .execute()
1879
- .then((response) => {
1880
- t.truthy(response);
1881
- t.is(response.responseCode, "00");
1882
- });
1883
- });
1884
- /// Cash Back Balance Inquiry
1885
- test("091 - ebt balance inquiry visa swipe cash", (t) => {
1886
- t.plan(2);
1887
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1888
- return card
1889
- .balanceInquiry(src_1.InquiryType.Cash)
1890
- .execute()
1891
- .then((response) => {
1892
- t.truthy(response);
1893
- t.is(response.responseCode, "00");
1894
- });
1895
- });
1896
- test("092 - ebt balance inquiry visa manual cash", (t) => {
1897
- t.plan(2);
1898
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(true, true), "32539F50C245A6A93D123412324000AA");
1899
- return card
1900
- .balanceInquiry(src_1.InquiryType.Cash)
1901
- .execute()
1902
- .then((response) => {
1903
- t.truthy(response);
1904
- t.is(response.responseCode, "00");
1905
- });
1906
- });
1907
- /// Cash Benefits Withdrawal
1908
- test("093 - ebt benefit withdrawal visa swipe", (t) => {
1909
- t.plan(2);
1910
- const card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1911
- return card
1912
- .charge(110.01)
1913
- .withAllowDuplicates(true)
1914
- .withCurrency("USD")
1915
- .execute()
1916
- .then((response) => {
1917
- t.truthy(response);
1918
- t.is(response.responseCode, "00");
1919
- });
1920
- });
1921
- test("094 - ebt benefit withdrawal visa manual", (t) => {
1922
- t.plan(2);
1923
- const card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1924
- return card
1925
- .charge(111.01)
1926
- .withAllowDuplicates(true)
1927
- .withCurrency("USD")
1928
- .withCashBack(0)
1929
- .execute()
1930
- .then((response) => {
1931
- t.truthy(response);
1932
- t.is(response.responseCode, "00");
1933
- });
1934
- });
1935
- /// HMS GIFT - REWARDS
1936
- /// GIFT
1937
- /// ACTIVATE
1938
- test("095 - activate gift 1 swipe", (t) => {
1939
- t.plan(2);
1940
- const card = Data_1.TestCards.giftCard1Swipe();
1941
- return card
1942
- .activate(6.0)
1943
- .execute()
1944
- .then((response) => {
1945
- t.truthy(response);
1946
- t.is(response.responseCode, "00");
1947
- });
1948
- });
1949
- test("096 - activate gift 2 manual", (t) => {
1950
- t.plan(2);
1951
- const card = Data_1.TestCards.giftCard2Manual();
1952
- return card
1953
- .activate(7.0)
1954
- .execute()
1955
- .then((response) => {
1956
- t.truthy(response);
1957
- t.is(response.responseCode, "00");
1958
- });
1959
- });
1960
- /// ADD VALUE
1961
- test("097 - add value gift 1 swipe", (t) => {
1962
- t.plan(2);
1963
- const card = Data_1.TestCards.giftCard1Swipe();
1964
- return card
1965
- .addValue(8.0)
1966
- .withCurrency("USD")
1967
- .execute()
1968
- .then((response) => {
1969
- t.truthy(response);
1970
- t.is(response.responseCode, "00");
1971
- });
1972
- });
1973
- test("098 - add value gift 2 manual", (t) => {
1974
- t.plan(2);
1975
- const card = Data_1.TestCards.giftCard2Manual();
1976
- return card
1977
- .addValue(9.0)
1978
- .withCurrency("USD")
1979
- .execute()
1980
- .then((response) => {
1981
- t.truthy(response);
1982
- t.is(response.responseCode, "00");
1983
- });
1984
- });
1985
- /// BALANCE INQUIRY
1986
- test("099 - balance inquiry gift 1 swipe", (t) => {
1987
- t.plan(3);
1988
- const card = Data_1.TestCards.giftCard1Swipe();
1989
- return card
1990
- .balanceInquiry()
1991
- .execute()
1992
- .then((response) => {
1993
- t.truthy(response);
1994
- t.is(response.responseCode, "00");
1995
- t.is(response.balanceAmount, "10.00");
1996
- });
1997
- });
1998
- test("100 - balance inquiry gift 2 manual", (t) => {
1999
- t.plan(3);
2000
- const card = Data_1.TestCards.giftCard2Manual();
2001
- return card
2002
- .balanceInquiry()
2003
- .execute()
2004
- .then((response) => {
2005
- t.truthy(response);
2006
- t.is(response.responseCode, "00");
2007
- t.is(response.balanceAmount, "10.00");
2008
- });
2009
- });
2010
- /// REPLACE / TRANSFER
2011
- test("101 - replace gift 1 swipe", (t) => {
2012
- t.plan(2);
2013
- const oldCard = Data_1.TestCards.giftCard1Swipe();
2014
- const newCard = Data_1.TestCards.giftCard2Manual();
2015
- return oldCard
2016
- .replaceWith(newCard)
2017
- .execute()
2018
- .then((response) => {
2019
- t.truthy(response);
2020
- t.is(response.responseCode, "00");
2021
- });
2022
- });
2023
- test("102 - replace gift 2 manual", (t) => {
2024
- t.plan(2);
2025
- const newCard = Data_1.TestCards.giftCard1Swipe();
2026
- const oldCard = Data_1.TestCards.giftCard2Manual();
2027
- return oldCard
2028
- .replaceWith(newCard)
2029
- .execute()
2030
- .then((response) => {
2031
- t.truthy(response);
2032
- t.is(response.responseCode, "00");
2033
- });
2034
- });
2035
- /// SALE / REDEEM
2036
- test("103 - sale gift 1 swipe", (t) => {
2037
- t.plan(2);
2038
- const card = Data_1.TestCards.giftCard1Swipe();
2039
- return card
2040
- .charge(1.0)
2041
- .withCurrency("USD")
2042
- .execute()
2043
- .then((response) => {
2044
- t.truthy(response);
2045
- t.is(response.responseCode, "00");
2046
- });
2047
- });
2048
- test("104 - sale gift 2 manual", (t) => {
2049
- t.plan(2);
2050
- const card = Data_1.TestCards.giftCard2Manual();
2051
- return card
2052
- .charge(2.0)
2053
- .withCurrency("USD")
2054
- .execute()
2055
- .then((response) => {
2056
- t.truthy(response);
2057
- t.is(response.responseCode, "00");
2058
- });
2059
- });
2060
- test("105 - sale gift 1 void swipe", (t) => {
2061
- t.plan(4);
2062
- const card = Data_1.TestCards.giftCard1Swipe();
2063
- return card
2064
- .charge(3.0)
2065
- .withCurrency("USD")
2066
- .execute()
2067
- .then((response) => {
2068
- t.truthy(response);
2069
- t.is(response.responseCode, "00");
2070
- return response;
2071
- })
2072
- .then((response) => {
2073
- // test case 107
2074
- return response
2075
- .void()
2076
- .execute()
2077
- .then((voidResponse) => {
2078
- t.truthy(voidResponse);
2079
- t.is(voidResponse.responseCode, "00");
2080
- });
2081
- });
2082
- });
2083
- test("106 - sale gift 2 reversal manual", (t) => {
2084
- t.plan(4);
2085
- const card = Data_1.TestCards.giftCard2Manual();
2086
- return card
2087
- .charge(4.0)
2088
- .withCurrency("USD")
2089
- .execute()
2090
- .then((response) => {
2091
- t.truthy(response);
2092
- t.is(response.responseCode, "00");
2093
- return response;
2094
- })
2095
- .then((response) => {
2096
- // test case 108
2097
- return response
2098
- .reverse(4.0)
2099
- .execute()
2100
- .then((voidResponse) => {
2101
- t.truthy(voidResponse);
2102
- t.is(voidResponse.responseCode, "00");
2103
- });
2104
- });
2105
- });
2106
- /// VOID
2107
- test("107 - void gift", () => {
2108
- // see test case 105
2109
- });
2110
- /// REVERSAL
2111
- test("108 - reversal gift", () => {
2112
- // see test case 106
2113
- });
2114
- /// DEACTIVATE
2115
- test("109 - deactivate gift 1", (t) => {
2116
- t.plan(2);
2117
- const card = Data_1.TestCards.giftCard1Swipe();
2118
- return card
2119
- .deactivate()
2120
- .execute()
2121
- .then((response) => {
2122
- t.truthy(response);
2123
- t.is(response.responseCode, "00");
2124
- });
2125
- });
2126
- /// RECEIPTS MESSAGING
2127
- test("110 - receipts messaging", () => {
2128
- /// PRINT AND SCAN RECEIPT FOR TEST 107
2129
- });
2130
- /// REWARDS
2131
- /// BALANCE INQUIRY
2132
- test("111 - balance inquiry rewards 1", (t) => {
2133
- t.plan(3);
2134
- const card = Data_1.TestCards.giftCard1Swipe();
2135
- return card
2136
- .balanceInquiry()
2137
- .execute()
2138
- .then((response) => {
2139
- t.truthy(response);
2140
- t.is(response.responseCode, "00");
2141
- t.truthy(response.pointsBalanceAmount > "0");
2142
- });
2143
- });
2144
- test("112 - balance inquiry rewards 2", (t) => {
2145
- t.plan(3);
2146
- const card = Data_1.TestCards.giftCard2Manual();
2147
- return card
2148
- .balanceInquiry()
2149
- .execute()
2150
- .then((response) => {
2151
- t.truthy(response);
2152
- t.is(response.responseCode, "00");
2153
- t.truthy(response.pointsBalanceAmount > "0");
2154
- });
2155
- });
2156
- /// ALIAS
2157
- test("113 - create alias gift 1", (t) => {
2158
- t.plan(1);
2159
- return src_1.GiftCard.create("9725550100").then((card) => {
2160
- t.truthy(card);
2161
- });
2162
- });
2163
- test("114 - create alias gift 2", (t) => {
2164
- t.plan(1);
2165
- return src_1.GiftCard.create("9725550100").then((card) => {
2166
- t.truthy(card);
2167
- });
2168
- });
2169
- test("115 - add alias gift 1", (t) => {
2170
- t.plan(2);
2171
- const card = Data_1.TestCards.giftCard1Swipe();
2172
- return card
2173
- .addAlias("2145550199")
2174
- .execute()
2175
- .then((response) => {
2176
- t.truthy(response);
2177
- t.is(response.responseCode, "00");
2178
- });
2179
- });
2180
- test("116 - add alias gift 2", (t) => {
2181
- t.plan(2);
2182
- const card = Data_1.TestCards.giftCard2Manual();
2183
- return card
2184
- .addAlias("2145550199")
2185
- .execute()
2186
- .then((response) => {
2187
- t.truthy(response);
2188
- t.is(response.responseCode, "00");
2189
- });
2190
- });
2191
- test("117 - delete alias gift 1", (t) => {
2192
- t.plan(2);
2193
- const card = Data_1.TestCards.giftCard1Swipe();
2194
- return card
2195
- .removeAlias("2145550199")
2196
- .execute()
2197
- .then((response) => {
2198
- t.truthy(response);
2199
- t.is(response.responseCode, "00");
2200
- });
2201
- });
2202
- test.after("999 - close batch", (t) => {
2203
- t.plan(1);
2204
- return new Promise((resolve, reject) => {
2205
- src_1.BatchService.closeBatch()
2206
- .then((response) => {
2207
- t.truthy(response);
2208
- resolve();
2209
- })
2210
- .catch((e) => {
2211
- if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
2212
- e.message.indexOf(BATCH_EMPTY) !== -1) {
2213
- t.pass();
2214
- resolve();
2215
- return;
2216
- }
2217
- reject(e);
2218
- });
2219
- });
2220
- });
2221
- //# sourceMappingURL=RetailTest.js.map
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_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw";
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 runSerially = false;
12
+ var test = runSerially ? ava_1.default.serial : ava_1.default;
13
+ var useTokens = false;
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
+ /// CREDIT CARD FUNCTIONS
41
+ /// CARD VERIFY
42
+ /// ACCOUNT VERIFICATION
43
+ test("001 - card verify visa", function (t) {
44
+ t.plan(5);
45
+ var card = Data_1.TestCards.visaSwipeEncrypted();
46
+ return card
47
+ .verify()
48
+ .withAllowDuplicates(true)
49
+ .withRequestMultiUseToken(useTokens)
50
+ .execute()
51
+ .then(function (response) {
52
+ t.truthy(response);
53
+ t.is(response.responseCode, "00");
54
+ return response;
55
+ })
56
+ .then(function (response) {
57
+ if (!useTokens) {
58
+ t.plan(2);
59
+ return;
60
+ }
61
+ t.truthy(response.token);
62
+ var token = new src_1.CreditCardData();
63
+ token.token = response.token;
64
+ return token
65
+ .charge(15.01)
66
+ .withAllowDuplicates(true)
67
+ .execute()
68
+ .then(function (chargeResponse) {
69
+ t.truthy(chargeResponse);
70
+ t.is(chargeResponse.responseCode, "00");
71
+ });
72
+ });
73
+ });
74
+ test("002 - card verify mastercard", function (t) {
75
+ t.plan(5);
76
+ var card = Data_1.TestCards.masterCardSwipeEncrypted();
77
+ return card
78
+ .verify()
79
+ .withAllowDuplicates(true)
80
+ .withRequestMultiUseToken(useTokens)
81
+ .execute()
82
+ .then(function (response) {
83
+ t.truthy(response);
84
+ t.is(response.responseCode, "00");
85
+ return response;
86
+ })
87
+ .then(function (response) {
88
+ if (!useTokens) {
89
+ t.plan(2);
90
+ return;
91
+ }
92
+ t.truthy(response.token);
93
+ var token = new src_1.CreditCardData();
94
+ token.token = response.token;
95
+ return token
96
+ .charge(15.02)
97
+ .withAllowDuplicates(true)
98
+ .execute()
99
+ .then(function (chargeResponse) {
100
+ t.truthy(chargeResponse);
101
+ t.is(chargeResponse.responseCode, "00");
102
+ });
103
+ });
104
+ });
105
+ test("003 - card verify discover", function (t) {
106
+ t.plan(5);
107
+ var card = Data_1.TestCards.discoverSwipeEncrypted();
108
+ return card
109
+ .verify()
110
+ .withAllowDuplicates(true)
111
+ .withRequestMultiUseToken(useTokens)
112
+ .execute()
113
+ .then(function (response) {
114
+ t.truthy(response);
115
+ t.is(response.responseCode, "00");
116
+ return response;
117
+ })
118
+ .then(function (response) {
119
+ if (!useTokens) {
120
+ t.plan(2);
121
+ return;
122
+ }
123
+ t.truthy(response.token);
124
+ var token = new src_1.CreditCardData();
125
+ token.token = response.token;
126
+ return token
127
+ .charge(15.03)
128
+ .withAllowDuplicates(true)
129
+ .execute()
130
+ .then(function (chargeResponse) {
131
+ t.truthy(chargeResponse);
132
+ t.is(chargeResponse.responseCode, "00");
133
+ });
134
+ });
135
+ });
136
+ /// Address Verification
137
+ test("004 - card verify amex", function (t) {
138
+ t.plan(5);
139
+ var address = new src_1.Address();
140
+ address.postalCode = "75024";
141
+ var card = Data_1.TestCards.amexManual(false, true);
142
+ return card
143
+ .verify()
144
+ .withAllowDuplicates(true)
145
+ .withAddress(address)
146
+ .withRequestMultiUseToken(useTokens)
147
+ .execute()
148
+ .then(function (response) {
149
+ t.truthy(response);
150
+ t.is(response.responseCode, "00");
151
+ return response;
152
+ })
153
+ .then(function (response) {
154
+ if (!useTokens) {
155
+ t.plan(2);
156
+ return;
157
+ }
158
+ t.truthy(response.token);
159
+ var token = new src_1.CreditCardData();
160
+ token.token = response.token;
161
+ return token
162
+ .charge(15.04)
163
+ .withAllowDuplicates(true)
164
+ .execute()
165
+ .then(function (chargeResponse) {
166
+ t.truthy(chargeResponse);
167
+ t.is(chargeResponse.responseCode, "00");
168
+ });
169
+ });
170
+ });
171
+ /// Balance Inquiry (for Prepaid)
172
+ test("005 - balance inquiry visa", function (t) {
173
+ t.plan(2);
174
+ var card = Data_1.TestCards.visaSwipeEncrypted();
175
+ return card
176
+ .balanceInquiry()
177
+ .execute()
178
+ .then(function (response) {
179
+ t.truthy(response);
180
+ t.is(response.responseCode, "00");
181
+ });
182
+ });
183
+ /// CREDIT SALE (for multi-use token only)
184
+ test("006 - charge visa swipe token", function (t) {
185
+ t.plan(2);
186
+ var card = Data_1.TestCards.visaSwipe();
187
+ return card
188
+ .charge(15.01)
189
+ .withCurrency("USD")
190
+ .withRequestMultiUseToken(true)
191
+ .withAllowDuplicates(true)
192
+ .execute()
193
+ .then(function (response) {
194
+ t.truthy(response);
195
+ t.is(response.responseCode, "00");
196
+ visaToken = response.token;
197
+ });
198
+ });
199
+ test("007 - charge mastercard swipe token", function (t) {
200
+ t.plan(2);
201
+ var card = Data_1.TestCards.masterCardSwipe();
202
+ return card
203
+ .charge(15.02)
204
+ .withCurrency("USD")
205
+ .withRequestMultiUseToken(true)
206
+ .withAllowDuplicates(true)
207
+ .execute()
208
+ .then(function (response) {
209
+ t.truthy(response);
210
+ t.is(response.responseCode, "00");
211
+ masterCardToken = response.token;
212
+ });
213
+ });
214
+ test("008 - charge discover swipe token", function (t) {
215
+ t.plan(2);
216
+ var card = Data_1.TestCards.discoverSwipe();
217
+ return card
218
+ .charge(15.03)
219
+ .withCurrency("USD")
220
+ .withRequestMultiUseToken(true)
221
+ .withAllowDuplicates(true)
222
+ .execute()
223
+ .then(function (response) {
224
+ t.truthy(response);
225
+ t.is(response.responseCode, "00");
226
+ discoverToken = response.token;
227
+ });
228
+ });
229
+ test("009 - charge amex swipe token", function (t) {
230
+ t.plan(2);
231
+ var card = Data_1.TestCards.amexSwipe();
232
+ return card
233
+ .charge(15.04)
234
+ .withCurrency("USD")
235
+ .withRequestMultiUseToken(true)
236
+ .withAllowDuplicates(true)
237
+ .execute()
238
+ .then(function (response) {
239
+ t.truthy(response);
240
+ t.is(response.responseCode, "00");
241
+ amexToken = response.token;
242
+ });
243
+ });
244
+ /// CREDIT SALE
245
+ /// SWIPED
246
+ test("010 - charge visa swipe", function (t) {
247
+ t.plan(4);
248
+ var card = Data_1.TestCards.visaSwipe();
249
+ return card
250
+ .charge(15.01)
251
+ .withCurrency("USD")
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
+ // test 059
261
+ return (response
262
+ .reverse(15.01)
263
+ // .withAllowDuplicates(true)
264
+ .execute()
265
+ .then(function (reverseResponse) {
266
+ t.truthy(reverseResponse);
267
+ t.is(reverseResponse.responseCode, "00");
268
+ }));
269
+ });
270
+ });
271
+ test("011 - charge mastercard swipe", function (t) {
272
+ t.plan(2);
273
+ var card = Data_1.TestCards.masterCardSwipe();
274
+ return card
275
+ .charge(15.02)
276
+ .withCurrency("USD")
277
+ .withAllowDuplicates(true)
278
+ .execute()
279
+ .then(function (response) {
280
+ t.truthy(response);
281
+ t.is(response.responseCode, "00");
282
+ });
283
+ });
284
+ test("012 - charge discover swipe", function (t) {
285
+ t.plan(2);
286
+ var card = Data_1.TestCards.discoverSwipe();
287
+ return card
288
+ .charge(15.02)
289
+ .withCurrency("USD")
290
+ .withAllowDuplicates(true)
291
+ .execute()
292
+ .then(function (response) {
293
+ t.truthy(response);
294
+ t.is(response.responseCode, "00");
295
+ });
296
+ });
297
+ test("013 - charge amex swipe", function (t) {
298
+ t.plan(2);
299
+ var card = Data_1.TestCards.amexSwipe();
300
+ return card
301
+ .charge(15.02)
302
+ .withCurrency("USD")
303
+ .withAllowDuplicates(true)
304
+ .execute()
305
+ .then(function (response) {
306
+ t.truthy(response);
307
+ t.is(response.responseCode, "00");
308
+ });
309
+ });
310
+ test("014 - charge jcb swipe", function (t) {
311
+ t.plan(4);
312
+ var card = Data_1.TestCards.visaSwipe();
313
+ return card
314
+ .charge(15.05)
315
+ .withCurrency("USD")
316
+ .withAllowDuplicates(true)
317
+ .execute()
318
+ .then(function (response) {
319
+ t.truthy(response);
320
+ t.is(response.responseCode, "00");
321
+ return response;
322
+ })
323
+ .then(function (response) {
324
+ // test 058
325
+ return (response
326
+ .refund(15.05)
327
+ // .withAllowDuplicates(true)
328
+ .withCurrency("USD")
329
+ .execute()
330
+ .then(function (refundResponse) {
331
+ t.truthy(refundResponse);
332
+ t.is(refundResponse.responseCode, "00");
333
+ }));
334
+ });
335
+ });
336
+ test("014a - charge mastercard 24 swipe", function (t) {
337
+ t.plan(2);
338
+ var card = Data_1.TestCards.masterCard24Swipe();
339
+ return card
340
+ .charge(15.34)
341
+ .withCurrency("USD")
342
+ .withAllowDuplicates(true)
343
+ .execute()
344
+ .then(function (response) {
345
+ t.truthy(response);
346
+ t.is(response.responseCode, "00");
347
+ });
348
+ });
349
+ test("014b - charge mastercard 25 swipe", function (t) {
350
+ t.plan(2);
351
+ var card = Data_1.TestCards.masterCard25Swipe();
352
+ return card
353
+ .charge(15.34)
354
+ .withCurrency("USD")
355
+ .withAllowDuplicates(true)
356
+ .execute()
357
+ .then(function (response) {
358
+ t.truthy(response);
359
+ t.is(response.responseCode, "00");
360
+ });
361
+ });
362
+ test("015 - charge visa swipe", function (t) {
363
+ t.plan(4);
364
+ var card = Data_1.TestCards.visaSwipe();
365
+ return card
366
+ .charge(15.06)
367
+ .withCurrency("USD")
368
+ .withAllowDuplicates(true)
369
+ .execute()
370
+ .then(function (response) {
371
+ t.truthy(response);
372
+ t.is(response.responseCode, "00");
373
+ return response;
374
+ })
375
+ .then(function (response) {
376
+ // test 063
377
+ return (response
378
+ .reverse(15.06)
379
+ // .withAllowDuplicates(true)
380
+ .withAuthAmount(5.06)
381
+ .execute()
382
+ .then(function (reverseResponse) {
383
+ t.truthy(reverseResponse);
384
+ t.is(reverseResponse.responseCode, "00");
385
+ }));
386
+ });
387
+ });
388
+ /// Manually Entered - Card Present
389
+ test("016 - charge visa manual card present", function (t) {
390
+ t.plan(2);
391
+ var address = new src_1.Address();
392
+ address.postalCode = "750241234";
393
+ address.streetAddress1 = "6860 Dallas Pkwy";
394
+ var card = Data_1.TestCards.visaManual(true, true);
395
+ return card
396
+ .charge(16.01)
397
+ .withAllowDuplicates(true)
398
+ .withCurrency("USD")
399
+ .withAddress(address)
400
+ .execute()
401
+ .then(function (response) {
402
+ t.truthy(response);
403
+ t.is(response.responseCode, "00");
404
+ });
405
+ });
406
+ test("017 - charge mastercard manual card present", function (t) {
407
+ t.plan(4);
408
+ var address = new src_1.Address();
409
+ address.postalCode = "75024";
410
+ address.streetAddress1 = "6860 Dallas Pkwy";
411
+ var card = Data_1.TestCards.masterCardManual(true, true);
412
+ return card
413
+ .charge(16.02)
414
+ .withAllowDuplicates(true)
415
+ .withCurrency("USD")
416
+ .withAddress(address)
417
+ .execute()
418
+ .then(function (response) {
419
+ t.truthy(response);
420
+ t.is(response.responseCode, "00");
421
+ return response;
422
+ })
423
+ .then(function (response) {
424
+ // test case 60
425
+ return (response
426
+ .reverse(16.02)
427
+ // .withAllowDuplicates(true)
428
+ .execute()
429
+ .then(function (reverseResponse) {
430
+ t.truthy(reverseResponse);
431
+ t.is(reverseResponse.responseCode, "00");
432
+ }));
433
+ });
434
+ });
435
+ test("018 - charge discover manual card present", function (t) {
436
+ t.plan(2);
437
+ var address = new src_1.Address();
438
+ address.postalCode = "750241234";
439
+ var card = Data_1.TestCards.discoverManual(true, true);
440
+ return card
441
+ .charge(16.03)
442
+ .withAllowDuplicates(true)
443
+ .withCurrency("USD")
444
+ .withAddress(address)
445
+ .execute()
446
+ .then(function (response) {
447
+ t.truthy(response);
448
+ t.is(response.responseCode, "00");
449
+ });
450
+ });
451
+ test("019 - charge amex manual card present", function (t) {
452
+ t.plan(2);
453
+ var address = new src_1.Address();
454
+ address.postalCode = "75024";
455
+ address.streetAddress1 = "6860";
456
+ var card = Data_1.TestCards.amexManual(true, true);
457
+ return card
458
+ .charge(16.04)
459
+ .withAllowDuplicates(true)
460
+ .withCurrency("USD")
461
+ .withAddress(address)
462
+ .execute()
463
+ .then(function (response) {
464
+ t.truthy(response);
465
+ t.is(response.responseCode, "00");
466
+ });
467
+ });
468
+ test("020 - charge jcb manual card present", function (t) {
469
+ t.plan(2);
470
+ var address = new src_1.Address();
471
+ address.postalCode = "75024";
472
+ var card = Data_1.TestCards.jcbManual(true, true);
473
+ return card
474
+ .charge(16.05)
475
+ .withAllowDuplicates(true)
476
+ .withCurrency("USD")
477
+ .withAddress(address)
478
+ .execute()
479
+ .then(function (response) {
480
+ t.truthy(response);
481
+ t.is(response.responseCode, "00");
482
+ });
483
+ });
484
+ test("021 - charge discover manual card present", function (t) {
485
+ t.plan(4);
486
+ var address = new src_1.Address();
487
+ address.postalCode = "750241234";
488
+ address.streetAddress1 = "6860 Dallas Pkwy";
489
+ var card = Data_1.TestCards.discoverManual(true, true);
490
+ return card
491
+ .charge(16.07)
492
+ .withAllowDuplicates(true)
493
+ .withCurrency("USD")
494
+ .withAddress(address)
495
+ .execute()
496
+ .then(function (response) {
497
+ t.truthy(response);
498
+ t.is(response.responseCode, "00");
499
+ return response;
500
+ })
501
+ .then(function (response) {
502
+ // test case 64
503
+ return (response
504
+ .reverse(16.07)
505
+ // .withAllowDuplicates(true)
506
+ .withAuthAmount(6.07)
507
+ .execute()
508
+ .then(function (reverseResponse) {
509
+ t.truthy(reverseResponse);
510
+ t.is(reverseResponse.responseCode, "00");
511
+ }));
512
+ });
513
+ });
514
+ /// Manually Entered - Card Not Present
515
+ test("022 - charge visa manual card not present", function (t) {
516
+ t.plan(2);
517
+ var address = new src_1.Address();
518
+ address.postalCode = "750241234";
519
+ address.streetAddress1 = "6860 Dallas Pkwy";
520
+ var card;
521
+ if (useTokens) {
522
+ card = new src_1.CreditCardData();
523
+ card.token = visaToken;
524
+ }
525
+ else {
526
+ card = Data_1.TestCards.visaManual(false, true);
527
+ }
528
+ return card
529
+ .charge(17.01)
530
+ .withAllowDuplicates(true)
531
+ .withCurrency("USD")
532
+ .withAddress(address)
533
+ .execute()
534
+ .then(function (response) {
535
+ t.truthy(response);
536
+ t.is(response.responseCode, "00");
537
+ });
538
+ });
539
+ test("023 - charge mastercard manual card not present", function (t) {
540
+ t.plan(4);
541
+ var address = new src_1.Address();
542
+ address.postalCode = "75024";
543
+ address.streetAddress1 = "6860 Dallas Pkwy";
544
+ var card;
545
+ if (useTokens) {
546
+ card = new src_1.CreditCardData();
547
+ card.token = masterCardToken;
548
+ }
549
+ else {
550
+ card = Data_1.TestCards.masterCardManual(false, true);
551
+ }
552
+ return card
553
+ .charge(17.02)
554
+ .withAllowDuplicates(true)
555
+ .withCurrency("USD")
556
+ .withAddress(address)
557
+ .execute()
558
+ .then(function (response) {
559
+ t.truthy(response);
560
+ t.is(response.responseCode, "00");
561
+ return response;
562
+ })
563
+ .then(function (response) {
564
+ // test case 61
565
+ return (response
566
+ .reverse(17.02)
567
+ // .withAllowDuplicates(true)
568
+ .execute()
569
+ .then(function (reverseResponse) {
570
+ t.truthy(reverseResponse);
571
+ t.is(reverseResponse.responseCode, "00");
572
+ }));
573
+ });
574
+ });
575
+ test("024 - charge discover manual card not present", function (t) {
576
+ t.plan(2);
577
+ var address = new src_1.Address();
578
+ address.postalCode = "750241234";
579
+ var card;
580
+ if (useTokens) {
581
+ card = new src_1.CreditCardData();
582
+ card.token = discoverToken;
583
+ }
584
+ else {
585
+ card = Data_1.TestCards.discoverManual(false, true);
586
+ }
587
+ return card
588
+ .charge(17.03)
589
+ .withAllowDuplicates(true)
590
+ .withCurrency("USD")
591
+ .withAddress(address)
592
+ .execute()
593
+ .then(function (response) {
594
+ t.truthy(response);
595
+ t.is(response.responseCode, "00");
596
+ });
597
+ });
598
+ test("025 - charge amex manual card not present", function (t) {
599
+ t.plan(2);
600
+ var address = new src_1.Address();
601
+ address.postalCode = "75024";
602
+ address.streetAddress1 = "6860";
603
+ var card;
604
+ if (useTokens) {
605
+ card = new src_1.CreditCardData();
606
+ card.token = amexToken;
607
+ }
608
+ else {
609
+ card = Data_1.TestCards.amexManual(false, true);
610
+ }
611
+ return card
612
+ .charge(17.04)
613
+ .withAllowDuplicates(true)
614
+ .withCurrency("USD")
615
+ .withAddress(address)
616
+ .execute()
617
+ .then(function (response) {
618
+ t.truthy(response);
619
+ t.is(response.responseCode, "00");
620
+ });
621
+ });
622
+ test("026 - charge jcb manual card not present", function (t) {
623
+ t.plan(2);
624
+ var address = new src_1.Address();
625
+ address.postalCode = "75024";
626
+ var card = Data_1.TestCards.jcbManual(false, true);
627
+ return card
628
+ .charge(17.05)
629
+ .withAllowDuplicates(true)
630
+ .withCurrency("USD")
631
+ .withAddress(address)
632
+ .execute()
633
+ .then(function (response) {
634
+ t.truthy(response);
635
+ t.is(response.responseCode, "00");
636
+ });
637
+ });
638
+ /// Contactless
639
+ test("027 - charge visa contactless", function (t) {
640
+ t.plan(2);
641
+ var card = Data_1.TestCards.visaSwipe(src_1.EntryMethod.Proximity);
642
+ return card
643
+ .charge(18.01)
644
+ .withAllowDuplicates(true)
645
+ .withCurrency("USD")
646
+ .execute()
647
+ .then(function (response) {
648
+ t.truthy(response);
649
+ t.is(response.responseCode, "00");
650
+ });
651
+ });
652
+ test("028 - charge mastercard contactless", function (t) {
653
+ t.plan(2);
654
+ var card = Data_1.TestCards.masterCardSwipe(src_1.EntryMethod.Proximity);
655
+ return card
656
+ .charge(18.02)
657
+ .withAllowDuplicates(true)
658
+ .withCurrency("USD")
659
+ .execute()
660
+ .then(function (response) {
661
+ t.truthy(response);
662
+ t.is(response.responseCode, "00");
663
+ });
664
+ });
665
+ test("029 - charge discover contactless", function (t) {
666
+ t.plan(2);
667
+ var card = Data_1.TestCards.discoverSwipe(src_1.EntryMethod.Proximity);
668
+ return card
669
+ .charge(18.03)
670
+ .withAllowDuplicates(true)
671
+ .withCurrency("USD")
672
+ .execute()
673
+ .then(function (response) {
674
+ t.truthy(response);
675
+ t.is(response.responseCode, "00");
676
+ });
677
+ });
678
+ test("030 - charge amex contactless", function (t) {
679
+ t.plan(2);
680
+ var card = Data_1.TestCards.amexSwipe(src_1.EntryMethod.Proximity);
681
+ return card
682
+ .charge(18.04)
683
+ .withAllowDuplicates(true)
684
+ .withCurrency("USD")
685
+ .execute()
686
+ .then(function (response) {
687
+ t.truthy(response);
688
+ t.is(response.responseCode, "00");
689
+ });
690
+ });
691
+ /// AUTHORIZATION
692
+ test("031 - authorize visa swipe", function (t) {
693
+ t.plan(4);
694
+ var card = Data_1.TestCards.visaSwipe();
695
+ // 031a authorize
696
+ return (card
697
+ .authorize(15.08)
698
+ .withAllowDuplicates(true)
699
+ .withCurrency("USD")
700
+ .execute()
701
+ .then(function (response) {
702
+ t.truthy(response);
703
+ t.is(response.responseCode, "00");
704
+ return response;
705
+ })
706
+ // 031b capture
707
+ .then(function (response) {
708
+ return response
709
+ .capture()
710
+ .execute()
711
+ .then(function (captureResponse) {
712
+ t.truthy(captureResponse);
713
+ t.is(captureResponse.responseCode, "00");
714
+ });
715
+ }));
716
+ });
717
+ test("032 - authorize visa swipe additional auth", function (t) {
718
+ t.plan(4);
719
+ var card = Data_1.TestCards.visaSwipe();
720
+ // 032a authorize
721
+ return (card
722
+ .authorize(15.09)
723
+ .withAllowDuplicates(true)
724
+ .withCurrency("USD")
725
+ .execute()
726
+ .then(function (response) {
727
+ t.truthy(response);
728
+ t.is(response.responseCode, "00");
729
+ return response;
730
+ })
731
+ // 032b Additional Auth (restaurant only)
732
+ // 032c Add to batch
733
+ .then(function (response) {
734
+ return response
735
+ .capture()
736
+ .execute()
737
+ .then(function (captureResponse) {
738
+ t.truthy(captureResponse);
739
+ t.is(captureResponse.responseCode, "00");
740
+ });
741
+ }));
742
+ });
743
+ test("033 - authorize mastercard swipe", function (t) {
744
+ t.plan(4);
745
+ var card = Data_1.TestCards.masterCardSwipe();
746
+ // 033a authorize
747
+ return (card
748
+ .authorize(15.1)
749
+ .withAllowDuplicates(true)
750
+ .withCurrency("USD")
751
+ .execute()
752
+ .then(function (response) {
753
+ t.truthy(response);
754
+ t.is(response.responseCode, "00");
755
+ return response;
756
+ })
757
+ // 033b capture
758
+ .then(function (response) {
759
+ return response
760
+ .capture()
761
+ .execute()
762
+ .then(function (captureResponse) {
763
+ t.truthy(captureResponse);
764
+ t.is(captureResponse.responseCode, "00");
765
+ });
766
+ }));
767
+ });
768
+ test("033a - authorize discover swipe", function (t) {
769
+ t.plan(2);
770
+ var card = Data_1.TestCards.discoverSwipe();
771
+ return card
772
+ .authorize(15.1)
773
+ .withCurrency("USD")
774
+ .withAllowDuplicates(true)
775
+ .execute()
776
+ .then(function (response) {
777
+ t.truthy(response);
778
+ t.is(response.responseCode, "00");
779
+ });
780
+ });
781
+ /// AUTHORIZATION - Manually Entered, Card Present
782
+ test("034 - authorize visa manual card present", function (t) {
783
+ t.plan(4);
784
+ var address = new src_1.Address();
785
+ address.postalCode = "75024";
786
+ address.streetAddress1 = "6860 Dallas Pkwy";
787
+ var card = Data_1.TestCards.visaManual(true, true);
788
+ // 034a authorize
789
+ return (card
790
+ .authorize(16.08)
791
+ .withAllowDuplicates(true)
792
+ .withCurrency("USD")
793
+ .withAddress(address)
794
+ .execute()
795
+ .then(function (response) {
796
+ t.truthy(response);
797
+ t.is(response.responseCode, "00");
798
+ return response;
799
+ })
800
+ // 034b capture
801
+ .then(function (response) {
802
+ return response
803
+ .capture()
804
+ .execute()
805
+ .then(function (captureResponse) {
806
+ t.truthy(captureResponse);
807
+ t.is(captureResponse.responseCode, "00");
808
+ });
809
+ }));
810
+ });
811
+ test("035 - authorize visa manual card present additional auth", function (t) {
812
+ t.plan(4);
813
+ var address = new src_1.Address();
814
+ address.postalCode = "75024";
815
+ address.streetAddress1 = "6860 Dallas Pkwy";
816
+ var card = Data_1.TestCards.visaManual(true, true);
817
+ // 035a authorize
818
+ return (card
819
+ .authorize(16.09)
820
+ .withAllowDuplicates(true)
821
+ .withCurrency("USD")
822
+ .withAddress(address)
823
+ .execute()
824
+ .then(function (response) {
825
+ t.truthy(response);
826
+ t.is(response.responseCode, "00");
827
+ return response;
828
+ })
829
+ // 035b Additional Auth (restaurant only)
830
+ // 035c Add to batch
831
+ .then(function (response) {
832
+ return response
833
+ .capture()
834
+ .execute()
835
+ .then(function (captureResponse) {
836
+ t.truthy(captureResponse);
837
+ t.is(captureResponse.responseCode, "00");
838
+ });
839
+ }));
840
+ });
841
+ test("036 - authorize mastercard manual card present", function (t) {
842
+ t.plan(4);
843
+ var address = new src_1.Address();
844
+ address.postalCode = "75024";
845
+ address.streetAddress1 = "6860 Dallas Pkwy";
846
+ var card = Data_1.TestCards.masterCardManual(true, true);
847
+ // 036a authorize
848
+ return (card
849
+ .authorize(16.1)
850
+ .withAllowDuplicates(true)
851
+ .withCurrency("USD")
852
+ .withAddress(address)
853
+ .execute()
854
+ .then(function (response) {
855
+ t.truthy(response);
856
+ t.is(response.responseCode, "00");
857
+ return response;
858
+ })
859
+ // 036b capture
860
+ .then(function (response) {
861
+ return response
862
+ .capture()
863
+ .execute()
864
+ .then(function (captureResponse) {
865
+ t.truthy(captureResponse);
866
+ t.is(captureResponse.responseCode, "00");
867
+ });
868
+ }));
869
+ });
870
+ test("036a - authorize discover manual card present", function (t) {
871
+ t.plan(2);
872
+ var address = new src_1.Address();
873
+ address.postalCode = "750241234";
874
+ var card = Data_1.TestCards.discoverManual(true, true);
875
+ return card
876
+ .authorize(16.1)
877
+ .withAllowDuplicates(true)
878
+ .withCurrency("USD")
879
+ .withAddress(address)
880
+ .execute()
881
+ .then(function (response) {
882
+ t.truthy(response);
883
+ t.is(response.responseCode, "00");
884
+ });
885
+ });
886
+ /// AUTHORIZATION - Manually Entered, Card Not Present
887
+ test("037 - authorize visa manual", function (t) {
888
+ t.plan(4);
889
+ var address = new src_1.Address();
890
+ address.postalCode = "750241234";
891
+ address.streetAddress1 = "6860 Dallas Pkwy";
892
+ var card = Data_1.TestCards.visaManual(false, true);
893
+ // 034a authorize
894
+ return (card
895
+ .authorize(17.08)
896
+ .withAllowDuplicates(true)
897
+ .withCurrency("USD")
898
+ .withAddress(address)
899
+ .execute()
900
+ .then(function (response) {
901
+ t.truthy(response);
902
+ t.is(response.responseCode, "00");
903
+ return response;
904
+ })
905
+ // 034b capture
906
+ .then(function (response) {
907
+ return response
908
+ .capture()
909
+ .execute()
910
+ .then(function (captureResponse) {
911
+ t.truthy(captureResponse);
912
+ t.is(captureResponse.responseCode, "00");
913
+ });
914
+ }));
915
+ });
916
+ test("038 - authorize mastercard manual", function (t) {
917
+ t.plan(4);
918
+ var address = new src_1.Address();
919
+ address.postalCode = "750241234";
920
+ address.streetAddress1 = "6860";
921
+ var card = Data_1.TestCards.masterCardManual(false, true);
922
+ // 036a authorize
923
+ return (card
924
+ .authorize(17.09)
925
+ .withAllowDuplicates(true)
926
+ .withCurrency("USD")
927
+ .withAddress(address)
928
+ .execute()
929
+ .then(function (response) {
930
+ t.truthy(response);
931
+ t.is(response.responseCode, "00");
932
+ return response;
933
+ })
934
+ // 036b capture
935
+ .then(function (response) {
936
+ return response
937
+ .capture()
938
+ .execute()
939
+ .then(function (captureResponse) {
940
+ t.truthy(captureResponse);
941
+ t.is(captureResponse.responseCode, "00");
942
+ });
943
+ }));
944
+ });
945
+ test("038a - authorize discover manual", function (t) {
946
+ t.plan(2);
947
+ var address = new src_1.Address();
948
+ address.postalCode = "750241234";
949
+ var card = Data_1.TestCards.discoverManual(false, true);
950
+ return card
951
+ .authorize(17.1)
952
+ .withAllowDuplicates(true)
953
+ .withCurrency("USD")
954
+ .withAddress(address)
955
+ .execute()
956
+ .then(function (response) {
957
+ t.truthy(response);
958
+ t.is(response.responseCode, "00");
959
+ });
960
+ });
961
+ /// PARTIALLY APPROVED SALE (Required)
962
+ test("039 - charge discover swipe partial approval", function (t) {
963
+ t.plan(3);
964
+ var card = Data_1.TestCards.discoverSwipe();
965
+ return card
966
+ .charge(40.0)
967
+ .withAllowDuplicates(true)
968
+ .withCurrency("USD")
969
+ .withAllowPartialAuth(true)
970
+ .execute()
971
+ .then(function (response) {
972
+ t.truthy(response);
973
+ t.is(response.responseCode, "10");
974
+ t.is(response.authorizedAmount, "40.00");
975
+ });
976
+ });
977
+ test("040 - charge visa swipe partial approval", function (t) {
978
+ t.plan(3);
979
+ var card = Data_1.TestCards.visaSwipe();
980
+ return card
981
+ .charge(130.0)
982
+ .withAllowDuplicates(true)
983
+ .withCurrency("USD")
984
+ .withAllowPartialAuth(true)
985
+ .execute()
986
+ .then(function (response) {
987
+ t.truthy(response);
988
+ t.is(response.responseCode, "10");
989
+ t.is(response.authorizedAmount, "110.00");
990
+ });
991
+ });
992
+ test("041 - charge discover manual partial approval", function (t) {
993
+ t.plan(3);
994
+ var address = new src_1.Address();
995
+ address.postalCode = "75024";
996
+ var card = Data_1.TestCards.discoverManual(true, true);
997
+ return card
998
+ .charge(145.0)
999
+ .withAllowDuplicates(true)
1000
+ .withCurrency("USD")
1001
+ .withAllowPartialAuth(true)
1002
+ .withAddress(address)
1003
+ .execute()
1004
+ .then(function (response) {
1005
+ t.truthy(response);
1006
+ t.is(response.responseCode, "10");
1007
+ t.is(response.authorizedAmount, "65.00");
1008
+ });
1009
+ });
1010
+ test("042 - charge mastercard swipe partial approval", function (t) {
1011
+ t.plan(5);
1012
+ var card = Data_1.TestCards.masterCardSwipe();
1013
+ return (card
1014
+ .charge(155.0)
1015
+ .withAllowDuplicates(true)
1016
+ .withCurrency("USD")
1017
+ .withAllowPartialAuth(true)
1018
+ .execute()
1019
+ .then(function (response) {
1020
+ t.truthy(response);
1021
+ t.is(response.responseCode, "10");
1022
+ t.is(response.authorizedAmount, "100.00");
1023
+ return response;
1024
+ })
1025
+ // test case 62
1026
+ .then(function (response) {
1027
+ return (response
1028
+ .reverse(100.0)
1029
+ // .withAllowDuplicates(true)
1030
+ .execute()
1031
+ .then(function (reverseResponse) {
1032
+ t.truthy(reverseResponse);
1033
+ t.is(reverseResponse.responseCode, "00");
1034
+ }));
1035
+ }));
1036
+ });
1037
+ /// SALE WITH GRATUITY
1038
+ /// Tip Edit (Tip at Settlement)
1039
+ test("043 - charge visa swipe edit gratuity", function (t) {
1040
+ var card = Data_1.TestCards.visaSwipe();
1041
+ return card
1042
+ .charge(15.12)
1043
+ .withAllowDuplicates(true)
1044
+ .withCurrency("USD")
1045
+ .execute()
1046
+ .then(function (response) {
1047
+ t.truthy(response);
1048
+ t.is(response.responseCode, "00");
1049
+ return response;
1050
+ })
1051
+ .then(function (response) {
1052
+ return (response
1053
+ .edit()
1054
+ // .withAllowDuplicates(true)
1055
+ .withAmount(18.12)
1056
+ .withGratuity(3.0)
1057
+ .execute()
1058
+ .then(function (editResponse) {
1059
+ t.truthy(editResponse);
1060
+ t.is(editResponse.responseCode, "00");
1061
+ }));
1062
+ });
1063
+ });
1064
+ test("044 - charge mastercard manual edit gratuity", function (t) {
1065
+ t.plan(4);
1066
+ var address = new src_1.Address();
1067
+ address.postalCode = "75024";
1068
+ var card = Data_1.TestCards.masterCardManual(true, true);
1069
+ return card
1070
+ .charge(15.13)
1071
+ .withAllowDuplicates(true)
1072
+ .withCurrency("USD")
1073
+ .withAddress(address)
1074
+ .execute()
1075
+ .then(function (response) {
1076
+ t.truthy(response);
1077
+ t.is(response.responseCode, "00");
1078
+ return response;
1079
+ })
1080
+ .then(function (response) {
1081
+ return (response
1082
+ .edit()
1083
+ // .withAllowDuplicates(true)
1084
+ .withAmount(18.13)
1085
+ .withGratuity(3.0)
1086
+ .execute()
1087
+ .then(function (editResponse) {
1088
+ t.truthy(editResponse);
1089
+ t.is(editResponse.responseCode, "00");
1090
+ }));
1091
+ });
1092
+ });
1093
+ /// Tip on Purchase
1094
+ test("045 - charge visa manual gratuity", function (t) {
1095
+ t.plan(2);
1096
+ var address = new src_1.Address();
1097
+ address.postalCode = "75024";
1098
+ var card = Data_1.TestCards.visaManual(true, true);
1099
+ return card
1100
+ .charge(18.61)
1101
+ .withAllowDuplicates(true)
1102
+ .withCurrency("USD")
1103
+ .withAddress(address)
1104
+ .withGratuity(3.5)
1105
+ .execute()
1106
+ .then(function (response) {
1107
+ t.truthy(response);
1108
+ t.is(response.responseCode, "00");
1109
+ });
1110
+ });
1111
+ test("046 - charge mastercard swipe gratuity", function (t) {
1112
+ t.plan(4);
1113
+ var card = Data_1.TestCards.masterCardSwipe();
1114
+ return card
1115
+ .charge(18.62)
1116
+ .withAllowDuplicates(true)
1117
+ .withCurrency("USD")
1118
+ .withGratuity(3.5)
1119
+ .execute()
1120
+ .then(function (response) {
1121
+ t.truthy(response);
1122
+ t.is(response.responseCode, "00");
1123
+ return response;
1124
+ })
1125
+ .then(function (response) {
1126
+ return (response
1127
+ .edit()
1128
+ // .withAllowDuplicates(true)
1129
+ .withAmount(18.12)
1130
+ .withGratuity(3.0)
1131
+ .execute()
1132
+ .then(function (editResponse) {
1133
+ t.truthy(editResponse);
1134
+ t.is(editResponse.responseCode, "00");
1135
+ }));
1136
+ });
1137
+ });
1138
+ /// LEVEL II CORPORATE PURCHASE CARD
1139
+ test("047 - level ii visa swipe response b", function (t) {
1140
+ t.plan(5);
1141
+ var card = Data_1.TestCards.visaSwipe();
1142
+ return card
1143
+ .charge(112.34)
1144
+ .withAllowDuplicates(true)
1145
+ .withCurrency("USD")
1146
+ .withCommercialRequest(true)
1147
+ .execute()
1148
+ .then(function (response) {
1149
+ t.truthy(response);
1150
+ t.is(response.responseCode, "00");
1151
+ t.is(response.commercialIndicator, "B");
1152
+ return response;
1153
+ })
1154
+ .then(function (response) {
1155
+ return (response
1156
+ .edit()
1157
+ // .withAllowDuplicates(true)
1158
+ .withTaxType(src_1.TaxType.SalesTax)
1159
+ .withTaxAmount(1)
1160
+ .execute()
1161
+ .then(function (cpcResponse) {
1162
+ t.truthy(cpcResponse);
1163
+ t.is(cpcResponse.responseCode, "00");
1164
+ }));
1165
+ });
1166
+ });
1167
+ test("047a - level ii visa swipe response b", function (t) {
1168
+ t.plan(5);
1169
+ var card = Data_1.TestCards.visaSwipe();
1170
+ return card
1171
+ .charge(112.34)
1172
+ .withAllowDuplicates(true)
1173
+ .withCurrency("USD")
1174
+ .withCommercialRequest(true)
1175
+ .execute()
1176
+ .then(function (response) {
1177
+ t.truthy(response);
1178
+ t.is(response.responseCode, "00");
1179
+ t.is(response.commercialIndicator, "B");
1180
+ return response;
1181
+ })
1182
+ .then(function (response) {
1183
+ return (response
1184
+ .edit()
1185
+ // .withAllowDuplicates(true)
1186
+ .withTaxType(src_1.TaxType.NotUsed)
1187
+ .execute()
1188
+ .then(function (cpcResponse) {
1189
+ t.truthy(cpcResponse);
1190
+ t.is(cpcResponse.responseCode, "00");
1191
+ }));
1192
+ });
1193
+ });
1194
+ test("048 - level ii visa swipe response r", function (t) {
1195
+ t.plan(5);
1196
+ var card = Data_1.TestCards.visaSwipe();
1197
+ return card
1198
+ .charge(123.45)
1199
+ .withAllowDuplicates(true)
1200
+ .withCurrency("USD")
1201
+ .withCommercialRequest(true)
1202
+ .execute()
1203
+ .then(function (response) {
1204
+ t.truthy(response);
1205
+ t.is(response.responseCode, "00");
1206
+ t.is(response.commercialIndicator, "R");
1207
+ return response;
1208
+ })
1209
+ .then(function (response) {
1210
+ return (response
1211
+ .edit()
1212
+ // .withAllowDuplicates(true)
1213
+ .withTaxType(src_1.TaxType.TaxExempt)
1214
+ .execute()
1215
+ .then(function (cpcResponse) {
1216
+ t.truthy(cpcResponse);
1217
+ t.is(cpcResponse.responseCode, "00");
1218
+ }));
1219
+ });
1220
+ });
1221
+ test("049 - level ii visa manual response s", function (t) {
1222
+ t.plan(5);
1223
+ var address = new src_1.Address();
1224
+ address.postalCode = "75024";
1225
+ var card = Data_1.TestCards.visaManual(true, true);
1226
+ return card
1227
+ .charge(134.56)
1228
+ .withAllowDuplicates(true)
1229
+ .withCurrency("USD")
1230
+ .withAddress(address)
1231
+ .withCommercialRequest(true)
1232
+ .execute()
1233
+ .then(function (response) {
1234
+ t.truthy(response);
1235
+ t.is(response.responseCode, "00");
1236
+ t.is(response.commercialIndicator, "S");
1237
+ return response;
1238
+ })
1239
+ .then(function (response) {
1240
+ return (response
1241
+ .edit()
1242
+ // .withAllowDuplicates(true)
1243
+ .withPoNumber("9876543210")
1244
+ .withTaxType(src_1.TaxType.SalesTax)
1245
+ .withTaxAmount(1)
1246
+ .execute()
1247
+ .then(function (cpcResponse) {
1248
+ t.truthy(cpcResponse);
1249
+ t.is(cpcResponse.responseCode, "00");
1250
+ }));
1251
+ });
1252
+ });
1253
+ test("050 - level ii mastercard swipe response s", function (t) {
1254
+ t.plan(5);
1255
+ var card = Data_1.TestCards.masterCardSwipe();
1256
+ return card
1257
+ .charge(111.06)
1258
+ .withAllowDuplicates(true)
1259
+ .withCurrency("USD")
1260
+ .withCommercialRequest(true)
1261
+ .execute()
1262
+ .then(function (response) {
1263
+ t.truthy(response);
1264
+ t.is(response.responseCode, "00");
1265
+ t.is(response.commercialIndicator, "S");
1266
+ return response;
1267
+ })
1268
+ .then(function (response) {
1269
+ return (response
1270
+ .edit()
1271
+ // .withAllowDuplicates(true)
1272
+ .withPoNumber("9876543210")
1273
+ .withTaxType(src_1.TaxType.NotUsed)
1274
+ .execute()
1275
+ .then(function (cpcResponse) {
1276
+ t.truthy(cpcResponse);
1277
+ t.is(cpcResponse.responseCode, "00");
1278
+ }));
1279
+ });
1280
+ });
1281
+ test("051 - level ii mastercard manual response s", function (t) {
1282
+ t.plan(5);
1283
+ var address = new src_1.Address();
1284
+ address.postalCode = "75024";
1285
+ var card = Data_1.TestCards.masterCardManual(true, true);
1286
+ return card
1287
+ .charge(111.07)
1288
+ .withAllowDuplicates(true)
1289
+ .withCurrency("USD")
1290
+ .withAddress(address)
1291
+ .withCommercialRequest(true)
1292
+ .execute()
1293
+ .then(function (response) {
1294
+ t.truthy(response);
1295
+ t.is(response.responseCode, "00");
1296
+ t.is(response.commercialIndicator, "S");
1297
+ return response;
1298
+ })
1299
+ .then(function (response) {
1300
+ return (response
1301
+ .edit()
1302
+ // .withAllowDuplicates(true)
1303
+ .withPoNumber("9876543210")
1304
+ .withTaxType(src_1.TaxType.SalesTax)
1305
+ .withTaxAmount(1)
1306
+ .execute()
1307
+ .then(function (cpcResponse) {
1308
+ t.truthy(cpcResponse);
1309
+ t.is(cpcResponse.responseCode, "00");
1310
+ }));
1311
+ });
1312
+ });
1313
+ test("051a - level ii mastercard manual response s", function (t) {
1314
+ t.plan(5);
1315
+ var address = new src_1.Address();
1316
+ address.postalCode = "75024";
1317
+ var card = Data_1.TestCards.masterCardManual(true, true);
1318
+ return card
1319
+ .charge(111.08)
1320
+ .withAllowDuplicates(true)
1321
+ .withCurrency("USD")
1322
+ .withAddress(address)
1323
+ .withCommercialRequest(true)
1324
+ .execute()
1325
+ .then(function (response) {
1326
+ t.truthy(response);
1327
+ t.is(response.responseCode, "00");
1328
+ t.is(response.commercialIndicator, "S");
1329
+ return response;
1330
+ })
1331
+ .then(function (response) {
1332
+ return (response
1333
+ .edit()
1334
+ // .withAllowDuplicates(true)
1335
+ .withPoNumber("9876543210")
1336
+ .withTaxType(src_1.TaxType.SalesTax)
1337
+ .withTaxAmount(1)
1338
+ .execute()
1339
+ .then(function (cpcResponse) {
1340
+ t.truthy(cpcResponse);
1341
+ t.is(cpcResponse.responseCode, "00");
1342
+ }));
1343
+ });
1344
+ });
1345
+ test("052 - level ii mastercard manual response s", function (t) {
1346
+ t.plan(5);
1347
+ var address = new src_1.Address();
1348
+ address.postalCode = "75024";
1349
+ var card = Data_1.TestCards.masterCardManual(true, true);
1350
+ return card
1351
+ .charge(111.09)
1352
+ .withAllowDuplicates(true)
1353
+ .withCurrency("USD")
1354
+ .withAddress(address)
1355
+ .withCommercialRequest(true)
1356
+ .execute()
1357
+ .then(function (response) {
1358
+ t.truthy(response);
1359
+ t.is(response.responseCode, "00");
1360
+ t.is(response.commercialIndicator, "S");
1361
+ return response;
1362
+ })
1363
+ .then(function (response) {
1364
+ return (response
1365
+ .edit()
1366
+ // .withAllowDuplicates(true)
1367
+ .withPoNumber("9876543210")
1368
+ .withTaxType(src_1.TaxType.TaxExempt)
1369
+ .execute()
1370
+ .then(function (cpcResponse) {
1371
+ t.truthy(cpcResponse);
1372
+ t.is(cpcResponse.responseCode, "00");
1373
+ }));
1374
+ });
1375
+ });
1376
+ test("053 - level ii amex swipe no response", function (t) {
1377
+ t.plan(5);
1378
+ var card = Data_1.TestCards.amexSwipe();
1379
+ return card
1380
+ .charge(111.1)
1381
+ .withAllowDuplicates(true)
1382
+ .withCurrency("USD")
1383
+ .withCommercialRequest(true)
1384
+ .execute()
1385
+ .then(function (response) {
1386
+ t.truthy(response);
1387
+ t.is(response.responseCode, "00");
1388
+ t.is(response.commercialIndicator, "0");
1389
+ return response;
1390
+ })
1391
+ .then(function (response) {
1392
+ return (response
1393
+ .edit()
1394
+ // .withAllowDuplicates(true)
1395
+ .withTaxType(src_1.TaxType.SalesTax)
1396
+ .withTaxAmount(1)
1397
+ .execute()
1398
+ .then(function (cpcResponse) {
1399
+ t.truthy(cpcResponse);
1400
+ t.is(cpcResponse.responseCode, "00");
1401
+ }));
1402
+ });
1403
+ });
1404
+ test("054 - level ii amex manual no response", function (t) {
1405
+ t.plan(5);
1406
+ var address = new src_1.Address();
1407
+ address.postalCode = "75024";
1408
+ var card = Data_1.TestCards.amexManual(true, true);
1409
+ return card
1410
+ .charge(111.11)
1411
+ .withAllowDuplicates(true)
1412
+ .withCurrency("USD")
1413
+ .withAddress(address)
1414
+ .withCommercialRequest(true)
1415
+ .execute()
1416
+ .then(function (response) {
1417
+ t.truthy(response);
1418
+ t.is(response.responseCode, "00");
1419
+ t.is(response.commercialIndicator, "0");
1420
+ return response;
1421
+ })
1422
+ .then(function (response) {
1423
+ return (response
1424
+ .edit()
1425
+ // .withAllowDuplicates(true)
1426
+ .withPoNumber("9876543210")
1427
+ .withTaxType(src_1.TaxType.NotUsed)
1428
+ .execute()
1429
+ .then(function (cpcResponse) {
1430
+ t.truthy(cpcResponse);
1431
+ t.is(cpcResponse.responseCode, "00");
1432
+ }));
1433
+ });
1434
+ });
1435
+ test("055 - level ii amex manual no response", function (t) {
1436
+ t.plan(5);
1437
+ var address = new src_1.Address();
1438
+ address.postalCode = "75024";
1439
+ var card = Data_1.TestCards.amexManual(true, true);
1440
+ return card
1441
+ .charge(111.12)
1442
+ .withAllowDuplicates(true)
1443
+ .withCurrency("USD")
1444
+ .withAddress(address)
1445
+ .withCommercialRequest(true)
1446
+ .execute()
1447
+ .then(function (response) {
1448
+ t.truthy(response);
1449
+ t.is(response.responseCode, "00");
1450
+ t.is(response.commercialIndicator, "0");
1451
+ return response;
1452
+ })
1453
+ .then(function (response) {
1454
+ return (response
1455
+ .edit()
1456
+ // .withAllowDuplicates(true)
1457
+ .withPoNumber("9876543210")
1458
+ .withTaxType(src_1.TaxType.NotUsed)
1459
+ .execute()
1460
+ .then(function (cpcResponse) {
1461
+ t.truthy(cpcResponse);
1462
+ t.is(cpcResponse.responseCode, "00");
1463
+ }));
1464
+ });
1465
+ });
1466
+ test("055a - level ii amex manual no response", function (t) {
1467
+ t.plan(5);
1468
+ var address = new src_1.Address();
1469
+ address.postalCode = "75024";
1470
+ var card = Data_1.TestCards.amexManual(true, true);
1471
+ return card
1472
+ .charge(111.13)
1473
+ .withAllowDuplicates(true)
1474
+ .withCurrency("USD")
1475
+ .withAddress(address)
1476
+ .withCommercialRequest(true)
1477
+ .execute()
1478
+ .then(function (response) {
1479
+ t.truthy(response);
1480
+ t.is(response.responseCode, "00");
1481
+ t.is(response.commercialIndicator, "0");
1482
+ return response;
1483
+ })
1484
+ .then(function (response) {
1485
+ return (response
1486
+ .edit()
1487
+ // .withAllowDuplicates(true)
1488
+ .withPoNumber("9876543210")
1489
+ .withTaxType(src_1.TaxType.TaxExempt)
1490
+ .execute()
1491
+ .then(function (cpcResponse) {
1492
+ t.truthy(cpcResponse);
1493
+ t.is(cpcResponse.responseCode, "00");
1494
+ }));
1495
+ });
1496
+ });
1497
+ /// OFFLINE SALE / AUTHORIZATION
1498
+ test("056 - offline charge visa manual", function (t) {
1499
+ t.plan(2);
1500
+ var card = Data_1.TestCards.visaManual(false, true);
1501
+ return card
1502
+ .charge(15.12)
1503
+ .withAllowDuplicates(true)
1504
+ .withCurrency("USD")
1505
+ .withOfflineAuthCode("654321")
1506
+ .execute()
1507
+ .then(function (response) {
1508
+ t.truthy(response);
1509
+ t.is(response.responseCode, "00");
1510
+ });
1511
+ });
1512
+ test("056 - offline auth visa manual", function (t) {
1513
+ t.plan(2);
1514
+ var card = Data_1.TestCards.visaManual(false, true);
1515
+ return card
1516
+ .authorize(15.11)
1517
+ .withAllowDuplicates(true)
1518
+ .withCurrency("USD")
1519
+ .withOfflineAuthCode("654321")
1520
+ .execute()
1521
+ .then(function (response) {
1522
+ t.truthy(response);
1523
+ t.is(response.responseCode, "00");
1524
+ });
1525
+ });
1526
+ /// RETURN
1527
+ test("057 - return mastercard", function (t) {
1528
+ t.plan(2);
1529
+ var card = Data_1.TestCards.masterCardManual(false, true);
1530
+ return card
1531
+ .refund(15.11)
1532
+ .withAllowDuplicates(true)
1533
+ .withCurrency("USD")
1534
+ .execute()
1535
+ .then(function (response) {
1536
+ t.truthy(response);
1537
+ t.is(response.responseCode, "00");
1538
+ });
1539
+ });
1540
+ test("057a - return mastercard swipe", function (t) {
1541
+ t.plan(2);
1542
+ var card = Data_1.TestCards.masterCardSwipe();
1543
+ return card
1544
+ .refund(15.15)
1545
+ .withAllowDuplicates(true)
1546
+ .withCurrency("USD")
1547
+ .execute()
1548
+ .then(function (response) {
1549
+ t.truthy(response);
1550
+ t.is(response.responseCode, "00");
1551
+ });
1552
+ });
1553
+ test("058 - return jcb transaction id", function (_t) {
1554
+ // see test 14
1555
+ });
1556
+ /// ONLINE VOID / REVERSAL (Required)
1557
+ test("059 - reversal visa", function (_t) {
1558
+ // see test 10
1559
+ });
1560
+ test("060 - reversal mastercard", function (_t) {
1561
+ // see test case 17
1562
+ });
1563
+ test("061 - reversal mastercard", function (_t) {
1564
+ // see test case 23
1565
+ });
1566
+ test("062 - reversal mastercard", function (_t) {
1567
+ // see test case 42
1568
+ });
1569
+ test("063 - reversal visa partial", function (_t) {
1570
+ // see test case 15
1571
+ });
1572
+ test("064 - reversal discover partial", function (_t) {
1573
+ // see test 21
1574
+ });
1575
+ /// PIN DEBIT CARD FUNCTIONS
1576
+ test("065 - debit sale visa swipe", function (t) {
1577
+ t.plan(2);
1578
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1579
+ return card
1580
+ .charge(14.01)
1581
+ .withAllowDuplicates(true)
1582
+ .withCurrency("USD")
1583
+ .execute()
1584
+ .then(function (response) {
1585
+ t.truthy(response);
1586
+ t.is(response.responseCode, "00");
1587
+ });
1588
+ });
1589
+ test("066 - debit sale mastercard swipe", function (t) {
1590
+ t.plan(4);
1591
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1592
+ return card
1593
+ .charge(14.02)
1594
+ .withAllowDuplicates(true)
1595
+ .withCurrency("USD")
1596
+ .execute()
1597
+ .then(function (response) {
1598
+ t.truthy(response);
1599
+ t.is(response.responseCode, "00");
1600
+ return response;
1601
+ })
1602
+ .then(function (_response) {
1603
+ // test case 71
1604
+ return (card
1605
+ .reverse(14.02)
1606
+ // .withAllowDuplicates(true)
1607
+ .execute()
1608
+ .then(function (reverseResponse) {
1609
+ t.truthy(reverseResponse);
1610
+ t.is(reverseResponse.responseCode, "00");
1611
+ }));
1612
+ });
1613
+ });
1614
+ test("067 - debit sale visa swipe cashback", function (t) {
1615
+ t.plan(2);
1616
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1617
+ return card
1618
+ .charge(14.03)
1619
+ .withAllowDuplicates(true)
1620
+ .withCurrency("USD")
1621
+ .withCashBack(5.0)
1622
+ .execute()
1623
+ .then(function (response) {
1624
+ t.truthy(response);
1625
+ t.is(response.responseCode, "00");
1626
+ });
1627
+ });
1628
+ test("067a - debit sale mastercard", function (t) {
1629
+ t.plan(2);
1630
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1631
+ return card
1632
+ .charge(14.04)
1633
+ .withAllowDuplicates(true)
1634
+ .withCurrency("USD")
1635
+ .execute()
1636
+ .then(function (response) {
1637
+ t.truthy(response);
1638
+ t.is(response.responseCode, "00");
1639
+ });
1640
+ });
1641
+ /// PARTIALLY APPROVED PURCHASE
1642
+ test("068 - debit sale mastercard partial approval", function (t) {
1643
+ t.plan(3);
1644
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.masterCardSwipe(), "F505AD81659AA42A3D123412324000AB");
1645
+ return card
1646
+ .charge(33.0)
1647
+ .withAllowDuplicates(true)
1648
+ .withCurrency("USD")
1649
+ .withAllowPartialAuth(true)
1650
+ .execute()
1651
+ .then(function (response) {
1652
+ t.truthy(response);
1653
+ t.is(response.responseCode, "10");
1654
+ t.is(response.authorizedAmount, "22.00");
1655
+ });
1656
+ });
1657
+ test("069 - debit sale visa partial approval", function (t) {
1658
+ t.plan(5);
1659
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1660
+ return card
1661
+ .charge(44.0)
1662
+ .withAllowDuplicates(true)
1663
+ .withCurrency("USD")
1664
+ .withAllowPartialAuth(true)
1665
+ .execute()
1666
+ .then(function (response) {
1667
+ t.truthy(response);
1668
+ t.is(response.responseCode, "10");
1669
+ t.is(response.authorizedAmount, "33.00");
1670
+ return response;
1671
+ })
1672
+ .then(function (_response) {
1673
+ // test case 72
1674
+ return (card
1675
+ .reverse(33.0)
1676
+ // .withAllowDuplicates(true)
1677
+ .execute()
1678
+ .then(function (reverseResponse) {
1679
+ t.truthy(reverseResponse);
1680
+ t.is(reverseResponse.responseCode, "00");
1681
+ }));
1682
+ });
1683
+ });
1684
+ /// RETURN
1685
+ test("070 - debit return visa swipe", function (t) {
1686
+ t.plan(2);
1687
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1688
+ return card
1689
+ .refund(14.07)
1690
+ .withAllowDuplicates(true)
1691
+ .withCurrency("USD")
1692
+ .execute()
1693
+ .then(function (response) {
1694
+ t.truthy(response);
1695
+ t.is(response.responseCode, "00");
1696
+ });
1697
+ });
1698
+ test("070a - debit return visa swipe", function (t) {
1699
+ t.plan(4);
1700
+ var card = Data_1.TestCards.asDebit(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1701
+ return card
1702
+ .refund(14.08)
1703
+ .withAllowDuplicates(true)
1704
+ .withCurrency("USD")
1705
+ .execute()
1706
+ .then(function (response) {
1707
+ t.truthy(response);
1708
+ t.is(response.responseCode, "00");
1709
+ return response;
1710
+ })
1711
+ .then(function (_response) {
1712
+ return (card
1713
+ .reverse(14.08)
1714
+ // .withAllowDuplicates(true)
1715
+ .execute()
1716
+ .then(function (reverseResponse) {
1717
+ t.truthy(reverseResponse);
1718
+ t.is(reverseResponse.responseCode, "00");
1719
+ }));
1720
+ });
1721
+ });
1722
+ /// REVERSAL
1723
+ test("071 - debit reversal mastercard", function (_t) {
1724
+ // see test case 66
1725
+ });
1726
+ test("072 - debit reversal visa", function (_t) {
1727
+ // see test case 96
1728
+ });
1729
+ /// EBT FUNCTIONS
1730
+ /// Food Stamp Purchase
1731
+ test("080 - ebt fs purchase visa swipe", function (t) {
1732
+ t.plan(2);
1733
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipe(), "32539F50C245A6A93D123412324000AA");
1734
+ return card
1735
+ .charge(101.01)
1736
+ .withAllowDuplicates(true)
1737
+ .withCurrency("USD")
1738
+ .execute()
1739
+ .then(function (response) {
1740
+ t.truthy(response);
1741
+ t.is(response.responseCode, "00");
1742
+ });
1743
+ });
1744
+ test("081 - ebt fs purchase visa manual", function (t) {
1745
+ t.plan(2);
1746
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1747
+ return card
1748
+ .charge(102.01)
1749
+ .withAllowDuplicates(true)
1750
+ .withCurrency("USD")
1751
+ .execute()
1752
+ .then(function (response) {
1753
+ t.truthy(response);
1754
+ t.is(response.responseCode, "00");
1755
+ });
1756
+ });
1757
+ /// Food Stamp Electronic Voucher (Manual Entry Only)
1758
+ test("082 - ebt voucher purchase visa", function (t) {
1759
+ t.plan(2);
1760
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1761
+ card.serialNumber = "123456789012345";
1762
+ card.approvalCode = "123456";
1763
+ return card
1764
+ .charge(103.01)
1765
+ .withAllowDuplicates(true)
1766
+ .withCurrency("USD")
1767
+ .execute()
1768
+ .then(function (response) {
1769
+ t.truthy(response);
1770
+ t.is(response.responseCode, "00");
1771
+ });
1772
+ });
1773
+ /// Food Stamp Balance Inquiry
1774
+ test("083 - ebt fs return visa swipe", function (t) {
1775
+ t.plan(2);
1776
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1777
+ return card
1778
+ .refund(104.01)
1779
+ .withAllowDuplicates(true)
1780
+ .withCurrency("USD")
1781
+ .execute()
1782
+ .then(function (response) {
1783
+ t.truthy(response);
1784
+ t.is(response.responseCode, "00");
1785
+ });
1786
+ });
1787
+ test("084 - ebt fs return visa manual", function (t) {
1788
+ t.plan(2);
1789
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1790
+ return card
1791
+ .refund(105.01)
1792
+ .withAllowDuplicates(true)
1793
+ .withCurrency("USD")
1794
+ .execute()
1795
+ .then(function (response) {
1796
+ t.truthy(response);
1797
+ t.is(response.responseCode, "00");
1798
+ });
1799
+ });
1800
+ /// Food Stamp Balance Inquiry
1801
+ test("085 - ebt balance inquiry visa swipe", function (t) {
1802
+ t.plan(2);
1803
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1804
+ return card
1805
+ .balanceInquiry()
1806
+ .execute()
1807
+ .then(function (response) {
1808
+ t.truthy(response);
1809
+ t.is(response.responseCode, "00");
1810
+ });
1811
+ });
1812
+ test("086 - ebt balance inquiry visa manual", function (t) {
1813
+ t.plan(2);
1814
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(true, true), "32539F50C245A6A93D123412324000AA");
1815
+ return card
1816
+ .balanceInquiry()
1817
+ .execute()
1818
+ .then(function (response) {
1819
+ t.truthy(response);
1820
+ t.is(response.responseCode, "00");
1821
+ });
1822
+ });
1823
+ /// EBT CASH BENEFITS
1824
+ /// Cash Back Purchase
1825
+ test("087 - ebt cash back purchase visa swipe", function (t) {
1826
+ t.plan(2);
1827
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1828
+ return card
1829
+ .charge(106.01)
1830
+ .withAllowDuplicates(true)
1831
+ .withCurrency("USD")
1832
+ .withCashBack(5.0)
1833
+ .execute()
1834
+ .then(function (response) {
1835
+ t.truthy(response);
1836
+ t.is(response.responseCode, "00");
1837
+ });
1838
+ });
1839
+ test("088 - ebt cash back purchase visa manual", function (t) {
1840
+ t.plan(2);
1841
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1842
+ return card
1843
+ .charge(107.01)
1844
+ .withAllowDuplicates(true)
1845
+ .withCurrency("USD")
1846
+ .withCashBack(5.0)
1847
+ .execute()
1848
+ .then(function (response) {
1849
+ t.truthy(response);
1850
+ t.is(response.responseCode, "00");
1851
+ });
1852
+ });
1853
+ /// No Cash Back Purchase
1854
+ test("089 - ebt cash back purchase visa swipe no cash back", function (t) {
1855
+ t.plan(2);
1856
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1857
+ return card
1858
+ .charge(108.01)
1859
+ .withAllowDuplicates(true)
1860
+ .withCurrency("USD")
1861
+ .withCashBack(0)
1862
+ .execute()
1863
+ .then(function (response) {
1864
+ t.truthy(response);
1865
+ t.is(response.responseCode, "00");
1866
+ });
1867
+ });
1868
+ test("090 - ebt cash back purchase visa manual no cash back", function (t) {
1869
+ t.plan(2);
1870
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1871
+ return card
1872
+ .charge(109.01)
1873
+ .withAllowDuplicates(true)
1874
+ .withCurrency("USD")
1875
+ .withCashBack(0)
1876
+ .execute()
1877
+ .then(function (response) {
1878
+ t.truthy(response);
1879
+ t.is(response.responseCode, "00");
1880
+ });
1881
+ });
1882
+ /// Cash Back Balance Inquiry
1883
+ test("091 - ebt balance inquiry visa swipe cash", function (t) {
1884
+ t.plan(2);
1885
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1886
+ return card
1887
+ .balanceInquiry(src_1.InquiryType.Cash)
1888
+ .execute()
1889
+ .then(function (response) {
1890
+ t.truthy(response);
1891
+ t.is(response.responseCode, "00");
1892
+ });
1893
+ });
1894
+ test("092 - ebt balance inquiry visa manual cash", function (t) {
1895
+ t.plan(2);
1896
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(true, true), "32539F50C245A6A93D123412324000AA");
1897
+ return card
1898
+ .balanceInquiry(src_1.InquiryType.Cash)
1899
+ .execute()
1900
+ .then(function (response) {
1901
+ t.truthy(response);
1902
+ t.is(response.responseCode, "00");
1903
+ });
1904
+ });
1905
+ /// Cash Benefits Withdrawal
1906
+ test("093 - ebt benefit withdrawal visa swipe", function (t) {
1907
+ t.plan(2);
1908
+ var card = Data_1.TestCards.asEBTTrack(Data_1.TestCards.visaSwipeEncrypted(), "32539F50C245A6A93D123412324000AA");
1909
+ return card
1910
+ .charge(110.01)
1911
+ .withAllowDuplicates(true)
1912
+ .withCurrency("USD")
1913
+ .execute()
1914
+ .then(function (response) {
1915
+ t.truthy(response);
1916
+ t.is(response.responseCode, "00");
1917
+ });
1918
+ });
1919
+ test("094 - ebt benefit withdrawal visa manual", function (t) {
1920
+ t.plan(2);
1921
+ var card = Data_1.TestCards.asEBTManual(Data_1.TestCards.visaManual(false, true), "32539F50C245A6A93D123412324000AA");
1922
+ return card
1923
+ .charge(111.01)
1924
+ .withAllowDuplicates(true)
1925
+ .withCurrency("USD")
1926
+ .withCashBack(0)
1927
+ .execute()
1928
+ .then(function (response) {
1929
+ t.truthy(response);
1930
+ t.is(response.responseCode, "00");
1931
+ });
1932
+ });
1933
+ /// HMS GIFT - REWARDS
1934
+ /// GIFT
1935
+ /// ACTIVATE
1936
+ test("095 - activate gift 1 swipe", function (t) {
1937
+ t.plan(2);
1938
+ var card = Data_1.TestCards.giftCard1Swipe();
1939
+ return card
1940
+ .activate(6.0)
1941
+ .execute()
1942
+ .then(function (response) {
1943
+ t.truthy(response);
1944
+ t.is(response.responseCode, "00");
1945
+ });
1946
+ });
1947
+ test("096 - activate gift 2 manual", function (t) {
1948
+ t.plan(2);
1949
+ var card = Data_1.TestCards.giftCard2Manual();
1950
+ return card
1951
+ .activate(7.0)
1952
+ .execute()
1953
+ .then(function (response) {
1954
+ t.truthy(response);
1955
+ t.is(response.responseCode, "00");
1956
+ });
1957
+ });
1958
+ /// ADD VALUE
1959
+ test("097 - add value gift 1 swipe", function (t) {
1960
+ t.plan(2);
1961
+ var card = Data_1.TestCards.giftCard1Swipe();
1962
+ return card
1963
+ .addValue(8.0)
1964
+ .withCurrency("USD")
1965
+ .execute()
1966
+ .then(function (response) {
1967
+ t.truthy(response);
1968
+ t.is(response.responseCode, "00");
1969
+ });
1970
+ });
1971
+ test("098 - add value gift 2 manual", function (t) {
1972
+ t.plan(2);
1973
+ var card = Data_1.TestCards.giftCard2Manual();
1974
+ return card
1975
+ .addValue(9.0)
1976
+ .withCurrency("USD")
1977
+ .execute()
1978
+ .then(function (response) {
1979
+ t.truthy(response);
1980
+ t.is(response.responseCode, "00");
1981
+ });
1982
+ });
1983
+ /// BALANCE INQUIRY
1984
+ test("099 - balance inquiry gift 1 swipe", function (t) {
1985
+ t.plan(3);
1986
+ var card = Data_1.TestCards.giftCard1Swipe();
1987
+ return card
1988
+ .balanceInquiry()
1989
+ .execute()
1990
+ .then(function (response) {
1991
+ t.truthy(response);
1992
+ t.is(response.responseCode, "00");
1993
+ t.is(response.balanceAmount, "10.00");
1994
+ });
1995
+ });
1996
+ test("100 - balance inquiry gift 2 manual", function (t) {
1997
+ t.plan(3);
1998
+ var card = Data_1.TestCards.giftCard2Manual();
1999
+ return card
2000
+ .balanceInquiry()
2001
+ .execute()
2002
+ .then(function (response) {
2003
+ t.truthy(response);
2004
+ t.is(response.responseCode, "00");
2005
+ t.is(response.balanceAmount, "10.00");
2006
+ });
2007
+ });
2008
+ /// REPLACE / TRANSFER
2009
+ test("101 - replace gift 1 swipe", function (t) {
2010
+ t.plan(2);
2011
+ var oldCard = Data_1.TestCards.giftCard1Swipe();
2012
+ var newCard = Data_1.TestCards.giftCard2Manual();
2013
+ return oldCard
2014
+ .replaceWith(newCard)
2015
+ .execute()
2016
+ .then(function (response) {
2017
+ t.truthy(response);
2018
+ t.is(response.responseCode, "00");
2019
+ });
2020
+ });
2021
+ test("102 - replace gift 2 manual", function (t) {
2022
+ t.plan(2);
2023
+ var newCard = Data_1.TestCards.giftCard1Swipe();
2024
+ var oldCard = Data_1.TestCards.giftCard2Manual();
2025
+ return oldCard
2026
+ .replaceWith(newCard)
2027
+ .execute()
2028
+ .then(function (response) {
2029
+ t.truthy(response);
2030
+ t.is(response.responseCode, "00");
2031
+ });
2032
+ });
2033
+ /// SALE / REDEEM
2034
+ test("103 - sale gift 1 swipe", function (t) {
2035
+ t.plan(2);
2036
+ var card = Data_1.TestCards.giftCard1Swipe();
2037
+ return card
2038
+ .charge(1.0)
2039
+ .withCurrency("USD")
2040
+ .execute()
2041
+ .then(function (response) {
2042
+ t.truthy(response);
2043
+ t.is(response.responseCode, "00");
2044
+ });
2045
+ });
2046
+ test("104 - sale gift 2 manual", function (t) {
2047
+ t.plan(2);
2048
+ var card = Data_1.TestCards.giftCard2Manual();
2049
+ return card
2050
+ .charge(2.0)
2051
+ .withCurrency("USD")
2052
+ .execute()
2053
+ .then(function (response) {
2054
+ t.truthy(response);
2055
+ t.is(response.responseCode, "00");
2056
+ });
2057
+ });
2058
+ test("105 - sale gift 1 void swipe", function (t) {
2059
+ t.plan(4);
2060
+ var card = Data_1.TestCards.giftCard1Swipe();
2061
+ return card
2062
+ .charge(3.0)
2063
+ .withCurrency("USD")
2064
+ .execute()
2065
+ .then(function (response) {
2066
+ t.truthy(response);
2067
+ t.is(response.responseCode, "00");
2068
+ return response;
2069
+ })
2070
+ .then(function (response) {
2071
+ // test case 107
2072
+ return response
2073
+ .void()
2074
+ .execute()
2075
+ .then(function (voidResponse) {
2076
+ t.truthy(voidResponse);
2077
+ t.is(voidResponse.responseCode, "00");
2078
+ });
2079
+ });
2080
+ });
2081
+ test("106 - sale gift 2 reversal manual", function (t) {
2082
+ t.plan(4);
2083
+ var card = Data_1.TestCards.giftCard2Manual();
2084
+ return card
2085
+ .charge(4.0)
2086
+ .withCurrency("USD")
2087
+ .execute()
2088
+ .then(function (response) {
2089
+ t.truthy(response);
2090
+ t.is(response.responseCode, "00");
2091
+ return response;
2092
+ })
2093
+ .then(function (response) {
2094
+ // test case 108
2095
+ return response
2096
+ .reverse(4.0)
2097
+ .execute()
2098
+ .then(function (voidResponse) {
2099
+ t.truthy(voidResponse);
2100
+ t.is(voidResponse.responseCode, "00");
2101
+ });
2102
+ });
2103
+ });
2104
+ /// VOID
2105
+ test("107 - void gift", function (_t) {
2106
+ // see test case 105
2107
+ });
2108
+ /// REVERSAL
2109
+ test("108 - reversal gift", function (_t) {
2110
+ // see test case 106
2111
+ });
2112
+ /// DEACTIVATE
2113
+ test("109 - deactivate gift 1", function (t) {
2114
+ t.plan(2);
2115
+ var card = Data_1.TestCards.giftCard1Swipe();
2116
+ return card
2117
+ .deactivate()
2118
+ .execute()
2119
+ .then(function (response) {
2120
+ t.truthy(response);
2121
+ t.is(response.responseCode, "00");
2122
+ });
2123
+ });
2124
+ /// RECEIPTS MESSAGING
2125
+ test("110 - receipts messaging", function (_t) {
2126
+ /// PRINT AND SCAN RECEIPT FOR TEST 107
2127
+ });
2128
+ /// REWARDS
2129
+ /// BALANCE INQUIRY
2130
+ test("111 - balance inquiry rewards 1", function (t) {
2131
+ t.plan(3);
2132
+ var card = Data_1.TestCards.giftCard1Swipe();
2133
+ return card
2134
+ .balanceInquiry()
2135
+ .execute()
2136
+ .then(function (response) {
2137
+ t.truthy(response);
2138
+ t.is(response.responseCode, "00");
2139
+ t.is(response.pointsBalanceAmount, "0");
2140
+ });
2141
+ });
2142
+ test("112 - balance inquiry rewards 2", function (t) {
2143
+ t.plan(3);
2144
+ var card = Data_1.TestCards.giftCard2Manual();
2145
+ return card
2146
+ .balanceInquiry()
2147
+ .execute()
2148
+ .then(function (response) {
2149
+ t.truthy(response);
2150
+ t.is(response.responseCode, "00");
2151
+ t.is(response.pointsBalanceAmount, "0");
2152
+ });
2153
+ });
2154
+ /// ALIAS
2155
+ test("113 - create alias gift 1", function (t) {
2156
+ t.plan(1);
2157
+ return src_1.GiftCard.create("9725550100").then(function (card) {
2158
+ t.truthy(card);
2159
+ });
2160
+ });
2161
+ test("114 - create alias gift 2", function (t) {
2162
+ t.plan(1);
2163
+ return src_1.GiftCard.create("9725550100").then(function (card) {
2164
+ t.truthy(card);
2165
+ });
2166
+ });
2167
+ test("115 - add alias gift 1", function (t) {
2168
+ t.plan(2);
2169
+ var card = Data_1.TestCards.giftCard1Swipe();
2170
+ return card
2171
+ .addAlias("2145550199")
2172
+ .execute()
2173
+ .then(function (response) {
2174
+ t.truthy(response);
2175
+ t.is(response.responseCode, "00");
2176
+ });
2177
+ });
2178
+ test("116 - add alias gift 2", function (t) {
2179
+ t.plan(2);
2180
+ var card = Data_1.TestCards.giftCard2Manual();
2181
+ return card
2182
+ .addAlias("2145550199")
2183
+ .execute()
2184
+ .then(function (response) {
2185
+ t.truthy(response);
2186
+ t.is(response.responseCode, "00");
2187
+ });
2188
+ });
2189
+ test("117 - delete alias gift 1", function (t) {
2190
+ t.plan(2);
2191
+ var card = Data_1.TestCards.giftCard1Swipe();
2192
+ return card
2193
+ .removeAlias("2145550199")
2194
+ .execute()
2195
+ .then(function (response) {
2196
+ t.truthy(response);
2197
+ t.is(response.responseCode, "00");
2198
+ });
2199
+ });
2200
+ test.after("999 - close batch", function (t) {
2201
+ t.plan(1);
2202
+ return new Promise(function (resolve, reject) {
2203
+ src_1.BatchService.closeBatch()
2204
+ .then(function (response) {
2205
+ t.truthy(response);
2206
+ resolve();
2207
+ })
2208
+ .catch(function (e) {
2209
+ if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
2210
+ e.message.indexOf(BATCH_EMPTY) !== -1) {
2211
+ t.pass();
2212
+ resolve();
2213
+ return;
2214
+ }
2215
+ reject(e);
2216
+ });
2217
+ });
2218
+ });