globalpayments-api 3.6.2 → 3.8.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 (424) hide show
  1. package/CHANGELOG.md +143 -125
  2. package/lib/src/Builders/AuthorizationBuilder.d.ts +9 -1
  3. package/lib/src/Builders/AuthorizationBuilder.js +10 -1
  4. package/lib/src/Builders/AuthorizationBuilder.js.map +1 -1
  5. package/lib/src/Builders/BaseBuilder/Validations.d.ts +3 -1
  6. package/lib/src/Builders/BaseBuilder/Validations.js +5 -5
  7. package/lib/src/Builders/BaseBuilder/Validations.js.map +1 -1
  8. package/lib/src/Builders/ManagementBuilder.d.ts +17 -1
  9. package/lib/src/Builders/ManagementBuilder.js +22 -0
  10. package/lib/src/Builders/ManagementBuilder.js.map +1 -1
  11. package/lib/src/Builders/RequestBuilder/GpApi/GpApiManagementRequestBuilder.js +19 -0
  12. package/lib/src/Builders/RequestBuilder/GpApi/GpApiManagementRequestBuilder.js.map +1 -1
  13. package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.d.ts +2 -0
  14. package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.js +120 -0
  15. package/lib/src/Builders/RequestBuilder/GpApi/GpApiReportRequestBuilder.js.map +1 -1
  16. package/lib/src/Builders/TransactionReportBuilder.d.ts +7 -2
  17. package/lib/src/Builders/TransactionReportBuilder.js +28 -0
  18. package/lib/src/Builders/TransactionReportBuilder.js.map +1 -1
  19. package/lib/src/Entities/DisputeDocument.d.ts +5 -0
  20. package/lib/src/Entities/DisputeDocument.js +10 -0
  21. package/lib/src/Entities/DisputeDocument.js.map +1 -0
  22. package/lib/src/Entities/Document.d.ts +10 -0
  23. package/lib/src/Entities/Document.js +13 -0
  24. package/lib/src/Entities/Document.js.map +1 -0
  25. package/lib/src/Entities/Enums/DepositSortProperty.d.ts +6 -0
  26. package/lib/src/Entities/Enums/DepositSortProperty.js +11 -0
  27. package/lib/src/Entities/Enums/DepositSortProperty.js.map +1 -0
  28. package/lib/src/Entities/Enums/DisputeSortProperty.d.ts +12 -0
  29. package/lib/src/Entities/Enums/DisputeSortProperty.js +17 -0
  30. package/lib/src/Entities/Enums/DisputeSortProperty.js.map +1 -0
  31. package/lib/src/Entities/Enums/DisputeStage.d.ts +11 -0
  32. package/lib/src/Entities/Enums/DisputeStage.js +16 -0
  33. package/lib/src/Entities/Enums/DisputeStage.js.map +1 -0
  34. package/lib/src/Entities/Enums/DisputeStatus.d.ts +7 -0
  35. package/lib/src/Entities/Enums/DisputeStatus.js +12 -0
  36. package/lib/src/Entities/Enums/DisputeStatus.js.map +1 -0
  37. package/lib/src/Entities/Enums/DocumentCategory.d.ts +5 -0
  38. package/lib/src/Entities/Enums/DocumentCategory.js +10 -0
  39. package/lib/src/Entities/Enums/DocumentCategory.js.map +1 -0
  40. package/lib/src/Entities/Enums/FileType.d.ts +11 -0
  41. package/lib/src/Entities/Enums/FileType.js +16 -0
  42. package/lib/src/Entities/Enums/FileType.js.map +1 -0
  43. package/lib/src/Entities/Enums.d.ts +8 -0
  44. package/lib/src/Entities/Enums.js +8 -0
  45. package/lib/src/Entities/Enums.js.map +1 -1
  46. package/lib/src/Entities/HostedPaymentData.d.ts +3 -0
  47. package/lib/src/Entities/HostedPaymentData.js +3 -0
  48. package/lib/src/Entities/HostedPaymentData.js.map +1 -1
  49. package/lib/src/Entities/Reporting/DepositSummary.d.ts +29 -0
  50. package/lib/src/Entities/Reporting/DepositSummary.js +34 -0
  51. package/lib/src/Entities/Reporting/DepositSummary.js.map +1 -0
  52. package/lib/src/Entities/Reporting/DisputeSummary.d.ts +53 -0
  53. package/lib/src/Entities/Reporting/DisputeSummary.js +64 -0
  54. package/lib/src/Entities/Reporting/DisputeSummary.js.map +1 -0
  55. package/lib/src/Entities/Reporting/SearchCriteriaBuilder.d.ts +4 -2
  56. package/lib/src/Entities/Reporting/SearchCriteriaBuilder.js +2 -0
  57. package/lib/src/Entities/Reporting/SearchCriteriaBuilder.js.map +1 -1
  58. package/lib/src/Entities/Reporting/index.d.ts +2 -0
  59. package/lib/src/Entities/Reporting/index.js +2 -0
  60. package/lib/src/Entities/Reporting/index.js.map +1 -1
  61. package/lib/src/Entities/Transaction.d.ts +15 -1
  62. package/lib/src/Entities/Transaction.js +34 -0
  63. package/lib/src/Entities/Transaction.js.map +1 -1
  64. package/lib/src/Entities/index.d.ts +8 -0
  65. package/lib/src/Entities/index.js +8 -0
  66. package/lib/src/Entities/index.js.map +1 -1
  67. package/lib/src/Gateways/GpApiConnector.js +3 -0
  68. package/lib/src/Gateways/GpApiConnector.js.map +1 -1
  69. package/lib/src/Gateways/GpEcomConnector.js +9 -0
  70. package/lib/src/Gateways/GpEcomConnector.js.map +1 -1
  71. package/lib/src/Gateways/PorticoConnector.js +5 -0
  72. package/lib/src/Gateways/PorticoConnector.js.map +1 -1
  73. package/lib/src/Mapping/GpApiMapping.d.ts +3 -0
  74. package/lib/src/Mapping/GpApiMapping.js +128 -13
  75. package/lib/src/Mapping/GpApiMapping.js.map +1 -1
  76. package/lib/src/Services/ReportingService.d.ts +8 -1
  77. package/lib/src/Services/ReportingService.js +21 -0
  78. package/lib/src/Services/ReportingService.js.map +1 -1
  79. package/lib/test/Data/BaseGpApiTestConfig.d.ts +14 -0
  80. package/lib/test/Data/BaseGpApiTestConfig.js +50 -0
  81. package/lib/test/Data/BaseGpApiTestConfig.js.map +1 -0
  82. package/lib/test/Data/GpApi3DSTestCards.d.ts +17 -0
  83. package/lib/test/Data/GpApi3DSTestCards.js +22 -0
  84. package/lib/test/Data/GpApi3DSTestCards.js.map +1 -0
  85. package/lib/test/Data/TestCards.d.ts +24 -0
  86. package/lib/test/Data/TestCards.js +220 -0
  87. package/lib/test/Data/TestCards.js.map +1 -0
  88. package/lib/test/Data/TestChecks.d.ts +4 -0
  89. package/lib/test/Data/TestChecks.js +27 -0
  90. package/lib/test/Data/TestChecks.js.map +1 -0
  91. package/lib/test/Data/index.d.ts +4 -0
  92. package/lib/test/Data/index.js +21 -0
  93. package/lib/test/Data/index.js.map +1 -0
  94. package/lib/test/Integration/Gateways/AcsResponse.d.ts +12 -0
  95. package/lib/test/Integration/Gateways/AcsResponse.js +33 -0
  96. package/lib/test/Integration/Gateways/AcsResponse.js.map +1 -0
  97. package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.d.ts +1 -0
  98. package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js +1026 -0
  99. package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js.map +1 -0
  100. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.d.ts +1 -0
  101. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js +1029 -0
  102. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js.map +1 -0
  103. package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.d.ts +1 -0
  104. package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js +643 -0
  105. package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js.map +1 -0
  106. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.d.ts +1 -0
  107. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js +649 -0
  108. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js.map +1 -0
  109. package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.d.ts +1 -0
  110. package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.js +130 -0
  111. package/lib/test/Integration/Gateways/GpApiConnector/AccessToken.test.js.map +1 -0
  112. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.d.ts +1 -0
  113. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js +109 -0
  114. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js.map +1 -0
  115. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.d.ts +1 -0
  116. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.js +1070 -0
  117. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresent.test.js.map +1 -0
  118. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.d.ts +1 -0
  119. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js +1025 -0
  120. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js.map +1 -0
  121. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.d.ts +1 -0
  122. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js +439 -0
  123. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js.map +1 -0
  124. package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.d.ts +1 -0
  125. package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.js +137 -0
  126. package/lib/test/Integration/Gateways/GpApiConnector/DebitCard.test.js.map +1 -0
  127. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.d.ts +1 -0
  128. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js +143 -0
  129. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js.map +1 -0
  130. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.d.ts +1 -0
  131. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.js +642 -0
  132. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertification.test.js.map +1 -0
  133. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.d.ts +1 -0
  134. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js +639 -0
  135. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js.map +1 -0
  136. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.d.ts +1 -0
  137. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.js +151 -0
  138. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagement.test.js.map +1 -0
  139. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.d.ts +1 -0
  140. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js +149 -0
  141. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js.map +1 -0
  142. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.d.ts +1 -0
  143. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.js +226 -0
  144. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDeposits.test.js.map +1 -0
  145. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.d.ts +1 -0
  146. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js +226 -0
  147. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js.map +1 -0
  148. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.d.ts +1 -0
  149. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.js +571 -0
  150. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDisputes.test.js.map +1 -0
  151. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.d.ts +1 -0
  152. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.js +430 -0
  153. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactions.test.js.map +1 -0
  154. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.d.ts +1 -0
  155. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js +434 -0
  156. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js.map +1 -0
  157. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.d.ts +1 -0
  158. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.js +216 -0
  159. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethods.test.js.map +1 -0
  160. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.d.ts +1 -0
  161. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js +217 -0
  162. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js.map +1 -0
  163. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.d.ts +1 -0
  164. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.js +340 -0
  165. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactions.test.js.map +1 -0
  166. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.d.ts +1 -0
  167. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js +338 -0
  168. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js.map +1 -0
  169. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.d.ts +1 -0
  170. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.js +2426 -0
  171. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Auth.test.js.map +1 -0
  172. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.d.ts +1 -0
  173. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js +2446 -0
  174. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js.map +1 -0
  175. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.d.ts +1 -0
  176. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.js +562 -0
  177. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Avs.test.js.map +1 -0
  178. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.d.ts +1 -0
  179. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js +506 -0
  180. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js.map +1 -0
  181. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.d.ts +1 -0
  182. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.js +1292 -0
  183. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Credit.test.js.map +1 -0
  184. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.d.ts +1 -0
  185. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js +1296 -0
  186. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js.map +1 -0
  187. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.d.ts +1 -0
  188. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.js +880 -0
  189. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/Hold.test.js.map +1 -0
  190. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.d.ts +1 -0
  191. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js +847 -0
  192. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js.map +1 -0
  193. package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.d.ts +1 -0
  194. package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js +207 -0
  195. package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js.map +1 -0
  196. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.d.ts +1 -0
  197. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js +215 -0
  198. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js.map +1 -0
  199. package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.d.ts +1 -0
  200. package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.js +137 -0
  201. package/lib/test/Integration/Gateways/GpEcomConnector/Hpp.test.js.map +1 -0
  202. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.d.ts +1 -0
  203. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js +99 -0
  204. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js.map +1 -0
  205. package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.d.ts +1 -0
  206. package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.js +124 -0
  207. package/lib/test/Integration/Gateways/GpEcomConnector/Recurring.test.js.map +1 -0
  208. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.d.ts +1 -0
  209. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js +133 -0
  210. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js.map +1 -0
  211. package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.d.ts +1 -0
  212. package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.js +54 -0
  213. package/lib/test/Integration/Gateways/PorticoConnector/Ach.test.js.map +1 -0
  214. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.d.ts +1 -0
  215. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +59 -0
  216. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js.map +1 -0
  217. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.d.ts +1 -0
  218. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.js +357 -0
  219. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Check.test.js.map +1 -0
  220. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +1 -0
  221. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +378 -0
  222. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js.map +1 -0
  223. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.d.ts +1 -0
  224. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.js +1667 -0
  225. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Ecommerce.test.js.map +1 -0
  226. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.d.ts +1 -0
  227. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.js +80 -0
  228. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheck.test.js.map +1 -0
  229. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +1 -0
  230. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +86 -0
  231. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js.map +1 -0
  232. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +1 -0
  233. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +1723 -0
  234. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js.map +1 -0
  235. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.d.ts +1 -0
  236. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.js +1487 -0
  237. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Moto.test.js.map +1 -0
  238. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.d.ts +1 -0
  239. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.js +80 -0
  240. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheck.test.js.map +1 -0
  241. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +1 -0
  242. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +86 -0
  243. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js.map +1 -0
  244. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +1 -0
  245. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +1760 -0
  246. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js.map +1 -0
  247. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.d.ts +1 -0
  248. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.js +393 -0
  249. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Recurring.test.js.map +1 -0
  250. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +1 -0
  251. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +420 -0
  252. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js.map +1 -0
  253. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.d.ts +1 -0
  254. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.js +2102 -0
  255. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/Retail.test.js.map +1 -0
  256. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +1 -0
  257. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +2221 -0
  258. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js.map +1 -0
  259. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.d.ts +1 -0
  260. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +367 -0
  261. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -0
  262. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +1 -0
  263. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +392 -0
  264. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js.map +1 -0
  265. package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.d.ts +1 -0
  266. package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.js +83 -0
  267. package/lib/test/Integration/Gateways/PorticoConnector/Debit.test.js.map +1 -0
  268. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +1 -0
  269. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +88 -0
  270. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js.map +1 -0
  271. package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.d.ts +1 -0
  272. package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.js +63 -0
  273. package/lib/test/Integration/Gateways/PorticoConnector/Ebt.test.js.map +1 -0
  274. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +1 -0
  275. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +72 -0
  276. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js.map +1 -0
  277. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.d.ts +1 -0
  278. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +136 -0
  279. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js.map +1 -0
  280. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +1 -0
  281. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +143 -0
  282. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js.map +1 -0
  283. package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.d.ts +1 -0
  284. package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.js +121 -0
  285. package/lib/test/Integration/Gateways/PorticoConnector/Gift.test.js.map +1 -0
  286. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +1 -0
  287. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +147 -0
  288. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js.map +1 -0
  289. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.d.ts +1 -0
  290. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.js +40 -0
  291. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementToken.test.js.map +1 -0
  292. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.d.ts +1 -0
  293. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js +48 -0
  294. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js.map +1 -0
  295. package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.d.ts +1 -0
  296. package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.js +87 -0
  297. package/lib/test/Integration/Gateways/PorticoConnector/Recurring.test.js.map +1 -0
  298. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +1 -0
  299. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +101 -0
  300. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js.map +1 -0
  301. package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.d.ts +1 -0
  302. package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.js +44 -0
  303. package/lib/test/Integration/Gateways/PorticoConnector/Reporting.test.js.map +1 -0
  304. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +1 -0
  305. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +50 -0
  306. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js.map +1 -0
  307. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.d.ts +1 -0
  308. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.js +38 -0
  309. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertification.test.js.map +1 -0
  310. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.d.ts +1 -0
  311. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js +44 -0
  312. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js.map +1 -0
  313. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.d.ts +1 -0
  314. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.js +206 -0
  315. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertification.test.js.map +1 -0
  316. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.d.ts +1 -0
  317. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js +221 -0
  318. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js.map +1 -0
  319. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.d.ts +1 -0
  320. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.js +52 -0
  321. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertification.test.js.map +1 -0
  322. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.d.ts +1 -0
  323. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js +60 -0
  324. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js.map +1 -0
  325. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.d.ts +1 -0
  326. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.js +72 -0
  327. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertification.test.js.map +1 -0
  328. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.d.ts +1 -0
  329. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js +80 -0
  330. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js.map +1 -0
  331. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/TestData/TestAccountData.d.ts +39 -0
  332. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/TestData/TestAccountData.js +393 -0
  333. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/TestData/TestAccountData.js.map +1 -0
  334. package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.d.ts +1 -0
  335. package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.js +37 -0
  336. package/lib/test/Integration/Gateways/ProPayConnector/GetInformation.test.js.map +1 -0
  337. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.d.ts +1 -0
  338. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js +44 -0
  339. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js.map +1 -0
  340. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.d.ts +1 -0
  341. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.js +310 -0
  342. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccount.test.js.map +1 -0
  343. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.d.ts +1 -0
  344. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js +330 -0
  345. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js.map +1 -0
  346. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.d.ts +1 -0
  347. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.js +53 -0
  348. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFunds.test.js.map +1 -0
  349. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.d.ts +1 -0
  350. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js +60 -0
  351. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js.map +1 -0
  352. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.d.ts +1 -0
  353. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.js +72 -0
  354. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransaction.test.js.map +1 -0
  355. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.d.ts +1 -0
  356. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js +80 -0
  357. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js.map +1 -0
  358. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestAccountData.d.ts +34 -0
  359. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestAccountData.js +322 -0
  360. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestAccountData.js.map +1 -0
  361. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestFundsData.d.ts +4 -0
  362. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestFundsData.js +28 -0
  363. package/lib/test/Integration/Gateways/ProPayConnector/TestData/TestFundsData.js.map +1 -0
  364. package/lib/test/Integration/Gateways/Terminals/RequestIdProvider.d.ts +4 -0
  365. package/lib/test/Integration/Gateways/Terminals/RequestIdProvider.js +10 -0
  366. package/lib/test/Integration/Gateways/Terminals/RequestIdProvider.js.map +1 -0
  367. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.d.ts +1 -0
  368. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.js +165 -0
  369. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMic.test.js.map +1 -0
  370. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.d.ts +1 -0
  371. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js +149 -0
  372. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js.map +1 -0
  373. package/lib/test/Integration/Gateways/ThreeDSecureAsClient.d.ts +16 -0
  374. package/lib/test/Integration/Gateways/ThreeDSecureAsClient.js +212 -0
  375. package/lib/test/Integration/Gateways/ThreeDSecureAsClient.js.map +1 -0
  376. package/lib/test/Integration/Services/CheckService.test.d.ts +1 -0
  377. package/lib/test/Integration/Services/CheckService.test.js +38 -0
  378. package/lib/test/Integration/Services/CheckService.test.js.map +1 -0
  379. package/lib/test/Integration/Services/CheckServiceTest.d.ts +1 -0
  380. package/lib/test/Integration/Services/CheckServiceTest.js +45 -0
  381. package/lib/test/Integration/Services/CheckServiceTest.js.map +1 -0
  382. package/lib/test/Integration/Services/CreditService.test.d.ts +1 -0
  383. package/lib/test/Integration/Services/CreditService.test.js +158 -0
  384. package/lib/test/Integration/Services/CreditService.test.js.map +1 -0
  385. package/lib/test/Integration/Services/CreditServiceTest.d.ts +1 -0
  386. package/lib/test/Integration/Services/CreditServiceTest.js +174 -0
  387. package/lib/test/Integration/Services/CreditServiceTest.js.map +1 -0
  388. package/lib/test/Integration/Services/DebitService.test.d.ts +1 -0
  389. package/lib/test/Integration/Services/DebitService.test.js +77 -0
  390. package/lib/test/Integration/Services/DebitService.test.js.map +1 -0
  391. package/lib/test/Integration/Services/DebitServiceTest.d.ts +1 -0
  392. package/lib/test/Integration/Services/DebitServiceTest.js +81 -0
  393. package/lib/test/Integration/Services/DebitServiceTest.js.map +1 -0
  394. package/lib/test/Integration/Services/EBTService.test.d.ts +1 -0
  395. package/lib/test/Integration/Services/EBTService.test.js +54 -0
  396. package/lib/test/Integration/Services/EBTService.test.js.map +1 -0
  397. package/lib/test/Integration/Services/EBTServiceTest.d.ts +1 -0
  398. package/lib/test/Integration/Services/EBTServiceTest.js +64 -0
  399. package/lib/test/Integration/Services/EBTServiceTest.js.map +1 -0
  400. package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.d.ts +1 -0
  401. package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.js +122 -0
  402. package/lib/test/Unit/Builders/AuthorizationBuilder/Validation.test.js.map +1 -0
  403. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +1 -0
  404. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +111 -0
  405. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js.map +1 -0
  406. package/lib/test/Unit/Builders/ReportBuilder/Validation.test.d.ts +1 -0
  407. package/lib/test/Unit/Builders/ReportBuilder/Validation.test.js +66 -0
  408. package/lib/test/Unit/Builders/ReportBuilder/Validation.test.js.map +1 -0
  409. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +1 -0
  410. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +62 -0
  411. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js.map +1 -0
  412. package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.d.ts +1 -0
  413. package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.js +32 -0
  414. package/lib/test/Unit/Gateways/GpEcomConnector/Credit.test.js.map +1 -0
  415. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.d.ts +1 -0
  416. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js +34 -0
  417. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js.map +1 -0
  418. package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.d.ts +1 -0
  419. package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.js +128 -0
  420. package/lib/test/Unit/Gateways/PorticoConnector/InputValidation.test.js.map +1 -0
  421. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +1 -0
  422. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +125 -0
  423. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js.map +1 -0
  424. package/package.json +62 -71
