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