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,649 @@
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 ThreeDSecureAsClient_1 = require("../ThreeDSecureAsClient");
10
+ const AcsResponse_1 = require("../AcsResponse");
11
+ const runSerially = true;
12
+ const test = runSerially ? ava_1.default.serial : ava_1.default;
13
+ const currency = "GBP";
14
+ const amount = "10.01";
15
+ const date = new Date();
16
+ let gatewayProvider;
17
+ const card = new src_1.CreditCardData();
18
+ card.number = Data_1.GpApi3DSTestCards.CARDHOLDER_ENROLLED_V1;
19
+ card.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
20
+ card.expYear = (date.getFullYear() + 1).toString();
21
+ card.cvn = "131";
22
+ card.cardHolderName = "James Mason";
23
+ const shippingAddress = new src_1.Address();
24
+ shippingAddress.streetAddress1 = "Apartment 852";
25
+ shippingAddress.streetAddress2 = "Complex 741";
26
+ shippingAddress.streetAddress3 = "no";
27
+ shippingAddress.city = "Chicago";
28
+ shippingAddress.postalCode = "5001";
29
+ shippingAddress.state = "IL";
30
+ shippingAddress.countryCode = "840";
31
+ const browserData = new src_1.BrowserData();
32
+ browserData.acceptHeader =
33
+ "text/html,application/xhtml+xml,application/xml;q=9,image/webp,img/apng,*/*;q=0.8";
34
+ browserData.colorDepth = src_1.ColorDepth.TwentyFourBits;
35
+ browserData.ipAddress = "123.123.123.123";
36
+ browserData.javaEnabled = true;
37
+ browserData.javaScriptEnabled = true;
38
+ browserData.language = "en";
39
+ browserData.screenHeight = 1080;
40
+ browserData.screenWidth = 1920;
41
+ browserData.challengWindowSize = src_1.ChallengeWindowSize.Windowed600x400;
42
+ browserData.timeZone = "0";
43
+ browserData.userAgent =
44
+ "Mozilla/5.0 (Windows NT 6.1; Win64, x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36";
45
+ test.before(() => {
46
+ const config = Data_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
47
+ src_1.ServicesContainer.configureService(config);
48
+ gatewayProvider = config.gatewayProvider;
49
+ });
50
+ test("frictionless full cycle v2", async (t) => {
51
+ const frictionlessSuccessfull3DSV2CardTests = {
52
+ "Frictionless v2.1": [
53
+ Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_1,
54
+ src_1.Secure3dStatus.SuccessAuthenticated,
55
+ ],
56
+ "Frictionless no method url v2.1": [
57
+ Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_NO_METHOD_URL_V2_1,
58
+ src_1.Secure3dStatus.SuccessAuthenticated,
59
+ ],
60
+ "Frictionless v2.2": [
61
+ Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2,
62
+ src_1.Secure3dStatus.SuccessAuthenticated,
63
+ ],
64
+ "Frictionless no method url v2.2": [
65
+ Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_NO_METHOD_URL_V2_2,
66
+ src_1.Secure3dStatus.SuccessAuthenticated,
67
+ ],
68
+ };
69
+ Promise.all(Object.keys(frictionlessSuccessfull3DSV2CardTests).map(async (testCase) => {
70
+ card.number = frictionlessSuccessfull3DSV2CardTests[testCase][0];
71
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
72
+ .withCurrency(currency)
73
+ .withAmount(amount)
74
+ .execute();
75
+ t.truthy(secureEcom);
76
+ if (!(secureEcom instanceof src_1.Transaction)) {
77
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
78
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
79
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
80
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
81
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
82
+ .withAmount(amount)
83
+ .withCurrency(currency)
84
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
85
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
86
+ .withOrderCreateDate(formatedDate)
87
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
88
+ .withOrderTransactionType(src_1.OrderTransactionType.GoodsServicePurchase)
89
+ .withBrowserData(browserData)
90
+ .execute();
91
+ t.truthy(initAuth);
92
+ t.is(frictionlessSuccessfull3DSV2CardTests[testCase][1], initAuth instanceof src_1.ThreeDSecure && initAuth.status);
93
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
94
+ .withServerTransactionId(secureEcom.serverTransactionId)
95
+ .withAmount(amount)
96
+ .execute();
97
+ card.threeDSecure = secureEcom2;
98
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
99
+ t.is(frictionlessSuccessfull3DSV2CardTests[testCase][1], secureEcom2.status);
100
+ t.is("YES", secureEcom2.liabilityShift);
101
+ }
102
+ const response = await card.verify().withCurrency(currency).execute();
103
+ t.truthy(response);
104
+ t.is("SUCCESS", response.responseCode);
105
+ t.is("VERIFIED", response.responseMessage);
106
+ const transaction = await card
107
+ .charge(amount)
108
+ .withCurrency(currency)
109
+ .execute();
110
+ t.truthy(transaction);
111
+ t.is("SUCCESS", transaction.responseCode);
112
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
113
+ }
114
+ }));
115
+ });
116
+ test("frictionless full cycle v2 - failed", async (t) => {
117
+ const frictionlessSuccessfull3DSV2CardTests = {
118
+ "Frictionless failed 1": [
119
+ Data_1.GpApi3DSTestCards.CARD_AUTH_ATTEMPTED_BUT_NOT_SUCCESSFUL_V2_1,
120
+ src_1.Secure3dStatus.SuccessAttemptMade,
121
+ ],
122
+ "Frictionless failed 2": [
123
+ Data_1.GpApi3DSTestCards.CARD_AUTH_FAILED_V2_1,
124
+ src_1.Secure3dStatus.NotAuthenticated,
125
+ ],
126
+ "Frictionless failed 3": [
127
+ Data_1.GpApi3DSTestCards.CARD_AUTH_ISSUER_REJECTED_V2_1,
128
+ src_1.Secure3dStatus.Failed,
129
+ ],
130
+ "Frictionless failed 4": [
131
+ Data_1.GpApi3DSTestCards.CARD_AUTH_COULD_NOT_BE_PREFORMED_V2_1,
132
+ src_1.Secure3dStatus.Failed,
133
+ ],
134
+ "Frictionless failed 5": [
135
+ Data_1.GpApi3DSTestCards.CARD_AUTH_ATTEMPTED_BUT_NOT_SUCCESSFUL_V2_2,
136
+ src_1.Secure3dStatus.SuccessAttemptMade,
137
+ ],
138
+ "Frictionless failed 6": [
139
+ Data_1.GpApi3DSTestCards.CARD_AUTH_FAILED_V2_2,
140
+ src_1.Secure3dStatus.NotAuthenticated,
141
+ ],
142
+ "Frictionless failed 7": [
143
+ Data_1.GpApi3DSTestCards.CARD_AUTH_ISSUER_REJECTED_V2_2,
144
+ src_1.Secure3dStatus.Failed,
145
+ ],
146
+ "Frictionless failed 8": [
147
+ Data_1.GpApi3DSTestCards.CARD_AUTH_COULD_NOT_BE_PREFORMED_V2_2,
148
+ src_1.Secure3dStatus.Failed,
149
+ ],
150
+ };
151
+ Promise.all(Object.keys(frictionlessSuccessfull3DSV2CardTests).map(async (testCase) => {
152
+ card.number = frictionlessSuccessfull3DSV2CardTests[testCase][0];
153
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
154
+ .withCurrency(currency)
155
+ .withAmount(amount)
156
+ .execute();
157
+ t.truthy(secureEcom);
158
+ if (!(secureEcom instanceof src_1.Transaction)) {
159
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
160
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
161
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
162
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
163
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
164
+ .withAmount(amount)
165
+ .withCurrency(currency)
166
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
167
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
168
+ .withOrderCreateDate(formatedDate)
169
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
170
+ .withBrowserData(browserData)
171
+ .execute();
172
+ t.truthy(initAuth);
173
+ t.is(frictionlessSuccessfull3DSV2CardTests[testCase][1], initAuth instanceof src_1.ThreeDSecure && initAuth.status);
174
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
175
+ .withServerTransactionId(secureEcom.serverTransactionId)
176
+ .withAmount(amount)
177
+ .execute();
178
+ const liabilityShift = frictionlessSuccessfull3DSV2CardTests[testCase][1] ==
179
+ src_1.Secure3dStatus.SuccessAttemptMade
180
+ ? "YES"
181
+ : "NO";
182
+ card.threeDSecure = secureEcom2;
183
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
184
+ t.is(frictionlessSuccessfull3DSV2CardTests[testCase][1], secureEcom2.status);
185
+ t.is(liabilityShift, secureEcom2.liabilityShift);
186
+ }
187
+ const transaction = await card
188
+ .charge(amount)
189
+ .withCurrency(currency)
190
+ .execute();
191
+ t.truthy(transaction);
192
+ t.is("SUCCESS", transaction.responseCode);
193
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
194
+ }
195
+ }));
196
+ });
197
+ test("card holder enrolled - challenge required - v2", async (t) => {
198
+ const challengeSuccessful3DSV2CardTests = {
199
+ "Challenge v2.1": [
200
+ Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1,
201
+ src_1.Secure3dStatus.SuccessAuthenticated,
202
+ ],
203
+ "Challenge v2.2": [
204
+ Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_2,
205
+ src_1.Secure3dStatus.SuccessAuthenticated,
206
+ ],
207
+ };
208
+ Promise.all(Object.keys(challengeSuccessful3DSV2CardTests).map(async (testCase) => {
209
+ card.number = challengeSuccessful3DSV2CardTests[testCase][0];
210
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
211
+ .withCurrency(currency)
212
+ .withAmount(amount)
213
+ .execute();
214
+ t.truthy(secureEcom);
215
+ if (!(secureEcom instanceof src_1.Transaction)) {
216
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
217
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
218
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
219
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
220
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
221
+ .withAmount(amount)
222
+ .withCurrency(currency)
223
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
224
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
225
+ .withOrderCreateDate(formatedDate)
226
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
227
+ .withBrowserData(browserData)
228
+ .execute();
229
+ t.truthy(initAuth);
230
+ if (initAuth instanceof src_1.ThreeDSecure) {
231
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
232
+ t.truthy(initAuth.issuerAcsUrl);
233
+ t.truthy(initAuth.payerAuthenticationRequest);
234
+ const authClient = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
235
+ authClient.setGatewayProvider(gatewayProvider);
236
+ const authResponse = await authClient.authenticate_v2(initAuth);
237
+ if (authResponse instanceof AcsResponse_1.AcsResponse) {
238
+ t.true(authResponse.getStatus());
239
+ t.truthy(authResponse.getMerchantData());
240
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
241
+ .withServerTransactionId(authResponse.getMerchantData())
242
+ .withAmount(amount)
243
+ .execute();
244
+ card.threeDSecure = secureEcom2;
245
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
246
+ t.is(challengeSuccessful3DSV2CardTests[testCase][1], secureEcom2.status);
247
+ t.is("YES", secureEcom2.liabilityShift);
248
+ }
249
+ const transaction = await card
250
+ .charge(amount)
251
+ .withCurrency(currency)
252
+ .execute();
253
+ t.truthy(transaction);
254
+ t.is("SUCCESS", transaction.responseCode);
255
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
256
+ }
257
+ }
258
+ }
259
+ }));
260
+ });
261
+ test("card holder enrolled - challenge required - get results failed - v2", async (t) => {
262
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_2;
263
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
264
+ .withCurrency(currency)
265
+ .withAmount(amount)
266
+ .execute();
267
+ t.truthy(secureEcom);
268
+ if (!(secureEcom instanceof src_1.Transaction)) {
269
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
270
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
271
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
272
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
273
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
274
+ .withAmount(amount)
275
+ .withCurrency(currency)
276
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
277
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
278
+ .withOrderCreateDate(formatedDate)
279
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
280
+ .withBrowserData(browserData)
281
+ .execute();
282
+ t.truthy(initAuth);
283
+ if (initAuth instanceof src_1.ThreeDSecure) {
284
+ t.is(src_1.Secure3dStatus.Enrolled, initAuth.enrolled);
285
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
286
+ t.truthy(initAuth.issuerAcsUrl);
287
+ t.truthy(initAuth.payerAuthenticationRequest);
288
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
289
+ .withServerTransactionId(initAuth.serverTransactionId)
290
+ .withAmount(amount)
291
+ .execute();
292
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
293
+ t.is(src_1.Secure3dStatus.ChallengeRequired, secureEcom2.status);
294
+ }
295
+ }
296
+ }
297
+ });
298
+ test("full cycle with card tokenization v2", async (t) => {
299
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_1;
300
+ const response = await card.tokenize().execute();
301
+ const tokenizedCard = new src_1.CreditCardData();
302
+ tokenizedCard.token = response.token;
303
+ tokenizedCard.cardHolderName = "James Mason";
304
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
305
+ .withCurrency(currency)
306
+ .withAmount(amount)
307
+ .execute();
308
+ t.truthy(secureEcom);
309
+ if (!(secureEcom instanceof src_1.Transaction)) {
310
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
311
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
312
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
313
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
314
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
315
+ .withAmount(amount)
316
+ .withCurrency(currency)
317
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
318
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
319
+ .withOrderCreateDate(formatedDate)
320
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
321
+ .withOrderTransactionType(src_1.OrderTransactionType.GoodsServicePurchase)
322
+ .withBrowserData(browserData)
323
+ .execute();
324
+ t.truthy(initAuth);
325
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom.status);
326
+ t.is("YES", secureEcom.liabilityShift);
327
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
328
+ .withServerTransactionId(secureEcom.serverTransactionId)
329
+ .withAmount(amount)
330
+ .execute();
331
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
332
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
333
+ t.is("YES", secureEcom2.liabilityShift);
334
+ }
335
+ tokenizedCard.threeDSecure = secureEcom2;
336
+ const response = await card.verify().withCurrency(currency).execute();
337
+ t.truthy(response);
338
+ t.is("SUCCESS", response.responseCode);
339
+ t.is("VERIFIED", response.responseMessage);
340
+ const transaction = await card
341
+ .charge(amount)
342
+ .withCurrency(currency)
343
+ .execute();
344
+ t.truthy(transaction);
345
+ t.is("SUCCESS", transaction.responseCode);
346
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
347
+ }
348
+ });
349
+ test("frictionless full cycle - different amount - v2", async (t) => {
350
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_1;
351
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
352
+ .withCurrency(currency)
353
+ .withAmount(amount)
354
+ .execute();
355
+ t.truthy(secureEcom);
356
+ if (!(secureEcom instanceof src_1.Transaction)) {
357
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
358
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
359
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
360
+ t.is(amount, String(secureEcom.amount));
361
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
362
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
363
+ .withAmount(9)
364
+ .withCurrency(currency)
365
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
366
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
367
+ .withOrderCreateDate(formatedDate)
368
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
369
+ .withBrowserData(browserData)
370
+ .execute();
371
+ t.truthy(initAuth);
372
+ if (initAuth instanceof src_1.ThreeDSecure) {
373
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status);
374
+ t.is(amount, String(initAuth.getAmount()));
375
+ t.is("YES", initAuth.liabilityShift);
376
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
377
+ .withServerTransactionId(initAuth.serverTransactionId)
378
+ .execute();
379
+ card.threeDSecure = initAuth;
380
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
381
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
382
+ t.is("YES", secureEcom2.liabilityShift);
383
+ t.is(amount, String(secureEcom2.getAmount()));
384
+ }
385
+ const transaction = await card
386
+ .charge(amount)
387
+ .withCurrency(currency)
388
+ .execute();
389
+ t.truthy(transaction);
390
+ t.is("SUCCESS", transaction.responseCode);
391
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
392
+ }
393
+ }
394
+ });
395
+ test("card holder enrolled - challenge required - v2 duplicate acs request", async (t) => {
396
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_2;
397
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
398
+ .withCurrency(currency)
399
+ .withAmount(amount)
400
+ .execute();
401
+ t.truthy(secureEcom);
402
+ if (!(secureEcom instanceof src_1.Transaction)) {
403
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
404
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
405
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
406
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
407
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
408
+ .withAmount(amount)
409
+ .withCurrency(currency)
410
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
411
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
412
+ .withOrderCreateDate(formatedDate)
413
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
414
+ .withBrowserData(browserData)
415
+ .execute();
416
+ t.truthy(initAuth);
417
+ if (initAuth instanceof src_1.ThreeDSecure) {
418
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
419
+ t.truthy(initAuth.issuerAcsUrl);
420
+ t.truthy(initAuth.payerAuthenticationRequest);
421
+ const authClient = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
422
+ authClient.setGatewayProvider(gatewayProvider);
423
+ const authResponse = await authClient.authenticate_v2(initAuth);
424
+ if (authResponse instanceof AcsResponse_1.AcsResponse) {
425
+ t.true(authResponse.getStatus());
426
+ t.truthy(authResponse.getMerchantData());
427
+ }
428
+ const authClient2 = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
429
+ authClient2.setGatewayProvider(gatewayProvider);
430
+ const authResponse2 = await authClient2.authenticate_v2(initAuth);
431
+ if (authResponse2 instanceof AcsResponse_1.AcsResponse) {
432
+ t.true(authResponse2.getStatus());
433
+ t.truthy(authResponse2.getMerchantData());
434
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
435
+ .withServerTransactionId(authResponse2.getMerchantData())
436
+ .withAmount(amount)
437
+ .execute();
438
+ card.threeDSecure = secureEcom2;
439
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
440
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
441
+ t.is("YES", secureEcom2.liabilityShift);
442
+ }
443
+ const transaction = await card
444
+ .charge(amount)
445
+ .withCurrency(currency)
446
+ .execute();
447
+ t.truthy(transaction);
448
+ t.is("SUCCESS", transaction.responseCode);
449
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
450
+ }
451
+ }
452
+ }
453
+ });
454
+ test("credit sale tokenized with stored credentials recurring", async (t) => {
455
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_1;
456
+ card.entryMethod = src_1.ManualEntryMethod.MOTO;
457
+ const storedCredentials = new src_1.StoredCredential();
458
+ storedCredentials.initiator = src_1.EnumMapping.mapStoredCredentialInitiator(gatewayProvider, src_1.StoredCredentialInitiator.Merchant);
459
+ storedCredentials.type = src_1.StoredCredentialType.RECURRING;
460
+ storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
461
+ storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
462
+ const response = await card.tokenize().execute();
463
+ const tokenizedCard = new src_1.CreditCardData();
464
+ tokenizedCard.token = response.token;
465
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
466
+ .withCurrency(currency)
467
+ .withAmount(amount)
468
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
469
+ .execute();
470
+ t.truthy(secureEcom);
471
+ if (!(secureEcom instanceof src_1.Transaction)) {
472
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
473
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
474
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
475
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
476
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(tokenizedCard, secureEcom)
477
+ .withAmount(amount)
478
+ .withCurrency(currency)
479
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
480
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
481
+ .withOrderCreateDate(formatedDate)
482
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
483
+ .withBrowserData(browserData)
484
+ .execute();
485
+ t.truthy(initAuth);
486
+ if (initAuth instanceof src_1.ThreeDSecure) {
487
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status);
488
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
489
+ .withServerTransactionId(secureEcom.serverTransactionId)
490
+ .withAmount(amount)
491
+ .execute();
492
+ tokenizedCard.threeDSecure = secureEcom2;
493
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
494
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
495
+ t.is("YES", secureEcom2.liabilityShift);
496
+ }
497
+ const transaction = await tokenizedCard
498
+ .charge(amount)
499
+ .withCurrency(currency)
500
+ .execute();
501
+ t.truthy(transaction);
502
+ t.is("SUCCESS", transaction.responseCode);
503
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
504
+ t.truthy(transaction.cardBrandTransactionId);
505
+ const recurringPayment = await tokenizedCard
506
+ .charge(amount)
507
+ .withCurrency(currency)
508
+ .withStoredCredentials(storedCredentials)
509
+ .withCardBrandStorage(src_1.StoredCredentialInitiator.Merchant, transaction.cardBrandTransactionId)
510
+ .execute();
511
+ t.truthy(recurringPayment);
512
+ t.is("SUCCESS", recurringPayment.responseCode);
513
+ t.is(src_1.TransactionStatus.CAPTURED, recurringPayment.responseMessage);
514
+ t.truthy(recurringPayment.cardBrandTransactionId);
515
+ }
516
+ }
517
+ });
518
+ test("frictionless full cycle - v2 - with mobile SDK", async (t) => {
519
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
520
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
521
+ .withCurrency(currency)
522
+ .withAmount(amount)
523
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
524
+ .execute();
525
+ t.truthy(secureEcom);
526
+ if (!(secureEcom instanceof src_1.Transaction)) {
527
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
528
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
529
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
530
+ const mobileData = new src_1.MobileData();
531
+ mobileData.encodedData =
532
+ "ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K";
533
+ mobileData.applicationReference = "f283b3ec-27da-42a1-acea-f3f70e75bbdc";
534
+ mobileData.sdkInterface = src_1.SdkInterface.Browser;
535
+ mobileData.sdkUiTypes = [src_1.SdkUiType.HtmlOther];
536
+ mobileData.ephemeralPublicKey = `{
537
+ "kty": "EC",
538
+ "crv": "P-256",
539
+ "x": "WWcpTjbOqiu_1aODllw5rYTq5oLXE_T0huCPjMIRbkI",
540
+ "y": "Wz_7anIeadV8SJZUfr4drwjzuWoUbOsHp5GdRZBAAiw"
541
+ }`;
542
+ mobileData.maximumTimeout = 50;
543
+ mobileData.referenceNumber = "3DS_LOA_SDK_PPFU_020100_00007";
544
+ mobileData.sdkTransReference = "b2385523-a66c-4907-ac3c-91848e8c0067";
545
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
546
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
547
+ .withAmount(amount)
548
+ .withCurrency(currency)
549
+ .withAuthenticationSource(src_1.AuthenticationSource.MobileSdk)
550
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
551
+ .withOrderCreateDate(formatedDate)
552
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
553
+ .withOrderTransactionType(src_1.OrderTransactionType.GoodsServicePurchase)
554
+ .withMobileData(mobileData)
555
+ .execute();
556
+ t.truthy(initAuth);
557
+ if (initAuth instanceof src_1.ThreeDSecure) {
558
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status);
559
+ t.truthy(initAuth.issuerAcsUrl);
560
+ t.truthy(initAuth.payerAuthenticationRequest);
561
+ t.truthy(initAuth.acsTransactionId);
562
+ t.truthy(initAuth.providerServerTransRef);
563
+ t.truthy(initAuth.acsReferenceNumber);
564
+ t.is("05", String(initAuth.eci));
565
+ t.is("2.2.0", initAuth.messageVersion);
566
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
567
+ .withServerTransactionId(secureEcom.serverTransactionId)
568
+ .withAmount(amount)
569
+ .execute();
570
+ card.threeDSecure = secureEcom2;
571
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
572
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
573
+ t.is("YES", secureEcom2.liabilityShift);
574
+ }
575
+ const transaction = await card
576
+ .charge(amount)
577
+ .withCurrency(currency)
578
+ .execute();
579
+ t.truthy(transaction);
580
+ t.is("SUCCESS", transaction.responseCode);
581
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
582
+ }
583
+ }
584
+ });
585
+ test("decoupled auth", async (t) => {
586
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_1;
587
+ const response = await card.tokenize().execute();
588
+ const tokenizedCard = new src_1.CreditCardData();
589
+ tokenizedCard.token = response.token;
590
+ tokenizedCard.cardHolderName = "James Mason";
591
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
592
+ .withCurrency(currency)
593
+ .withAmount(amount)
594
+ .withDecoupledNotificationUrl("https://www.example.com/decoupledNotification")
595
+ .execute();
596
+ t.truthy(secureEcom);
597
+ if (!(secureEcom instanceof src_1.Transaction)) {
598
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
599
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
600
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
601
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
602
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(tokenizedCard, secureEcom)
603
+ .withAmount(amount)
604
+ .withCurrency(currency)
605
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
606
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
607
+ .withOrderCreateDate(formatedDate)
608
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
609
+ .withBrowserData(browserData)
610
+ .withDecoupledFlowRequest(true)
611
+ .withDecoupledFlowTimeout(9001)
612
+ .withDecoupledNotificationUrl("https://www.example.com/decoupledNotification")
613
+ .execute();
614
+ t.truthy(initAuth);
615
+ if (initAuth instanceof src_1.ThreeDSecure) {
616
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status);
617
+ t.is("YES", initAuth.liabilityShift);
618
+ }
619
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
620
+ .withServerTransactionId(secureEcom.serverTransactionId)
621
+ .withAmount(amount)
622
+ .execute();
623
+ tokenizedCard.threeDSecure = secureEcom2;
624
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
625
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
626
+ t.is("YES", secureEcom2.liabilityShift);
627
+ }
628
+ const transaction = await tokenizedCard
629
+ .charge(amount)
630
+ .withCurrency(currency)
631
+ .execute();
632
+ t.truthy(transaction);
633
+ t.is("SUCCESS", transaction.responseCode);
634
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
635
+ t.truthy(transaction.cardBrandTransactionId);
636
+ }
637
+ });
638
+ test("exemption sale transaction", async (t) => {
639
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_2;
640
+ const threeDS = new src_1.ThreeDSecure();
641
+ threeDS.exemptStatus = src_1.ExemptStatus.LowValue;
642
+ card.threeDSecure = threeDS;
643
+ const response = await card.charge(amount).withCurrency(currency).execute();
644
+ t.truthy(response);
645
+ t.is("SUCCESS", response.responseCode);
646
+ t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
647
+ });
648
+ test.after(() => Data_1.BaseGpApiTestConfig.resetGpApiConfig());
649
+ //# sourceMappingURL=3DSecureTest.js.map