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