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