@@ -0,0 +1,1029 @@
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.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
19
+ card.expYear = (date.getFullYear() + 1).toString();
20
+ card.cardHolderName = "James Mason";
21
+ const shippingAddress = new src_1.Address();
22
+ shippingAddress.streetAddress1 = "Apartment 852";
23
+ shippingAddress.streetAddress2 = "Complex 741";
24
+ shippingAddress.streetAddress3 = "no";
25
+ shippingAddress.city = "Chicago";
26
+ shippingAddress.postalCode = "5001";
27
+ shippingAddress.state = "IL";
28
+ shippingAddress.countryCode = "840";
29
+ const browserData = new src_1.BrowserData();
30
+ browserData.acceptHeader =
31
+ "text/html,application/xhtml+xml,application/xml;q=9,image/webp,img/apng,*/*;q=0.8";
32
+ browserData.colorDepth = src_1.ColorDepth.TwentyFourBits;
33
+ browserData.ipAddress = "123.123.123.123";
34
+ browserData.javaEnabled = true;
35
+ browserData.javaScriptEnabled = true;
36
+ browserData.language = "en";
37
+ browserData.screenHeight = 1080;
38
+ browserData.screenWidth = 1920;
39
+ browserData.challengWindowSize = src_1.ChallengeWindowSize.Windowed600x400;
40
+ browserData.timeZone = "0";
41
+ browserData.userAgent =
42
+ "Mozilla/5.0 (Windows NT 6.1; Win64, x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36";
43
+ test.before(() => {
44
+ const config = Data_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
45
+ gatewayProvider = config.gatewayProvider;
46
+ src_1.ServicesContainer.configureService(config);
47
+ });
48
+ test.beforeEach(() => {
49
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1;
50
+ });
51
+ test("full cycle v2 frictionless", async (t) => {
52
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
53
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
54
+ .withCurrency(currency)
55
+ .withAmount(amount)
56
+ .execute();
57
+ assertCheckEnrollment3DSV2(t, secureEcom);
58
+ if (secureEcom instanceof src_1.ThreeDSecure) {
59
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
60
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
61
+ .withAmount(amount)
62
+ .withCurrency(currency)
63
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
64
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
65
+ .withOrderCreateDate(formatedDate)
66
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
67
+ .withBrowserData(browserData)
68
+ .execute();
69
+ t.truthy(initAuth);
70
+ initAuth instanceof src_1.ThreeDSecure &&
71
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status) &&
72
+ t.is("YES", initAuth.liabilityShift);
73
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
74
+ .withServerTransactionId(secureEcom.serverTransactionId)
75
+ .withAmount(amount)
76
+ .execute();
77
+ card.threeDSecure = secureEcom2;
78
+ secureEcom2 instanceof src_1.ThreeDSecure &&
79
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
80
+ const transaction = await card
81
+ .charge(amount)
82
+ .withCurrency(currency)
83
+ .execute();
84
+ t.truthy(transaction);
85
+ t.is("SUCCESS", transaction.responseCode);
86
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
87
+ }
88
+ });
89
+ test("full cycle v2 frictionless failed", async (t) => {
90
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_FAILED_V2_2;
91
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
92
+ .withCurrency(currency)
93
+ .withAmount(amount)
94
+ .execute();
95
+ assertCheckEnrollment3DSV2(t, secureEcom);
96
+ if (secureEcom instanceof src_1.ThreeDSecure) {
97
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
98
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
99
+ .withAmount(amount)
100
+ .withCurrency(currency)
101
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
102
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
103
+ .withOrderCreateDate(formatedDate)
104
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
105
+ .withBrowserData(browserData)
106
+ .execute();
107
+ t.truthy(initAuth);
108
+ initAuth instanceof src_1.ThreeDSecure &&
109
+ t.is(src_1.Secure3dStatus.NotAuthenticated, initAuth.status) &&
110
+ t.not("YES", initAuth.liabilityShift);
111
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
112
+ .withServerTransactionId(secureEcom.serverTransactionId)
113
+ .withAmount(amount)
114
+ .execute();
115
+ card.threeDSecure = secureEcom2;
116
+ secureEcom2 instanceof src_1.ThreeDSecure &&
117
+ t.is(src_1.Secure3dStatus.NotAuthenticated, secureEcom2.status);
118
+ const transaction = await card
119
+ .charge(amount)
120
+ .withCurrency(currency)
121
+ .execute();
122
+ t.truthy(transaction);
123
+ t.is("SUCCESS", transaction.responseCode);
124
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
125
+ }
126
+ });
127
+ test("full cycle v2 frictionless with card tokenization", async (t) => {
128
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
129
+ const tokenizeResponse = await card.tokenize().execute();
130
+ const tokenId = tokenizeResponse.token;
131
+ const tokenizedCard = new src_1.CreditCardData();
132
+ tokenizedCard.token = tokenId;
133
+ tokenizedCard.cardHolderName = "James Mason";
134
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
135
+ .withCurrency(currency)
136
+ .withAmount(amount)
137
+ .execute();
138
+ assertCheckEnrollment3DSV2(t, secureEcom);
139
+ t.truthy(secureEcom.payerAuthenticationRequest);
140
+ if (secureEcom instanceof src_1.ThreeDSecure) {
141
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
142
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(tokenizedCard, secureEcom)
143
+ .withAmount(amount)
144
+ .withCurrency(currency)
145
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
146
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
147
+ .withOrderCreateDate(formatedDate)
148
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
149
+ .withBrowserData(browserData)
150
+ .execute();
151
+ t.truthy(initAuth);
152
+ initAuth instanceof src_1.ThreeDSecure &&
153
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status) &&
154
+ t.is("YES", initAuth.liabilityShift);
155
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
156
+ .withServerTransactionId(secureEcom.serverTransactionId)
157
+ .withAmount(amount)
158
+ .execute();
159
+ card.threeDSecure = secureEcom2;
160
+ secureEcom2 instanceof src_1.ThreeDSecure &&
161
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
162
+ const transaction = await card
163
+ .charge(amount)
164
+ .withCurrency(currency)
165
+ .execute();
166
+ t.truthy(transaction);
167
+ t.is("SUCCESS", transaction.responseCode);
168
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
169
+ }
170
+ });
171
+ test("full cycle v2 card holder enrolled challenge required", async (t) => {
172
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1;
173
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
174
+ .withCurrency(currency)
175
+ .withAmount(amount)
176
+ .execute();
177
+ assertCheckEnrollment3DSV2(t, secureEcom);
178
+ if (secureEcom instanceof src_1.ThreeDSecure) {
179
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
180
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
181
+ .withAmount(amount)
182
+ .withCurrency(currency)
183
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
184
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
185
+ .withOrderCreateDate(formatedDate)
186
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
187
+ .withBrowserData(browserData)
188
+ .execute();
189
+ t.truthy(response);
190
+ assertInitiate3DSV2(t, response);
191
+ t.is(src_1.Secure3dStatus.ChallengeRequired, response.status);
192
+ t.truthy(response.payerAuthenticationRequest);
193
+ t.truthy(response.issuerAcsUrl);
194
+ const authClient = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
195
+ authClient.setGatewayProvider(gatewayProvider);
196
+ const authResponse = await authClient.authenticate_v2(response);
197
+ if (authResponse instanceof AcsResponse_1.AcsResponse) {
198
+ t.true(authResponse.getStatus());
199
+ t.truthy(authResponse.getMerchantData());
200
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
201
+ .withServerTransactionId(authResponse.getMerchantData())
202
+ .withAmount(amount)
203
+ .execute();
204
+ card.threeDSecure = secureEcom2;
205
+ secureEcom2 instanceof src_1.ThreeDSecure &&
206
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
207
+ const transaction = await card
208
+ .charge(amount)
209
+ .withCurrency(currency)
210
+ .execute();
211
+ t.truthy(transaction);
212
+ t.is("SUCCESS", transaction.responseCode);
213
+ t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
214
+ }
215
+ }
216
+ });
217
+ test("card holder enrolled challenge required v2 2", async (t) => {
218
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1;
219
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
220
+ .withCurrency(currency)
221
+ .withAmount(amount)
222
+ .execute();
223
+ assertCheckEnrollment3DSV2(t, secureEcom);
224
+ });
225
+ test("card holder enrolled challenge required v2 - with idempotency key", async (t) => {
226
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1;
227
+ const idempotencyKey = src_1.GenerationUtils.getGuuid();
228
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
229
+ .withCurrency(currency)
230
+ .withIdempotencyKey(idempotencyKey)
231
+ .withAmount(amount)
232
+ .execute();
233
+ assertCheckEnrollment3DSV2(t, secureEcom);
234
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.checkEnrollment(card)
235
+ .withCurrency(currency)
236
+ .withIdempotencyKey(idempotencyKey)
237
+ .withAmount(amount)
238
+ .execute(), {
239
+ instanceOf: src_1.GatewayError,
240
+ });
241
+ t.truthy(error);
242
+ if (error) {
243
+ t.is("40039", error.responseCode);
244
+ t.is(error.responseMessage.includes("Idempotency Key seen before"), true);
245
+ }
246
+ });
247
+ test("card holder enrolled challenge required v2 - with tokenized card", async (t) => {
248
+ const response = await card.tokenize().execute();
249
+ const tokenizedCard = new src_1.CreditCardData();
250
+ tokenizedCard.token = response.token;
251
+ tokenizedCard.cardHolderName = "James Mason";
252
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
253
+ .withCurrency(currency)
254
+ .withAmount(amount)
255
+ .execute();
256
+ assertCheckEnrollment3DSV2(t, secureEcom);
257
+ });
258
+ test("card holder enrolled challenge required v2 - all preference value", async (t) => {
259
+ Promise.all(Object.values(src_1.ChallengeRequestIndicator).map(async (value) => {
260
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
261
+ .withCurrency(currency)
262
+ .withAmount(amount)
263
+ .withChallengeRequestIndicator(value)
264
+ .execute();
265
+ assertCheckEnrollment3DSV2(t, secureEcom);
266
+ }));
267
+ });
268
+ test("card holder enrolled challenge required v2 - stored credentials", async (t) => {
269
+ const storedCredentials = new src_1.StoredCredential();
270
+ storedCredentials.initiator = src_1.EnumMapping.mapStoredCredentialInitiator(gatewayProvider, src_1.StoredCredentialInitiator.Merchant);
271
+ storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
272
+ storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
273
+ storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
274
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
275
+ .withCurrency(currency)
276
+ .withAmount(amount)
277
+ .withStoredCredential(storedCredentials)
278
+ .execute();
279
+ assertCheckEnrollment3DSV2(t, secureEcom);
280
+ });
281
+ test("card holder enrolled challenge required v2 - all sources", async (t) => {
282
+ Promise.all(Object.values(src_1.AuthenticationSource).map(async (value) => {
283
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
284
+ .withCurrency(currency)
285
+ .withAmount(amount)
286
+ .withAuthenticationSource(value)
287
+ .execute();
288
+ assertCheckEnrollment3DSV2(t, secureEcom);
289
+ }));
290
+ });
291
+ test("card holder enrolled challenge required v2 - with null payment method", async (t) => {
292
+ // below validation is not working on PHP and node has another error
293
+ // this.validations
294
+ // .of("transactionType", TransactionType.VerifyEnrolled)
295
+ // .check("paymentMethod")
296
+ // .isNotNull();
297
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.checkEnrollment(card)
298
+ .withCurrency(currency)
299
+ .withPaymentMethod(null)
300
+ .withAmount(amount)
301
+ .execute(), {
302
+ instanceOf: src_1.BuilderError,
303
+ });
304
+ t.truthy(error);
305
+ if (error) {
306
+ // t.is("40007", error?.responseCode);
307
+ // t.is(
308
+ // error.message.includes(
309
+ // "Status Code: INVALID_REQUEST_DATA - Request expects the following conditionally mandatory fields number,expiry_month,expiry_year.",
310
+ // ),
311
+ // true,
312
+ // );
313
+ t.is(error.message.includes("paymentMethod cannot be null for this transaction type."), true);
314
+ }
315
+ });
316
+ test("card holder enrolled frictionless v2", async (t) => {
317
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
318
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
319
+ .withCurrency(currency)
320
+ .withAmount(amount)
321
+ .execute();
322
+ assertCheckEnrollment3DSV2(t, secureEcom);
323
+ });
324
+ test("card holder enrolled frictionless v2 - with idempotency key", async (t) => {
325
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
326
+ const idempotencyKey = src_1.GenerationUtils.getGuuid();
327
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
328
+ .withCurrency(currency)
329
+ .withIdempotencyKey(idempotencyKey)
330
+ .withAmount(amount)
331
+ .execute();
332
+ assertCheckEnrollment3DSV2(t, secureEcom);
333
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.checkEnrollment(card)
334
+ .withCurrency(currency)
335
+ .withIdempotencyKey(idempotencyKey)
336
+ .withAmount(amount)
337
+ .execute(), {
338
+ instanceOf: src_1.GatewayError,
339
+ });
340
+ t.truthy(error);
341
+ if (error) {
342
+ t.is("40039", error.responseCode);
343
+ t.is(error.responseMessage.includes("Idempotency Key seen before"), true);
344
+ }
345
+ });
346
+ test("card holder enrolled frictionless v2 - with tokenized card", async (t) => {
347
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
348
+ const response = await card.tokenize().execute();
349
+ const tokenizedCard = new src_1.CreditCardData();
350
+ tokenizedCard.token = response.token;
351
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
352
+ .withCurrency(currency)
353
+ .withAmount(amount)
354
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
355
+ .execute();
356
+ assertCheckEnrollment3DSV2(t, secureEcom);
357
+ });
358
+ test("card holder enrolled frictionless v2 - all preference values", async (t) => {
359
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
360
+ Promise.all(Object.values(src_1.ChallengeRequestIndicator).map(async (value) => {
361
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
362
+ .withCurrency(currency)
363
+ .withAmount(amount)
364
+ .withChallengeRequestIndicator(value)
365
+ .execute();
366
+ assertCheckEnrollment3DSV2(t, secureEcom);
367
+ }));
368
+ });
369
+ test("card holder enrolled frictionless v2 - stored credentials", async (t) => {
370
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
371
+ const storedCredentials = new src_1.StoredCredential();
372
+ storedCredentials.initiator = src_1.EnumMapping.mapStoredCredentialInitiator(gatewayProvider, src_1.StoredCredentialInitiator.Merchant);
373
+ storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
374
+ storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
375
+ storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
376
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
377
+ .withCurrency(currency)
378
+ .withAmount(amount)
379
+ .withStoredCredential(storedCredentials)
380
+ .execute();
381
+ assertCheckEnrollment3DSV2(t, secureEcom);
382
+ });
383
+ test("card holder enrolled frictionless v2 - all sources", async (t) => {
384
+ Promise.all(Object.values(src_1.AuthenticationSource).map(async (value) => {
385
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
386
+ .withCurrency(currency)
387
+ .withAmount(amount)
388
+ .withAuthenticationSource(value)
389
+ .execute();
390
+ assertCheckEnrollment3DSV2(t, secureEcom);
391
+ }));
392
+ });
393
+ test("card holder challenge required - post result", async (t) => {
394
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
395
+ .withCurrency(currency)
396
+ .withAmount(amount)
397
+ .execute();
398
+ assertCheckEnrollment3DSV2(t, secureEcom);
399
+ if (!(secureEcom instanceof src_1.Transaction)) {
400
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
401
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
402
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
403
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
404
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
405
+ .withAmount(amount)
406
+ .withCurrency(currency)
407
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
408
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
409
+ .withOrderCreateDate(formatedDate)
410
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
411
+ .withBrowserData(browserData)
412
+ .execute();
413
+ t.truthy(initAuth);
414
+ if (initAuth instanceof src_1.ThreeDSecure) {
415
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
416
+ t.truthy(initAuth.issuerAcsUrl);
417
+ t.truthy(initAuth.payerAuthenticationRequest);
418
+ const authClient = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
419
+ authClient.setGatewayProvider(gatewayProvider);
420
+ const authResponse = await authClient.authenticate_v2(initAuth);
421
+ if (authResponse instanceof AcsResponse_1.AcsResponse) {
422
+ t.true(authResponse.getStatus());
423
+ t.truthy(authResponse.getMerchantData());
424
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
425
+ .withServerTransactionId(authResponse.getMerchantData())
426
+ .withAmount(amount)
427
+ .execute();
428
+ card.threeDSecure = secureEcom2;
429
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
430
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
431
+ t.is("05", String(secureEcom2.eci));
432
+ t.is("2.1.0", secureEcom2.messageVersion);
433
+ t.truthy(secureEcom2.acsTransactionId);
434
+ t.truthy(secureEcom2.serverTransactionId);
435
+ t.truthy(secureEcom2.directoryServerTransactionId);
436
+ }
437
+ }
438
+ }
439
+ }
440
+ });
441
+ test("card holder challenge required - post result with idempotency key", async (t) => {
442
+ const idempotencyKey = src_1.GenerationUtils.getGuuid();
443
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
444
+ .withCurrency(currency)
445
+ .withAmount(amount)
446
+ .execute();
447
+ assertCheckEnrollment3DSV2(t, secureEcom);
448
+ if (!(secureEcom instanceof src_1.Transaction)) {
449
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
450
+ t.is(src_1.Secure3dVersion.TWO, secureEcom.getVersion());
451
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
452
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
453
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
454
+ .withAmount(amount)
455
+ .withCurrency(currency)
456
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
457
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
458
+ .withOrderCreateDate(formatedDate)
459
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
460
+ .withBrowserData(browserData)
461
+ .execute();
462
+ t.truthy(initAuth);
463
+ if (initAuth instanceof src_1.ThreeDSecure) {
464
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
465
+ t.truthy(initAuth.issuerAcsUrl);
466
+ t.truthy(initAuth.payerAuthenticationRequest);
467
+ const authClient = new ThreeDSecureAsClient_1.ThreeDSecureAcsClient(secureEcom.issuerAcsUrl);
468
+ authClient.setGatewayProvider(gatewayProvider);
469
+ const authResponse = await authClient.authenticate_v2(initAuth);
470
+ if (authResponse instanceof AcsResponse_1.AcsResponse) {
471
+ t.true(authResponse.getStatus());
472
+ t.truthy(authResponse.getMerchantData());
473
+ const secureEcom2 = await src_1.Secure3dService.getAuthenticationData()
474
+ .withServerTransactionId(authResponse.getMerchantData())
475
+ .withIdempotencyKey(idempotencyKey)
476
+ .withAmount(amount)
477
+ .execute();
478
+ card.threeDSecure = secureEcom2;
479
+ if (secureEcom2 instanceof src_1.ThreeDSecure) {
480
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, secureEcom2.status);
481
+ t.is("05", String(secureEcom2.eci));
482
+ t.is("2.1.0", secureEcom2.messageVersion);
483
+ t.truthy(secureEcom2.acsTransactionId);
484
+ t.truthy(secureEcom2.serverTransactionId);
485
+ t.truthy(secureEcom2.directoryServerTransactionId);
486
+ }
487
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.getAuthenticationData()
488
+ .withServerTransactionId(secureEcom2.serverTransactionId)
489
+ .withIdempotencyKey(idempotencyKey)
490
+ .execute(), {
491
+ instanceOf: src_1.GatewayError,
492
+ });
493
+ t.truthy(error);
494
+ if (error) {
495
+ t.is("40039", error.responseCode);
496
+ t.is(error.responseMessage.includes("Idempotency Key seen before"), true);
497
+ }
498
+ }
499
+ }
500
+ }
501
+ });
502
+ test("card holder challenge required - post result non existent id", async (t) => {
503
+ const transactionId = "AUT_" + src_1.GenerationUtils.getGuuid();
504
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.getAuthenticationData()
505
+ .withServerTransactionId(transactionId)
506
+ .execute(), {
507
+ instanceOf: src_1.GatewayError,
508
+ });
509
+ t.truthy(error);
510
+ if (error) {
511
+ t.is("40118", error.responseCode);
512
+ t.is(error.responseMessage.includes(`Authentication ${transactionId} not found at this location.`), true);
513
+ }
514
+ });
515
+ test("card holder challenge required - v2 initiate", async (t) => {
516
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
517
+ .withCurrency(currency)
518
+ .withAmount(amount)
519
+ .execute();
520
+ assertCheckEnrollment3DSV2(t, secureEcom);
521
+ if (secureEcom instanceof src_1.ThreeDSecure) {
522
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
523
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
524
+ .withAmount(amount)
525
+ .withCurrency(currency)
526
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
527
+ .withBrowserData(browserData)
528
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
529
+ .withOrderCreateDate(formatedDate)
530
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
531
+ .execute();
532
+ t.truthy(response);
533
+ assertInitiate3DSV2(t, response);
534
+ }
535
+ });
536
+ test("card holder challenge required - v2 initiate with idempotency key", async (t) => {
537
+ const idempotencyKey = src_1.GenerationUtils.getGuuid();
538
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
539
+ .withCurrency(currency)
540
+ .withAmount(amount)
541
+ .execute();
542
+ assertCheckEnrollment3DSV2(t, secureEcom);
543
+ if (secureEcom instanceof src_1.ThreeDSecure) {
544
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
545
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
546
+ .withAmount(amount)
547
+ .withCurrency(currency)
548
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
549
+ .withBrowserData(browserData)
550
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
551
+ .withOrderCreateDate(formatedDate)
552
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
553
+ .withIdempotencyKey(idempotencyKey)
554
+ .execute();
555
+ t.truthy(response);
556
+ assertInitiate3DSV2(t, response);
557
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
558
+ .withAmount(amount)
559
+ .withCurrency(currency)
560
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
561
+ .withBrowserData(browserData)
562
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
563
+ .withOrderCreateDate(formatedDate)
564
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
565
+ .withIdempotencyKey(idempotencyKey)
566
+ .execute(), {
567
+ instanceOf: src_1.GatewayError,
568
+ });
569
+ t.truthy(error);
570
+ if (error) {
571
+ t.is("40039", error.responseCode);
572
+ t.is(error.responseMessage.includes("Idempotency Key seen before"), true);
573
+ }
574
+ }
575
+ });
576
+ test("card holder challenge required - v2 initiate tokenized card", async (t) => {
577
+ const response = await card.tokenize().execute();
578
+ const tokenizedCard = new src_1.CreditCardData();
579
+ tokenizedCard.token = response.token;
580
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(tokenizedCard)
581
+ .withCurrency(currency)
582
+ .withAmount(amount)
583
+ .execute();
584
+ assertCheckEnrollment3DSV2(t, secureEcom);
585
+ if (secureEcom instanceof src_1.ThreeDSecure) {
586
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
587
+ const response = await src_1.Secure3dService.initiateAuthentication(tokenizedCard, secureEcom)
588
+ .withAmount(amount)
589
+ .withCurrency(currency)
590
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
591
+ .withBrowserData(browserData)
592
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
593
+ .withOrderCreateDate(formatedDate)
594
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
595
+ .execute();
596
+ t.truthy(response);
597
+ assertInitiate3DSV2(t, response);
598
+ }
599
+ });
600
+ test("card holder challenge required - v2 initiate method url set no", async (t) => {
601
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
602
+ .withCurrency(currency)
603
+ .withAmount(amount)
604
+ .execute();
605
+ assertCheckEnrollment3DSV2(t, secureEcom);
606
+ if (secureEcom instanceof src_1.ThreeDSecure) {
607
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
608
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
609
+ .withAmount(amount)
610
+ .withCurrency(currency)
611
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
612
+ .withBrowserData(browserData)
613
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.No)
614
+ .withOrderCreateDate(formatedDate)
615
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
616
+ .execute();
617
+ t.truthy(response);
618
+ assertInitiate3DSV2(t, response);
619
+ }
620
+ });
621
+ test("card holder challenge required - v2 initiate method url set unavailable", async (t) => {
622
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
623
+ .withCurrency(currency)
624
+ .withAmount(amount)
625
+ .execute();
626
+ assertCheckEnrollment3DSV2(t, secureEcom);
627
+ if (secureEcom instanceof src_1.ThreeDSecure) {
628
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
629
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
630
+ .withAmount(amount)
631
+ .withCurrency(currency)
632
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
633
+ .withBrowserData(browserData)
634
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Unavailable)
635
+ .withOrderCreateDate(formatedDate)
636
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
637
+ .execute();
638
+ t.truthy(response);
639
+ assertInitiate3DSV2(t, response);
640
+ }
641
+ });
642
+ test("card holder challenge required - v2 initiate without shipping address", async (t) => {
643
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
644
+ .withCurrency(currency)
645
+ .withAmount(amount)
646
+ .execute();
647
+ assertCheckEnrollment3DSV2(t, secureEcom);
648
+ if (secureEcom instanceof src_1.ThreeDSecure) {
649
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
650
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
651
+ .withAmount(amount)
652
+ .withCurrency(currency)
653
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
654
+ .withBrowserData(browserData)
655
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
656
+ .withOrderCreateDate(formatedDate)
657
+ .execute();
658
+ t.truthy(response);
659
+ assertInitiate3DSV2(t, response);
660
+ }
661
+ });
662
+ test("card holder challenge required - v2 initiate with gift card", async (t) => {
663
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
664
+ .withCurrency(currency)
665
+ .withAmount(amount)
666
+ .execute();
667
+ assertCheckEnrollment3DSV2(t, secureEcom);
668
+ if (secureEcom instanceof src_1.ThreeDSecure) {
669
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
670
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
671
+ .withAmount(amount)
672
+ .withCurrency(currency)
673
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
674
+ .withBrowserData(browserData)
675
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
676
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
677
+ .withOrderCreateDate(formatedDate)
678
+ .withGiftCardAmount(2)
679
+ .withGiftCardCount(1)
680
+ .withGiftCardCurrency(currency)
681
+ .execute();
682
+ t.truthy(response);
683
+ assertInitiate3DSV2(t, response);
684
+ }
685
+ });
686
+ test("card holder challenge required - v2 initiate with shipping method", async (t) => {
687
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
688
+ .withCurrency(currency)
689
+ .withAmount(amount)
690
+ .execute();
691
+ assertCheckEnrollment3DSV2(t, secureEcom);
692
+ if (secureEcom instanceof src_1.ThreeDSecure) {
693
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
694
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
695
+ .withAmount(amount)
696
+ .withCurrency(currency)
697
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
698
+ .withBrowserData(browserData)
699
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
700
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
701
+ .withShippingMethod(src_1.ShippingMethod.DigitalGoods)
702
+ .withOrderCreateDate(formatedDate)
703
+ .execute();
704
+ t.truthy(response);
705
+ assertInitiate3DSV2(t, response);
706
+ }
707
+ });
708
+ test("card holder challenge required - v2 initiate with delivery email", async (t) => {
709
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
710
+ .withCurrency(currency)
711
+ .withAmount(amount)
712
+ .execute();
713
+ assertCheckEnrollment3DSV2(t, secureEcom);
714
+ if (secureEcom instanceof src_1.ThreeDSecure) {
715
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
716
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
717
+ .withAmount(amount)
718
+ .withCurrency(currency)
719
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
720
+ .withBrowserData(browserData)
721
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
722
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
723
+ .withDeliveryEmail("james.mason@example.com")
724
+ .withDeliveryTimeFrame(src_1.DeliveryTimeFrame.SameDay)
725
+ .withOrderCreateDate(formatedDate)
726
+ .execute();
727
+ t.truthy(response);
728
+ assertInitiate3DSV2(t, response);
729
+ }
730
+ });
731
+ test("card holder challenge required - v2 initiate all preference values", async (t) => {
732
+ Promise.all(Object.values(src_1.ChallengeRequestIndicator).map(async (value) => {
733
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
734
+ .withCurrency(currency)
735
+ .withAmount(amount)
736
+ .execute();
737
+ assertCheckEnrollment3DSV2(t, secureEcom);
738
+ if (secureEcom instanceof src_1.ThreeDSecure) {
739
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
740
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
741
+ .withAmount(amount)
742
+ .withCurrency(currency)
743
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
744
+ .withBrowserData(browserData)
745
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
746
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
747
+ .withChallengeRequestIndicator(value)
748
+ .withOrderCreateDate(formatedDate)
749
+ .execute();
750
+ t.truthy(response);
751
+ assertInitiate3DSV2(t, response);
752
+ }
753
+ }));
754
+ });
755
+ test("card holder challenge required - v2 initiate all source values", async (t) => {
756
+ // fails 'MERCHANT_INITIATED and STORED_RECURRING failing, issue raised with UCP team.'
757
+ Promise.all(Object.values(src_1.AuthenticationSource).map(async (value) => {
758
+ const storedCredentials = new src_1.StoredCredential();
759
+ storedCredentials.initiator = src_1.EnumMapping.mapStoredCredentialInitiator(gatewayProvider, src_1.StoredCredentialInitiator.Payer);
760
+ storedCredentials.type = src_1.StoredCredentialType.SPLIT_OR_DELAYED_SHIPMENT;
761
+ storedCredentials.sequence = src_1.StoredCredentialSequence.FIRST;
762
+ storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
763
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
764
+ .withCurrency(currency)
765
+ .withAmount(amount)
766
+ .withAuthenticationSource(value)
767
+ .withStoredCredential(storedCredentials)
768
+ .execute();
769
+ assertCheckEnrollment3DSV2(t, secureEcom);
770
+ if (secureEcom instanceof src_1.ThreeDSecure) {
771
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
772
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
773
+ .withAmount(amount)
774
+ .withCurrency(currency)
775
+ .withAuthenticationSource(value)
776
+ .withBrowserData(browserData)
777
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
778
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
779
+ .withOrderCreateDate(formatedDate)
780
+ .withStoredCredential(storedCredentials)
781
+ .execute();
782
+ t.truthy(response);
783
+ assertInitiate3DSV2(t, response);
784
+ }
785
+ }));
786
+ });
787
+ test("card holder enrolled challenge required - frictionless - v2 initiate", async (t) => {
788
+ card.number = Data_1.GpApi3DSTestCards.CARD_AUTH_SUCCESSFUL_V2_2;
789
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
790
+ .withCurrency(currency)
791
+ .withAmount(amount)
792
+ .execute();
793
+ assertCheckEnrollment3DSV2(t, secureEcom);
794
+ if (secureEcom instanceof src_1.ThreeDSecure) {
795
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
796
+ const initAuth = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
797
+ .withAmount(amount)
798
+ .withCurrency(currency)
799
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
800
+ .withBrowserData(browserData)
801
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
802
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
803
+ .withShippingMethod(src_1.ShippingMethod.DigitalGoods)
804
+ .withOrderCreateDate(formatedDate)
805
+ .execute();
806
+ t.truthy(initAuth);
807
+ if (initAuth instanceof src_1.ThreeDSecure) {
808
+ t.is(src_1.Secure3dStatus.SuccessAuthenticated, initAuth.status);
809
+ t.truthy(initAuth.issuerAcsUrl);
810
+ t.truthy(initAuth.payerAuthenticationRequest);
811
+ t.truthy(initAuth.acsTransactionId);
812
+ t.truthy(initAuth.providerServerTransRef);
813
+ t.truthy(initAuth.acsReferenceNumber);
814
+ t.is("05", String(initAuth.eci));
815
+ t.is("2.2.0", initAuth.messageVersion);
816
+ }
817
+ }
818
+ });
819
+ test("card holder enrolled challenge required - frictionless - v2 initiate without payment method", async (t) => {
820
+ const card = new src_1.CreditCardData();
821
+ const secureEcom = new src_1.ThreeDSecure();
822
+ secureEcom.serverTransactionId = "AUT_" + src_1.GenerationUtils.getGuuid();
823
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
824
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
825
+ .withAmount(amount)
826
+ .withCurrency(currency)
827
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
828
+ .withBrowserData(browserData)
829
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
830
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
831
+ .withShippingMethod(src_1.ShippingMethod.DigitalGoods)
832
+ .withOrderCreateDate(formatedDate)
833
+ .execute(), {
834
+ instanceOf: src_1.GatewayError,
835
+ });
836
+ t.truthy(error);
837
+ if (error) {
838
+ t.is("40005", error.responseCode);
839
+ t.is(error.responseMessage.includes("Request expects the following fields number"), true);
840
+ }
841
+ });
842
+ test("card holder enrolled challenge required - v2 initiate non existent id", async (t) => {
843
+ const secureEcom = new src_1.ThreeDSecure();
844
+ secureEcom.serverTransactionId = "AUT_" + src_1.GenerationUtils.getGuuid();
845
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
846
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
847
+ .withAmount(amount)
848
+ .withCurrency(currency)
849
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
850
+ .withBrowserData(browserData)
851
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
852
+ .withOrderCreateDate(formatedDate)
853
+ .execute(), {
854
+ instanceOf: src_1.GatewayError,
855
+ });
856
+ t.truthy(error);
857
+ if (error) {
858
+ t.is("40118", error.responseCode);
859
+ t.is(error.responseMessage.includes(`Authentication ${secureEcom.serverTransactionId} not found at this location.`), true);
860
+ }
861
+ });
862
+ test("challenge required v2 - initiate with mobile sdk", async (t) => {
863
+ card.number = Data_1.GpApi3DSTestCards.CARD_CHALLENGE_REQUIRED_V2_1;
864
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
865
+ .withCurrency(currency)
866
+ .withAmount(amount)
867
+ .execute();
868
+ assertCheckEnrollment3DSV2(t, secureEcom);
869
+ const mobileData = new src_1.MobileData();
870
+ mobileData.encodedData =
871
+ "ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K";
872
+ mobileData.applicationReference = "f283b3ec-27da-42a1-acea-f3f70e75bbdc";
873
+ mobileData.sdkInterface = src_1.SdkInterface.Both;
874
+ mobileData.sdkUiTypes = [src_1.SdkUiType.Oob];
875
+ mobileData.ephemeralPublicKey = `{
876
+ "kty": "EC",
877
+ "crv": "P-256",
878
+ "x": "WWcpTjbOqiu_1aODllw5rYTq5oLXE_T0huCPjMIRbkI",
879
+ "y": "Wz_7anIeadV8SJZUfr4drwjzuWoUbOsHp5GdRZBAAiw"
880
+ }`;
881
+ mobileData.maximumTimeout = 50;
882
+ mobileData.referenceNumber = "3DS_LOA_SDK_PPFU_020100_00007";
883
+ mobileData.sdkTransReference = "b2385523-a66c-4907-ac3c-91848e8c0067";
884
+ if (secureEcom instanceof src_1.ThreeDSecure) {
885
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
886
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
887
+ .withAmount(amount)
888
+ .withCurrency(currency)
889
+ .withAuthenticationSource(src_1.AuthenticationSource.MobileSdk)
890
+ .withMobileData(mobileData)
891
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
892
+ .withOrderCreateDate(formatedDate)
893
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
894
+ .execute();
895
+ t.truthy(response);
896
+ assertInitiate3DSV2(t, response);
897
+ t.truthy(response.payerAuthenticationRequest);
898
+ t.truthy(response.acsInterface);
899
+ t.truthy(response.acsUiTemplate);
900
+ t.truthy(response.providerServerTransRef);
901
+ t.is("NATIVE", response.acsInterface);
902
+ t.is("OUT_OF_BAND", response.acsUiTemplate);
903
+ }
904
+ });
905
+ test("challenge required v2 - initiate with mobile data and browser data", async (t) => {
906
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
907
+ .withCurrency(currency)
908
+ .withAmount(amount)
909
+ .execute();
910
+ assertCheckEnrollment3DSV2(t, secureEcom);
911
+ const mobileData = new src_1.MobileData();
912
+ mobileData.encodedData =
913
+ "ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K";
914
+ mobileData.applicationReference = "f283b3ec-27da-42a1-acea-f3f70e75bbdc";
915
+ mobileData.sdkInterface = src_1.SdkInterface.Browser;
916
+ mobileData.sdkUiTypes = [src_1.SdkUiType.HtmlOther];
917
+ mobileData.ephemeralPublicKey = `{
918
+ "kty": "EC",
919
+ "crv": "P-256",
920
+ "x": "WWcpTjbOqiu_1aODllw5rYTq5oLXE_T0huCPjMIRbkI",
921
+ "y": "Wz_7anIeadV8SJZUfr4drwjzuWoUbOsHp5GdRZBAAiw"
922
+ }`;
923
+ mobileData.maximumTimeout = 50;
924
+ mobileData.referenceNumber = "3DS_LOA_SDK_PPFU_020100_00007";
925
+ mobileData.sdkTransReference = "b2385523-a66c-4907-ac3c-91848e8c0067";
926
+ if (secureEcom instanceof src_1.ThreeDSecure) {
927
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
928
+ const response = await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
929
+ .withAmount(amount)
930
+ .withCurrency(currency)
931
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
932
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
933
+ .withOrderCreateDate(formatedDate)
934
+ .withMobileData(mobileData)
935
+ .withBrowserData(browserData)
936
+ .withAddress(shippingAddress, src_1.AddressType.Shipping)
937
+ .execute();
938
+ t.truthy(response);
939
+ assertInitiate3DSV2(t, response);
940
+ }
941
+ });
942
+ test("challenge required v2 - initiate with mobile data and source browser", async (t) => {
943
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
944
+ .withCurrency(currency)
945
+ .withAmount(amount)
946
+ .execute();
947
+ assertCheckEnrollment3DSV2(t, secureEcom);
948
+ const mobileData = new src_1.MobileData();
949
+ mobileData.encodedData =
950
+ "ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K";
951
+ mobileData.applicationReference = "f283b3ec-27da-42a1-acea-f3f70e75bbdc";
952
+ mobileData.sdkInterface = src_1.SdkInterface.Browser;
953
+ mobileData.sdkUiTypes = [src_1.SdkUiType.HtmlOther];
954
+ mobileData.ephemeralPublicKey = `{
955
+ "kty": "EC",
956
+ "crv": "P-256",
957
+ "x": "WWcpTjbOqiu_1aODllw5rYTq5oLXE_T0huCPjMIRbkI",
958
+ "y": "Wz_7anIeadV8SJZUfr4drwjzuWoUbOsHp5GdRZBAAiw"
959
+ }`;
960
+ mobileData.maximumTimeout = 50;
961
+ mobileData.referenceNumber = "3DS_LOA_SDK_PPFU_020100_00007";
962
+ mobileData.sdkTransReference = "b2385523-a66c-4907-ac3c-91848e8c0067";
963
+ if (secureEcom instanceof src_1.ThreeDSecure) {
964
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
965
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
966
+ .withAmount(amount)
967
+ .withCurrency(currency)
968
+ .withAuthenticationSource(src_1.AuthenticationSource.Browser)
969
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
970
+ .withOrderCreateDate(formatedDate)
971
+ .withMobileData(mobileData)
972
+ .execute(), {
973
+ instanceOf: src_1.GatewayError,
974
+ });
975
+ t.truthy(error);
976
+ if (error) {
977
+ t.is("40233", error.responseCode);
978
+ t.is(error.responseMessage.includes("Required Data Element browser_data"), true);
979
+ }
980
+ }
981
+ });
982
+ test("challenge required v2 - initiate with source mobile SDK without mobile data", async (t) => {
983
+ const secureEcom = await src_1.Secure3dService.checkEnrollment(card)
984
+ .withCurrency(currency)
985
+ .withAmount(amount)
986
+ .execute();
987
+ assertCheckEnrollment3DSV2(t, secureEcom);
988
+ if (secureEcom instanceof src_1.ThreeDSecure) {
989
+ const formatedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
990
+ const error = await t.throwsAsync(async () => await src_1.Secure3dService.initiateAuthentication(card, secureEcom)
991
+ .withAmount(amount)
992
+ .withCurrency(currency)
993
+ .withAuthenticationSource(src_1.AuthenticationSource.MobileSdk)
994
+ .withMethodUrlCompletion(src_1.MethodUrlCompletion.Yes)
995
+ .withOrderCreateDate(formatedDate)
996
+ .execute(), {
997
+ instanceOf: src_1.GatewayError,
998
+ });
999
+ t.truthy(error);
1000
+ if (error) {
1001
+ t.is("40233", error.responseCode);
1002
+ t.is(error.responseMessage.includes("Required Data Element sdk_information"), true);
1003
+ }
1004
+ }
1005
+ });
1006
+ const assertCheckEnrollment3DSV2 = (t, secureEcom) => {
1007
+ t.truthy(secureEcom);
1008
+ if (!(secureEcom instanceof src_1.Transaction)) {
1009
+ t.is(src_1.Secure3dStatus.Enrolled, secureEcom?.enrolled);
1010
+ t.is(src_1.Secure3dVersion.TWO, secureEcom?.getVersion());
1011
+ t.is(src_1.Secure3dStatus.Available, secureEcom.status);
1012
+ t.truthy(secureEcom.issuerAcsUrl);
1013
+ t.truthy(secureEcom.payerAuthenticationRequest);
1014
+ t.falsy(secureEcom.eci);
1015
+ }
1016
+ };
1017
+ const assertInitiate3DSV2 = (t, initAuth) => {
1018
+ t.truthy(initAuth);
1019
+ if (!(initAuth instanceof src_1.Transaction)) {
1020
+ t.is(src_1.Secure3dStatus.ChallengeRequired, initAuth.status);
1021
+ t.is("2.1.0", initAuth.messageVersion);
1022
+ t.truthy(initAuth.issuerAcsUrl);
1023
+ t.truthy(initAuth.payerAuthenticationRequest);
1024
+ t.truthy(initAuth.acsTransactionId);
1025
+ t.falsy(initAuth.eci);
1026
+ }
1027
+ };
1028
+ test.after(() => Data_1.BaseGpApiTestConfig.resetGpApiConfig());
1029
+ //# sourceMappingURL=3DS2Test.js.map