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