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