globalpayments-api 3.8.2 → 3.9.0

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