globalpayments-api 3.6.2-fix → 3.6.2

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