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