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,420 +1,682 @@
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 config = new src_1.PorticoConfig();
9
- config.secretApiKey = "skapi_cert_MbPdAQBL1l4A2ThZoTBKXEdEG1rIi7KAa6Yskl9Nzg";
10
- const BATCH_NOT_OPEN = "Transaction was rejected because it requires a batch to be open.";
11
- const BATCH_EMPTY = "Batch close was rejected because no transactions are associated with the currently open batch";
12
- const test = ava_1.default.serial;
13
- let customerPerson;
14
- let customerBusiness;
15
- let paymentMethodVisa;
16
- let paymentMethodMasterCard;
17
- let paymentMethodCheckPpd;
18
- let paymentMethodCheckCcd;
19
- let scheduleVisa;
20
- let scheduleMasterCard;
21
- let scheduleCheckPpd;
22
- let scheduleCheckCcd;
23
- const todayDate = src_1.GenerationUtils.generateTimestamp();
24
- const getIdentifier = (id) => `${todayDate}-${id}-${src_1.StringUtils.uuid()}`.substr(0, 50);
25
- ava_1.default.before(() => {
26
- src_1.ServicesContainer.configureService(config);
27
- });
28
- ava_1.default.before("000 - close batch", (t) => {
29
- t.plan(1);
30
- return new Promise((resolve, reject) => {
31
- src_1.BatchService.closeBatch()
32
- .then((response) => {
33
- t.truthy(response);
34
- resolve();
35
- })
36
- .catch((e) => {
37
- if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
38
- e.message.indexOf(BATCH_EMPTY) !== -1) {
39
- t.pass();
40
- resolve();
41
- return;
42
- }
43
- reject(e);
44
- });
45
- });
46
- });
47
- test.before("000 - cleanup", async () => {
48
- try {
49
- const results = await src_1.Schedule.findAll();
50
- for (const result in results) {
51
- if (results.hasOwnProperty(result)) {
52
- const schedule = results[result];
53
- await schedule.delete("default");
54
- }
55
- }
56
- }
57
- catch (_e) {
58
- //
59
- }
60
- try {
61
- const results = await src_1.RecurringPaymentMethod.findAll();
62
- for (const result in results) {
63
- if (results.hasOwnProperty(result)) {
64
- const paymentMethod = results[result];
65
- await paymentMethod.delete("default");
66
- }
67
- }
68
- }
69
- catch (_e) {
70
- //
71
- }
72
- try {
73
- const results = await src_1.Customer.findAll();
74
- for (const result in results) {
75
- if (results.hasOwnProperty(result)) {
76
- const customer = results[result];
77
- await customer.delete("default");
78
- }
79
- }
80
- }
81
- catch (_e) {
82
- //
83
- }
84
- });
85
- // customer setup
86
- test("001 - add customer person", async (t) => {
87
- t.plan(2);
88
- let customer = new src_1.Customer();
89
- customer.id = getIdentifier("Person");
90
- customer.firstName = "John";
91
- customer.lastName = "Doe";
92
- customer.status = "Active";
93
- customer.email = "john.doe@email.com";
94
- customer.address = new src_1.Address();
95
- customer.address.streetAddress1 = "123 Main St.";
96
- customer.address.city = "Dallas";
97
- customer.address.state = "TX";
98
- customer.address.postalCode = "98765";
99
- customer.address.country = "USA";
100
- customer.workPhone = "5551112222";
101
- customer = await customer.create();
102
- t.truthy(customer);
103
- t.truthy(customer.key);
104
- customerPerson = customer;
105
- });
106
- test("002 - add customer person", async (t) => {
107
- t.plan(2);
108
- let customer = new src_1.Customer();
109
- customer.id = getIdentifier("Business");
110
- customer.company = "AcmeCo";
111
- customer.status = "Active";
112
- customer.email = "acme@email.com";
113
- customer.address = new src_1.Address();
114
- customer.address.streetAddress1 = "987 Elm St.";
115
- customer.address.city = "Princeton";
116
- customer.address.state = "NJ";
117
- customer.address.postalCode = "12345";
118
- customer.address.country = "USA";
119
- customer.workPhone = "5551112222";
120
- customer = await customer.create();
121
- t.truthy(customer);
122
- t.truthy(customer.key);
123
- customerBusiness = customer;
124
- });
125
- // payment method setup
126
- test("003 - add payment credit visa", async (t) => {
127
- t.plan(2);
128
- if (!customerPerson) {
129
- return;
130
- }
131
- const card = new src_1.CreditCardData();
132
- card.number = "4012002000060016";
133
- card.expMonth = "12";
134
- card.expYear = "2025";
135
- const paymentMethod = await customerPerson
136
- .addPaymentMethod(getIdentifier("CreditV"), card)
137
- .create();
138
- t.truthy(paymentMethod);
139
- t.truthy(paymentMethod.key);
140
- paymentMethodVisa = paymentMethod;
141
- });
142
- test("004 - add payment credit visa", async (t) => {
143
- t.plan(2);
144
- if (!customerPerson) {
145
- return;
146
- }
147
- const card = new src_1.CreditCardData();
148
- card.number = "5473500000000014";
149
- card.expMonth = "12";
150
- card.expYear = "2025";
151
- const paymentMethod = await customerPerson
152
- .addPaymentMethod(getIdentifier("CreditMC"), card)
153
- .create();
154
- t.truthy(paymentMethod);
155
- t.truthy(paymentMethod.key);
156
- paymentMethodMasterCard = paymentMethod;
157
- });
158
- test("005 - add payment check ppd", async (t) => {
159
- t.plan(2);
160
- if (!customerPerson) {
161
- return;
162
- }
163
- const check = new src_1.ECheck();
164
- check.accountType = src_1.AccountType.Checking;
165
- check.checkType = src_1.CheckType.Personal;
166
- check.secCode = src_1.SecCode.PPD;
167
- check.routingNumber = "490000018";
168
- check.driversLicenseNumber = "7418529630";
169
- check.driversLicenseState = "TX";
170
- check.accountNumber = "24413815";
171
- check.birthYear = "1989";
172
- const paymentMethod = await customerPerson
173
- .addPaymentMethod(getIdentifier("CheckPPD"), check)
174
- .create();
175
- t.truthy(paymentMethod);
176
- t.truthy(paymentMethod.key);
177
- paymentMethodCheckPpd = paymentMethod;
178
- });
179
- test("006 - add payment check ccd", async (t) => {
180
- t.plan(2);
181
- if (!customerBusiness) {
182
- return;
183
- }
184
- const check = new src_1.ECheck();
185
- check.accountType = src_1.AccountType.Checking;
186
- check.checkType = src_1.CheckType.Business;
187
- check.secCode = src_1.SecCode.CCD;
188
- check.routingNumber = "490000018";
189
- check.driversLicenseNumber = "7418529630";
190
- check.driversLicenseState = "TX";
191
- check.accountNumber = "24413815";
192
- check.birthYear = "1989";
193
- const paymentMethod = await customerBusiness
194
- .addPaymentMethod(getIdentifier("CheckCCD"), check)
195
- .create();
196
- t.truthy(paymentMethod);
197
- t.truthy(paymentMethod.key);
198
- paymentMethodCheckCcd = paymentMethod;
199
- });
200
- // managed schedule
201
- test("008 - add schedule credit visa", async (t) => {
202
- t.plan(2);
203
- if (!paymentMethodVisa) {
204
- return;
205
- }
206
- const schedule = await paymentMethodVisa
207
- .addSchedule(getIdentifier("CreditV"))
208
- .withStartDate(new Date(2027, 1, 1))
209
- .withAmount(30.01)
210
- .withFrequency(src_1.ScheduleFrequency.Weekly)
211
- .withReprocessingCount(1)
212
- .withStatus("Active")
213
- .withEmailReceipt(src_1.EmailReceipt.Never)
214
- .create();
215
- t.truthy(schedule);
216
- t.truthy(schedule.key);
217
- scheduleVisa = schedule;
218
- });
219
- test("009 - add schedule credit mastercard", async (t) => {
220
- t.plan(2);
221
- if (!paymentMethodMasterCard) {
222
- return;
223
- }
224
- const schedule = await paymentMethodMasterCard
225
- .addSchedule(getIdentifier("CreditMC"))
226
- .withStartDate(new Date(2027, 1, 1))
227
- .withEndDate(new Date(2027, 3, 1))
228
- .withAmount(30.02)
229
- .withFrequency(src_1.ScheduleFrequency.Weekly)
230
- .withReprocessingCount(2)
231
- .withStatus("Active")
232
- .withEmailReceipt(src_1.EmailReceipt.Never)
233
- .create();
234
- t.truthy(schedule);
235
- t.truthy(schedule.key);
236
- scheduleMasterCard = schedule;
237
- });
238
- test("010 - add schedule check ppd", async (t) => {
239
- t.plan(2);
240
- if (!paymentMethodCheckPpd) {
241
- return;
242
- }
243
- const schedule = await paymentMethodCheckPpd
244
- .addSchedule(getIdentifier("CheckPPD"))
245
- .withStartDate(new Date(2027, 1, 1))
246
- .withAmount(30.03)
247
- .withFrequency(src_1.ScheduleFrequency.Monthly)
248
- .withReprocessingCount(1)
249
- .withNumberOfPayments(2)
250
- .withStatus("Active")
251
- .withEmailReceipt(src_1.EmailReceipt.Never)
252
- .create();
253
- t.truthy(schedule);
254
- t.truthy(schedule.key);
255
- scheduleCheckPpd = schedule;
256
- });
257
- test("011 - add schedule check ccd", async (t) => {
258
- t.plan(2);
259
- if (!paymentMethodCheckCcd) {
260
- return;
261
- }
262
- const schedule = await paymentMethodCheckCcd
263
- .addSchedule(getIdentifier("CheckCCD"))
264
- .withStartDate(new Date(2027, 1, 1))
265
- .withAmount(30.04)
266
- .withFrequency(src_1.ScheduleFrequency.BiWeekly)
267
- .withReprocessingCount(1)
268
- .withStatus("Active")
269
- .withEmailReceipt(src_1.EmailReceipt.Never)
270
- .create();
271
- t.truthy(schedule);
272
- t.truthy(schedule.key);
273
- scheduleCheckCcd = schedule;
274
- });
275
- // recurring billing
276
- test("014 - recurring billing visa", async (t) => {
277
- t.plan(2);
278
- if (!paymentMethodVisa || !scheduleVisa) {
279
- return;
280
- }
281
- const response = await paymentMethodVisa
282
- .charge(20.01)
283
- .withCurrency("USD")
284
- .withScheduleId(scheduleVisa.key)
285
- .withOneTimePayment(false)
286
- .execute();
287
- t.truthy(response);
288
- t.is(response.responseCode, "00");
289
- });
290
- test("015 - recurring billing mastercard", async (t) => {
291
- t.plan(2);
292
- if (!paymentMethodMasterCard || !scheduleMasterCard) {
293
- return;
294
- }
295
- const response = await paymentMethodMasterCard
296
- .charge(20.02)
297
- .withCurrency("USD")
298
- .withScheduleId(scheduleMasterCard.key)
299
- .withOneTimePayment(false)
300
- .execute();
301
- t.truthy(response);
302
- t.is(response.responseCode, "00");
303
- });
304
- // TBD - odd behaviour with applicationb below
305
- test("016 - recurring billing check ppd", async (t) => {
306
- t.plan(2);
307
- if (!paymentMethodCheckPpd || !scheduleCheckPpd) {
308
- return;
309
- }
310
- const response = await paymentMethodCheckPpd
311
- .charge(20.03)
312
- .withCurrency("USD")
313
- .withScheduleId(scheduleVisa?.key)
314
- .withOneTimePayment(false)
315
- .execute();
316
- t.truthy(response);
317
- t.is(response.responseCode, "00");
318
- });
319
- test("017 - recurring billing check ccd", async (t) => {
320
- t.plan(2);
321
- if (!paymentMethodCheckCcd || !scheduleCheckCcd) {
322
- return;
323
- }
324
- const response = await paymentMethodCheckCcd
325
- .charge(20.04)
326
- .withCurrency("USD")
327
- .withScheduleId(scheduleVisa?.key)
328
- .withOneTimePayment(false)
329
- .execute();
330
- t.truthy(response);
331
- t.is(response.responseCode, "00");
332
- });
333
- // recurring billing - one time
334
- test("018 - recurring billing one time visa", async (t) => {
335
- t.plan(2);
336
- if (!paymentMethodVisa) {
337
- return;
338
- }
339
- const response = await paymentMethodVisa.charge(20.06).execute();
340
- t.truthy(response);
341
- t.is(response.responseCode, "00");
342
- });
343
- test("019 - recurring billing one time mastercard", async (t) => {
344
- t.plan(2);
345
- if (!paymentMethodMasterCard) {
346
- return;
347
- }
348
- const response = await paymentMethodMasterCard
349
- .charge(20.07)
350
- .withCurrency("USD")
351
- .execute();
352
- t.truthy(response);
353
- t.is(response.responseCode, "00");
354
- });
355
- test("020 - recurring billing one time check ppd", async (t) => {
356
- t.plan(2);
357
- if (!paymentMethodCheckPpd) {
358
- return;
359
- }
360
- const response = await paymentMethodCheckPpd
361
- .charge(20.08)
362
- .withCurrency("USD")
363
- .execute();
364
- t.truthy(response);
365
- t.is(response.responseCode, "00");
366
- });
367
- test("021 - recurring billing one time check ccd", async (t) => {
368
- t.plan(2);
369
- if (!paymentMethodCheckCcd) {
370
- return;
371
- }
372
- const response = await paymentMethodCheckCcd
373
- .charge(20.09)
374
- .withCurrency("USD")
375
- .execute();
376
- t.truthy(response);
377
- t.is(response.responseCode, "00");
378
- });
379
- // recurring billing - one time - declines
380
- test("022 - recurring billing one time visa decline", async (t) => {
381
- t.plan(2);
382
- if (!paymentMethodVisa) {
383
- return;
384
- }
385
- const response = await paymentMethodVisa.charge(10.08).execute();
386
- t.truthy(response);
387
- t.is(response.responseCode, "51");
388
- });
389
- test("023 - recurring billing one time check ppd decline", async (t) => {
390
- t.plan(2);
391
- if (!paymentMethodCheckPpd) {
392
- return;
393
- }
394
- const response = await paymentMethodCheckPpd
395
- .charge(25.02)
396
- .withCurrency("USD")
397
- .execute();
398
- t.truthy(response);
399
- t.is(response.responseCode, "00");
400
- });
401
- test.after("999 - close batch", (t) => {
402
- t.plan(1);
403
- return new Promise((resolve, reject) => {
404
- src_1.BatchService.closeBatch()
405
- .then((response) => {
406
- t.truthy(response);
407
- resolve();
408
- })
409
- .catch((e) => {
410
- if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
411
- e.message.indexOf(BATCH_EMPTY) !== -1) {
412
- t.pass();
413
- resolve();
414
- return;
415
- }
416
- reject(e);
417
- });
418
- });
419
- });
420
- //# sourceMappingURL=RecurringTest.js.map
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var ava_1 = require("ava");
40
+ var src_1 = require("../../../../../src/");
41
+ var config = new src_1.ServicesConfig();
42
+ config.secretApiKey = "skapi_cert_MbPdAQBL1l4A2ThZoTBKXEdEG1rIi7KAa6Yskl9Nzg";
43
+ config.serviceUrl = "https://cert.api2-c.heartlandportico.com";
44
+ var BATCH_NOT_OPEN = "Transaction was rejected because it requires a batch to be open.";
45
+ var BATCH_EMPTY = "Batch close was rejected because no transactions are associated with the currently open batch";
46
+ var test = ava_1.default.serial;
47
+ var customerPerson;
48
+ var customerBusiness;
49
+ var paymentMethodVisa;
50
+ var paymentMethodMasterCard;
51
+ var paymentMethodCheckPpd;
52
+ var paymentMethodCheckCcd;
53
+ var scheduleVisa;
54
+ var scheduleMasterCard;
55
+ var scheduleCheckPpd;
56
+ var scheduleCheckCcd;
57
+ var todayDate = src_1.GenerationUtils.generateTimestamp();
58
+ var getIdentifier = function (id) {
59
+ return (todayDate + "-" + id + "-" + src_1.StringUtils.uuid()).substr(0, 50);
60
+ };
61
+ ava_1.default.before(function (_t) {
62
+ src_1.ServicesContainer.configure(config);
63
+ });
64
+ ava_1.default.before("000 - close batch", function (t) {
65
+ t.plan(1);
66
+ return new Promise(function (resolve, reject) {
67
+ src_1.BatchService.closeBatch()
68
+ .then(function (response) {
69
+ t.truthy(response);
70
+ resolve();
71
+ })
72
+ .catch(function (e) {
73
+ if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
74
+ e.message.indexOf(BATCH_EMPTY) !== -1) {
75
+ t.pass();
76
+ resolve();
77
+ return;
78
+ }
79
+ reject(e);
80
+ });
81
+ });
82
+ });
83
+ test.before("000 - cleanup", function () { return __awaiter(void 0, void 0, void 0, function () {
84
+ var results, _a, _b, _i, result, schedule, _e_1, results, _c, _d, _f, result, paymentMethod, _e_2, results, _g, _h, _j, result, customer, _e_3;
85
+ return __generator(this, function (_k) {
86
+ switch (_k.label) {
87
+ case 0:
88
+ _k.trys.push([0, 6, , 7]);
89
+ return [4 /*yield*/, src_1.Schedule.findAll()];
90
+ case 1:
91
+ results = _k.sent();
92
+ _a = [];
93
+ for (_b in results)
94
+ _a.push(_b);
95
+ _i = 0;
96
+ _k.label = 2;
97
+ case 2:
98
+ if (!(_i < _a.length)) return [3 /*break*/, 5];
99
+ result = _a[_i];
100
+ if (!results.hasOwnProperty(result)) return [3 /*break*/, 4];
101
+ schedule = results[result];
102
+ return [4 /*yield*/, schedule.delete(true)];
103
+ case 3:
104
+ _k.sent();
105
+ _k.label = 4;
106
+ case 4:
107
+ _i++;
108
+ return [3 /*break*/, 2];
109
+ case 5: return [3 /*break*/, 7];
110
+ case 6:
111
+ _e_1 = _k.sent();
112
+ return [3 /*break*/, 7];
113
+ case 7:
114
+ _k.trys.push([7, 13, , 14]);
115
+ return [4 /*yield*/, src_1.RecurringPaymentMethod.findAll()];
116
+ case 8:
117
+ results = _k.sent();
118
+ _c = [];
119
+ for (_d in results)
120
+ _c.push(_d);
121
+ _f = 0;
122
+ _k.label = 9;
123
+ case 9:
124
+ if (!(_f < _c.length)) return [3 /*break*/, 12];
125
+ result = _c[_f];
126
+ if (!results.hasOwnProperty(result)) return [3 /*break*/, 11];
127
+ paymentMethod = results[result];
128
+ return [4 /*yield*/, paymentMethod.delete(true)];
129
+ case 10:
130
+ _k.sent();
131
+ _k.label = 11;
132
+ case 11:
133
+ _f++;
134
+ return [3 /*break*/, 9];
135
+ case 12: return [3 /*break*/, 14];
136
+ case 13:
137
+ _e_2 = _k.sent();
138
+ return [3 /*break*/, 14];
139
+ case 14:
140
+ _k.trys.push([14, 20, , 21]);
141
+ return [4 /*yield*/, src_1.Customer.findAll()];
142
+ case 15:
143
+ results = _k.sent();
144
+ _g = [];
145
+ for (_h in results)
146
+ _g.push(_h);
147
+ _j = 0;
148
+ _k.label = 16;
149
+ case 16:
150
+ if (!(_j < _g.length)) return [3 /*break*/, 19];
151
+ result = _g[_j];
152
+ if (!results.hasOwnProperty(result)) return [3 /*break*/, 18];
153
+ customer = results[result];
154
+ return [4 /*yield*/, customer.delete(true)];
155
+ case 17:
156
+ _k.sent();
157
+ _k.label = 18;
158
+ case 18:
159
+ _j++;
160
+ return [3 /*break*/, 16];
161
+ case 19: return [3 /*break*/, 21];
162
+ case 20:
163
+ _e_3 = _k.sent();
164
+ return [3 /*break*/, 21];
165
+ case 21: return [2 /*return*/];
166
+ }
167
+ });
168
+ }); });
169
+ // customer setup
170
+ test("001 - add customer person", function (t) { return __awaiter(void 0, void 0, void 0, function () {
171
+ var customer;
172
+ return __generator(this, function (_a) {
173
+ switch (_a.label) {
174
+ case 0:
175
+ t.plan(2);
176
+ customer = new src_1.Customer();
177
+ customer.id = getIdentifier("Person");
178
+ customer.firstName = "John";
179
+ customer.lastName = "Doe";
180
+ customer.status = "Active";
181
+ customer.email = "john.doe@email.com";
182
+ customer.address = new src_1.Address();
183
+ customer.address.streetAddress1 = "123 Main St.";
184
+ customer.address.city = "Dallas";
185
+ customer.address.state = "TX";
186
+ customer.address.postalCode = "98765";
187
+ customer.address.country = "USA";
188
+ customer.workPhone = "5551112222";
189
+ return [4 /*yield*/, customer.create()];
190
+ case 1:
191
+ customer = _a.sent();
192
+ t.truthy(customer);
193
+ t.truthy(customer.key);
194
+ customerPerson = customer;
195
+ return [2 /*return*/];
196
+ }
197
+ });
198
+ }); });
199
+ test("002 - add customer person", function (t) { return __awaiter(void 0, void 0, void 0, function () {
200
+ var customer;
201
+ return __generator(this, function (_a) {
202
+ switch (_a.label) {
203
+ case 0:
204
+ t.plan(2);
205
+ customer = new src_1.Customer();
206
+ customer.id = getIdentifier("Business");
207
+ customer.company = "AcmeCo";
208
+ customer.status = "Active";
209
+ customer.email = "acme@email.com";
210
+ customer.address = new src_1.Address();
211
+ customer.address.streetAddress1 = "987 Elm St.";
212
+ customer.address.city = "Princeton";
213
+ customer.address.state = "NJ";
214
+ customer.address.postalCode = "12345";
215
+ customer.address.country = "USA";
216
+ customer.workPhone = "5551112222";
217
+ return [4 /*yield*/, customer.create()];
218
+ case 1:
219
+ customer = _a.sent();
220
+ t.truthy(customer);
221
+ t.truthy(customer.key);
222
+ customerBusiness = customer;
223
+ return [2 /*return*/];
224
+ }
225
+ });
226
+ }); });
227
+ // payment method setup
228
+ test("003 - add payment credit visa", function (t) { return __awaiter(void 0, void 0, void 0, function () {
229
+ var card, paymentMethod;
230
+ return __generator(this, function (_a) {
231
+ switch (_a.label) {
232
+ case 0:
233
+ t.plan(2);
234
+ if (!customerPerson) {
235
+ return [2 /*return*/];
236
+ }
237
+ card = new src_1.CreditCardData();
238
+ card.number = "4012002000060016";
239
+ card.expMonth = "12";
240
+ card.expYear = "2025";
241
+ return [4 /*yield*/, customerPerson
242
+ .addPaymentMethod(getIdentifier("CreditV"), card)
243
+ .create()];
244
+ case 1:
245
+ paymentMethod = _a.sent();
246
+ t.truthy(paymentMethod);
247
+ t.truthy(paymentMethod.key);
248
+ paymentMethodVisa = paymentMethod;
249
+ return [2 /*return*/];
250
+ }
251
+ });
252
+ }); });
253
+ test("004 - add payment credit visa", function (t) { return __awaiter(void 0, void 0, void 0, function () {
254
+ var card, paymentMethod;
255
+ return __generator(this, function (_a) {
256
+ switch (_a.label) {
257
+ case 0:
258
+ t.plan(2);
259
+ if (!customerPerson) {
260
+ return [2 /*return*/];
261
+ }
262
+ card = new src_1.CreditCardData();
263
+ card.number = "5473500000000014";
264
+ card.expMonth = "12";
265
+ card.expYear = "2025";
266
+ return [4 /*yield*/, customerPerson
267
+ .addPaymentMethod(getIdentifier("CreditMC"), card)
268
+ .create()];
269
+ case 1:
270
+ paymentMethod = _a.sent();
271
+ t.truthy(paymentMethod);
272
+ t.truthy(paymentMethod.key);
273
+ paymentMethodMasterCard = paymentMethod;
274
+ return [2 /*return*/];
275
+ }
276
+ });
277
+ }); });
278
+ test("005 - add payment check ppd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
279
+ var check, paymentMethod;
280
+ return __generator(this, function (_a) {
281
+ switch (_a.label) {
282
+ case 0:
283
+ t.plan(2);
284
+ if (!customerPerson) {
285
+ return [2 /*return*/];
286
+ }
287
+ check = new src_1.ECheck();
288
+ check.accountType = src_1.AccountType.Checking;
289
+ check.checkType = src_1.CheckType.Personal;
290
+ check.secCode = src_1.SecCode.PPD;
291
+ check.routingNumber = "490000018";
292
+ check.driversLicenseNumber = "7418529630";
293
+ check.driversLicenseState = "TX";
294
+ check.accountNumber = "24413815";
295
+ check.birthYear = "1989";
296
+ return [4 /*yield*/, customerPerson
297
+ .addPaymentMethod(getIdentifier("CheckPPD"), check)
298
+ .create()];
299
+ case 1:
300
+ paymentMethod = _a.sent();
301
+ t.truthy(paymentMethod);
302
+ t.truthy(paymentMethod.key);
303
+ paymentMethodCheckPpd = paymentMethod;
304
+ return [2 /*return*/];
305
+ }
306
+ });
307
+ }); });
308
+ test("006 - add payment check ccd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
309
+ var check, paymentMethod;
310
+ return __generator(this, function (_a) {
311
+ switch (_a.label) {
312
+ case 0:
313
+ t.plan(2);
314
+ if (!customerBusiness) {
315
+ return [2 /*return*/];
316
+ }
317
+ check = new src_1.ECheck();
318
+ check.accountType = src_1.AccountType.Checking;
319
+ check.checkType = src_1.CheckType.Business;
320
+ check.secCode = src_1.SecCode.CCD;
321
+ check.routingNumber = "490000018";
322
+ check.driversLicenseNumber = "7418529630";
323
+ check.driversLicenseState = "TX";
324
+ check.accountNumber = "24413815";
325
+ check.birthYear = "1989";
326
+ return [4 /*yield*/, customerBusiness
327
+ .addPaymentMethod(getIdentifier("CheckCCD"), check)
328
+ .create()];
329
+ case 1:
330
+ paymentMethod = _a.sent();
331
+ t.truthy(paymentMethod);
332
+ t.truthy(paymentMethod.key);
333
+ paymentMethodCheckCcd = paymentMethod;
334
+ return [2 /*return*/];
335
+ }
336
+ });
337
+ }); });
338
+ // managed schedule
339
+ test("008 - add schedule credit visa", function (t) { return __awaiter(void 0, void 0, void 0, function () {
340
+ var schedule;
341
+ return __generator(this, function (_a) {
342
+ switch (_a.label) {
343
+ case 0:
344
+ t.plan(2);
345
+ if (!paymentMethodVisa) {
346
+ return [2 /*return*/];
347
+ }
348
+ return [4 /*yield*/, paymentMethodVisa
349
+ .addSchedule(getIdentifier("CreditV"))
350
+ .withStartDate(new Date(2027, 1, 1))
351
+ .withAmount(30.01)
352
+ .withFrequency(src_1.ScheduleFrequency.Weekly)
353
+ .withReprocessingCount(1)
354
+ .withStatus("Active")
355
+ .withEmailReceipt(src_1.EmailReceipt.Never)
356
+ .create()];
357
+ case 1:
358
+ schedule = _a.sent();
359
+ t.truthy(schedule);
360
+ t.truthy(schedule.key);
361
+ scheduleVisa = schedule;
362
+ return [2 /*return*/];
363
+ }
364
+ });
365
+ }); });
366
+ test("009 - add schedule credit mastercard", function (t) { return __awaiter(void 0, void 0, void 0, function () {
367
+ var schedule;
368
+ return __generator(this, function (_a) {
369
+ switch (_a.label) {
370
+ case 0:
371
+ t.plan(2);
372
+ if (!paymentMethodMasterCard) {
373
+ return [2 /*return*/];
374
+ }
375
+ return [4 /*yield*/, paymentMethodMasterCard
376
+ .addSchedule(getIdentifier("CreditMC"))
377
+ .withStartDate(new Date(2027, 1, 1))
378
+ .withEndDate(new Date(2027, 3, 1))
379
+ .withAmount(30.02)
380
+ .withFrequency(src_1.ScheduleFrequency.Weekly)
381
+ .withReprocessingCount(2)
382
+ .withStatus("Active")
383
+ .withEmailReceipt(src_1.EmailReceipt.Never)
384
+ .create()];
385
+ case 1:
386
+ schedule = _a.sent();
387
+ t.truthy(schedule);
388
+ t.truthy(schedule.key);
389
+ scheduleMasterCard = schedule;
390
+ return [2 /*return*/];
391
+ }
392
+ });
393
+ }); });
394
+ test("010 - add schedule check ppd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
395
+ var schedule;
396
+ return __generator(this, function (_a) {
397
+ switch (_a.label) {
398
+ case 0:
399
+ t.plan(2);
400
+ if (!paymentMethodCheckPpd) {
401
+ return [2 /*return*/];
402
+ }
403
+ return [4 /*yield*/, paymentMethodCheckPpd
404
+ .addSchedule(getIdentifier("CheckPPD"))
405
+ .withStartDate(new Date(2027, 1, 1))
406
+ .withAmount(30.03)
407
+ .withFrequency(src_1.ScheduleFrequency.Monthly)
408
+ .withReprocessingCount(1)
409
+ .withNumberOfPayments(2)
410
+ .withStatus("Active")
411
+ .withEmailReceipt(src_1.EmailReceipt.Never)
412
+ .create()];
413
+ case 1:
414
+ schedule = _a.sent();
415
+ t.truthy(schedule);
416
+ t.truthy(schedule.key);
417
+ scheduleCheckPpd = schedule;
418
+ return [2 /*return*/];
419
+ }
420
+ });
421
+ }); });
422
+ test("011 - add schedule check ccd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
423
+ var schedule;
424
+ return __generator(this, function (_a) {
425
+ switch (_a.label) {
426
+ case 0:
427
+ t.plan(2);
428
+ if (!paymentMethodCheckCcd) {
429
+ return [2 /*return*/];
430
+ }
431
+ return [4 /*yield*/, paymentMethodCheckCcd
432
+ .addSchedule(getIdentifier("CheckCCD"))
433
+ .withStartDate(new Date(2027, 1, 1))
434
+ .withAmount(30.04)
435
+ .withFrequency(src_1.ScheduleFrequency.BiWeekly)
436
+ .withReprocessingCount(1)
437
+ .withStatus("Active")
438
+ .withEmailReceipt(src_1.EmailReceipt.Never)
439
+ .create()];
440
+ case 1:
441
+ schedule = _a.sent();
442
+ t.truthy(schedule);
443
+ t.truthy(schedule.key);
444
+ scheduleCheckCcd = schedule;
445
+ return [2 /*return*/];
446
+ }
447
+ });
448
+ }); });
449
+ // recurring billing
450
+ test("014 - recurring billing visa", function (t) { return __awaiter(void 0, void 0, void 0, function () {
451
+ var response;
452
+ return __generator(this, function (_a) {
453
+ switch (_a.label) {
454
+ case 0:
455
+ t.plan(2);
456
+ if (!paymentMethodVisa || !scheduleVisa) {
457
+ return [2 /*return*/];
458
+ }
459
+ return [4 /*yield*/, paymentMethodVisa
460
+ .charge(20.01)
461
+ .withCurrency("USD")
462
+ .withScheduleId(scheduleVisa.key)
463
+ .withOneTimePayment(false)
464
+ .execute()];
465
+ case 1:
466
+ response = _a.sent();
467
+ t.truthy(response);
468
+ t.is(response.responseCode, "00");
469
+ return [2 /*return*/];
470
+ }
471
+ });
472
+ }); });
473
+ test("015 - recurring billing mastercard", function (t) { return __awaiter(void 0, void 0, void 0, function () {
474
+ var response;
475
+ return __generator(this, function (_a) {
476
+ switch (_a.label) {
477
+ case 0:
478
+ t.plan(2);
479
+ if (!paymentMethodMasterCard || !scheduleMasterCard) {
480
+ return [2 /*return*/];
481
+ }
482
+ return [4 /*yield*/, paymentMethodMasterCard
483
+ .charge(20.02)
484
+ .withCurrency("USD")
485
+ .withScheduleId(scheduleMasterCard.key)
486
+ .withOneTimePayment(false)
487
+ .execute()];
488
+ case 1:
489
+ response = _a.sent();
490
+ t.truthy(response);
491
+ t.is(response.responseCode, "00");
492
+ return [2 /*return*/];
493
+ }
494
+ });
495
+ }); });
496
+ test("016 - recurring billing check ppd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
497
+ var response;
498
+ return __generator(this, function (_a) {
499
+ switch (_a.label) {
500
+ case 0:
501
+ t.plan(2);
502
+ if (!paymentMethodCheckPpd || !scheduleCheckPpd) {
503
+ return [2 /*return*/];
504
+ }
505
+ return [4 /*yield*/, paymentMethodCheckPpd
506
+ .charge(20.03)
507
+ .withCurrency("USD")
508
+ .withScheduleId(scheduleCheckPpd.key)
509
+ .withOneTimePayment(false)
510
+ .execute()];
511
+ case 1:
512
+ response = _a.sent();
513
+ t.truthy(response);
514
+ t.is(response.responseCode, "00");
515
+ return [2 /*return*/];
516
+ }
517
+ });
518
+ }); });
519
+ test("017 - recurring billing check ccd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
520
+ var response;
521
+ return __generator(this, function (_a) {
522
+ switch (_a.label) {
523
+ case 0:
524
+ t.plan(2);
525
+ if (!paymentMethodCheckCcd || !scheduleCheckCcd) {
526
+ return [2 /*return*/];
527
+ }
528
+ return [4 /*yield*/, paymentMethodCheckCcd
529
+ .charge(20.04)
530
+ .withCurrency("USD")
531
+ .withScheduleId(scheduleCheckCcd.key)
532
+ .withOneTimePayment(false)
533
+ .execute()];
534
+ case 1:
535
+ response = _a.sent();
536
+ t.truthy(response);
537
+ t.is(response.responseCode, "00");
538
+ return [2 /*return*/];
539
+ }
540
+ });
541
+ }); });
542
+ // recurring billing - one time
543
+ test("018 - recurring billing one time visa", function (t) { return __awaiter(void 0, void 0, void 0, function () {
544
+ var response;
545
+ return __generator(this, function (_a) {
546
+ switch (_a.label) {
547
+ case 0:
548
+ t.plan(2);
549
+ if (!paymentMethodVisa) {
550
+ return [2 /*return*/];
551
+ }
552
+ return [4 /*yield*/, paymentMethodVisa.charge(20.06).execute()];
553
+ case 1:
554
+ response = _a.sent();
555
+ t.truthy(response);
556
+ t.is(response.responseCode, "00");
557
+ return [2 /*return*/];
558
+ }
559
+ });
560
+ }); });
561
+ test("019 - recurring billing one time mastercard", function (t) { return __awaiter(void 0, void 0, void 0, function () {
562
+ var response;
563
+ return __generator(this, function (_a) {
564
+ switch (_a.label) {
565
+ case 0:
566
+ t.plan(2);
567
+ if (!paymentMethodMasterCard) {
568
+ return [2 /*return*/];
569
+ }
570
+ return [4 /*yield*/, paymentMethodMasterCard
571
+ .charge(20.07)
572
+ .withCurrency("USD")
573
+ .execute()];
574
+ case 1:
575
+ response = _a.sent();
576
+ t.truthy(response);
577
+ t.is(response.responseCode, "00");
578
+ return [2 /*return*/];
579
+ }
580
+ });
581
+ }); });
582
+ test("020 - recurring billing one time check ppd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
583
+ var response;
584
+ return __generator(this, function (_a) {
585
+ switch (_a.label) {
586
+ case 0:
587
+ t.plan(2);
588
+ if (!paymentMethodCheckPpd) {
589
+ return [2 /*return*/];
590
+ }
591
+ return [4 /*yield*/, paymentMethodCheckPpd
592
+ .charge(20.08)
593
+ .withCurrency("USD")
594
+ .execute()];
595
+ case 1:
596
+ response = _a.sent();
597
+ t.truthy(response);
598
+ t.is(response.responseCode, "00");
599
+ return [2 /*return*/];
600
+ }
601
+ });
602
+ }); });
603
+ test("021 - recurring billing one time check ccd", function (t) { return __awaiter(void 0, void 0, void 0, function () {
604
+ var response;
605
+ return __generator(this, function (_a) {
606
+ switch (_a.label) {
607
+ case 0:
608
+ t.plan(2);
609
+ if (!paymentMethodCheckCcd) {
610
+ return [2 /*return*/];
611
+ }
612
+ return [4 /*yield*/, paymentMethodCheckCcd
613
+ .charge(20.09)
614
+ .withCurrency("USD")
615
+ .execute()];
616
+ case 1:
617
+ response = _a.sent();
618
+ t.truthy(response);
619
+ t.is(response.responseCode, "00");
620
+ return [2 /*return*/];
621
+ }
622
+ });
623
+ }); });
624
+ // recurring billing - one time - declines
625
+ test("022 - recurring billing one time visa decline", function (t) { return __awaiter(void 0, void 0, void 0, function () {
626
+ var response;
627
+ return __generator(this, function (_a) {
628
+ switch (_a.label) {
629
+ case 0:
630
+ t.plan(2);
631
+ if (!paymentMethodVisa) {
632
+ return [2 /*return*/];
633
+ }
634
+ return [4 /*yield*/, paymentMethodVisa.charge(10.08).execute()];
635
+ case 1:
636
+ response = _a.sent();
637
+ t.truthy(response);
638
+ t.is(response.responseCode, "51");
639
+ return [2 /*return*/];
640
+ }
641
+ });
642
+ }); });
643
+ test("023 - recurring billing one time check ppd decline", function (t) { return __awaiter(void 0, void 0, void 0, function () {
644
+ var response;
645
+ return __generator(this, function (_a) {
646
+ switch (_a.label) {
647
+ case 0:
648
+ t.plan(2);
649
+ if (!paymentMethodCheckPpd) {
650
+ return [2 /*return*/];
651
+ }
652
+ return [4 /*yield*/, paymentMethodCheckPpd
653
+ .charge(25.02)
654
+ .withCurrency("USD")
655
+ .execute()];
656
+ case 1:
657
+ response = _a.sent();
658
+ t.truthy(response);
659
+ t.is(response.responseCode, "00");
660
+ return [2 /*return*/];
661
+ }
662
+ });
663
+ }); });
664
+ test.after("999 - close batch", function (t) {
665
+ t.plan(1);
666
+ return new Promise(function (resolve, reject) {
667
+ src_1.BatchService.closeBatch()
668
+ .then(function (response) {
669
+ t.truthy(response);
670
+ resolve();
671
+ })
672
+ .catch(function (e) {
673
+ if (e.message.indexOf(BATCH_NOT_OPEN) !== -1 ||
674
+ e.message.indexOf(BATCH_EMPTY) !== -1) {
675
+ t.pass();
676
+ resolve();
677
+ return;
678
+ }
679
+ reject(e);
680
+ });
681
+ });
682
+ });