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