globalpayments-api 3.10.0 → 3.10.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 (214) hide show
  1. package/CHANGELOG.md +184 -170
  2. package/appsec.properties +8 -0
  3. package/lib/src/Entities/index.d.ts +4 -0
  4. package/lib/src/Entities/index.js +4 -0
  5. package/lib/src/Entities/index.js.map +1 -1
  6. package/lib/src/Gateways/PorticoConnector.d.ts +3 -3
  7. package/lib/src/Gateways/PorticoConnector.js +24 -0
  8. package/lib/src/Gateways/PorticoConnector.js.map +1 -1
  9. package/lib/src/Gateways/RealexConnector.d.ts +30 -0
  10. package/lib/src/Gateways/RealexConnector.js +523 -0
  11. package/lib/src/PaymentMethods/Credit.d.ts +2 -1
  12. package/lib/src/PaymentMethods/Credit.js +1 -0
  13. package/lib/src/PaymentMethods/Credit.js.map +1 -1
  14. package/lib/src/ServicesConfig.d.ts +27 -0
  15. package/lib/src/ServicesConfig.js +50 -0
  16. package/lib/test/Integration/Gateways/GpApiConnector/3DS2.test.js +15 -15
  17. package/lib/test/Integration/Gateways/GpApiConnector/3DSecure.test.js +5 -5
  18. package/lib/test/Integration/Gateways/GpEcomConnector/Credit.test.js +4 -4
  19. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.d.ts +1 -1
  20. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +112 -59
  21. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +1 -1
  22. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +483 -378
  23. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +1 -1
  24. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +83 -86
  25. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +1 -1
  26. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +1720 -1723
  27. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +1 -1
  28. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +83 -86
  29. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +1 -1
  30. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +1757 -1760
  31. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +1 -1
  32. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +682 -420
  33. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +1 -1
  34. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +2218 -2221
  35. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js +36 -8
  36. package/lib/test/Integration/Gateways/PorticoConnector/Credit.test.js.map +1 -1
  37. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +1 -1
  38. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +707 -392
  39. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +1 -1
  40. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +151 -88
  41. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +1 -1
  42. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +171 -72
  43. package/lib/test/Integration/Gateways/PorticoConnector/Ecommerce.test.js +8 -8
  44. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +1 -1
  45. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +192 -143
  46. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +1 -1
  47. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +377 -147
  48. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +1 -1
  49. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +196 -101
  50. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +1 -1
  51. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +53 -50
  52. package/lib/test/Integration/Gateways/{GpApiConnector/3DS2Test.d.ts → ProPayConnector/Certifications/GetInformationCertificationTests.d.ts} +1 -1
  53. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTests.js +100 -0
  54. package/lib/test/Integration/Gateways/{GpApiConnector/AccessTokenTest.d.ts → ProPayConnector/Certifications/ProPayAccountCertificationTests.d.ts} +1 -1
  55. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTests.js +352 -0
  56. package/lib/test/Integration/Gateways/{GpApiConnector/CreditCardNotPresentTest.d.ts → ProPayConnector/Certifications/ProPayFundCertificationTests.d.ts} +1 -1
  57. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTests.js +123 -0
  58. package/lib/test/Integration/Gateways/{GpApiConnector/3DSecureTest.d.ts → ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.d.ts} +1 -1
  59. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTests.js +142 -0
  60. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.d.ts +1 -0
  61. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTests.js +100 -0
  62. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.d.ts +1 -0
  63. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTests.js +535 -0
  64. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.d.ts +1 -0
  65. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTests.js +124 -0
  66. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.d.ts +1 -0
  67. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTests.js +144 -0
  68. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/AuthTest.d.ts +1 -1
  69. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.js +4373 -0
  70. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/AvsTest.d.ts +1 -1
  71. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.js +758 -0
  72. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/CreditTest.d.ts +1 -1
  73. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.js +2399 -0
  74. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/Certification/HoldTest.d.ts +1 -1
  75. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.js +1656 -0
  76. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.d.ts +1 -0
  77. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.js +5650 -0
  78. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.d.ts +1 -0
  79. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.js +1985 -0
  80. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.d.ts +1 -0
  81. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.js +2369 -0
  82. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.d.ts +1 -0
  83. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.js +1703 -0
  84. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.d.ts +1 -0
  85. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.js +2053 -0
  86. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.d.ts +1 -0
  87. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.js +2469 -0
  88. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.d.ts +1 -0
  89. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.js +3116 -0
  90. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.d.ts +1 -0
  91. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.js +2031 -0
  92. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/CreditTest.d.ts +1 -1
  93. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.js +322 -0
  94. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/HppTest.d.ts +1 -1
  95. package/lib/test/Integration/Gateways/RealexConnector/HppTest.js +98 -0
  96. package/lib/test/Integration/Gateways/{GpEcomConnector → RealexConnector}/RecurringTest.d.ts +1 -1
  97. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.js +263 -0
  98. package/lib/test/Integration/Services/CheckServiceTest.d.ts +1 -1
  99. package/lib/test/Integration/Services/CheckServiceTest.js +98 -45
  100. package/lib/test/Integration/Services/CreditServiceTest.d.ts +1 -1
  101. package/lib/test/Integration/Services/CreditServiceTest.js +313 -174
  102. package/lib/test/Integration/Services/DebitServiceTest.d.ts +1 -1
  103. package/lib/test/Integration/Services/DebitServiceTest.js +154 -81
  104. package/lib/test/Integration/Services/EBTServiceTest.d.ts +1 -1
  105. package/lib/test/Integration/Services/EBTServiceTest.js +135 -64
  106. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +1 -1
  107. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +161 -111
  108. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +1 -1
  109. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +139 -62
  110. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +1 -1
  111. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +202 -125
  112. package/lib/test/Unit/Gateways/{GpEcomConnector → RealexConnector}/CreditTest.d.ts +1 -1
  113. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.js +29 -0
  114. package/package.json +62 -62
  115. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js +0 -1029
  116. package/lib/test/Integration/Gateways/GpApiConnector/3DS2Test.js.map +0 -1
  117. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js +0 -649
  118. package/lib/test/Integration/Gateways/GpApiConnector/3DSecureTest.js.map +0 -1
  119. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js +0 -109
  120. package/lib/test/Integration/Gateways/GpApiConnector/AccessTokenTest.js.map +0 -1
  121. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js +0 -1025
  122. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardNotPresentTest.js.map +0 -1
  123. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.d.ts +0 -1
  124. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js +0 -439
  125. package/lib/test/Integration/Gateways/GpApiConnector/CreditCardPresentTest.js.map +0 -1
  126. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.d.ts +0 -1
  127. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js +0 -143
  128. package/lib/test/Integration/Gateways/GpApiConnector/DebitCardTest.js.map +0 -1
  129. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.d.ts +0 -1
  130. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js +0 -639
  131. package/lib/test/Integration/Gateways/GpApiConnector/GpApiCertificationTest.js.map +0 -1
  132. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.d.ts +0 -1
  133. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js +0 -149
  134. package/lib/test/Integration/Gateways/GpApiConnector/GpApiTokenManagementTest.js.map +0 -1
  135. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.d.ts +0 -1
  136. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js +0 -226
  137. package/lib/test/Integration/Gateways/GpApiConnector/ReportingDepositsTest.js.map +0 -1
  138. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.d.ts +0 -1
  139. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js +0 -434
  140. package/lib/test/Integration/Gateways/GpApiConnector/ReportingSettlementTransactionsTest.js.map +0 -1
  141. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.d.ts +0 -1
  142. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js +0 -217
  143. package/lib/test/Integration/Gateways/GpApiConnector/ReportingStoredPaymentMethodsTest.js.map +0 -1
  144. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.d.ts +0 -1
  145. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js +0 -338
  146. package/lib/test/Integration/Gateways/GpApiConnector/ReportingTransactionsTest.js.map +0 -1
  147. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js +0 -2446
  148. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AuthTest.js.map +0 -1
  149. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js +0 -506
  150. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/AvsTest.js.map +0 -1
  151. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js +0 -1296
  152. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/CreditTest.js.map +0 -1
  153. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js +0 -847
  154. package/lib/test/Integration/Gateways/GpEcomConnector/Certification/HoldTest.js.map +0 -1
  155. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js +0 -215
  156. package/lib/test/Integration/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
  157. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js +0 -99
  158. package/lib/test/Integration/Gateways/GpEcomConnector/HppTest.js.map +0 -1
  159. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js +0 -133
  160. package/lib/test/Integration/Gateways/GpEcomConnector/RecurringTest.js.map +0 -1
  161. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js.map +0 -1
  162. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js.map +0 -1
  163. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js.map +0 -1
  164. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js.map +0 -1
  165. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js.map +0 -1
  166. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js.map +0 -1
  167. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js.map +0 -1
  168. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js.map +0 -1
  169. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js.map +0 -1
  170. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js.map +0 -1
  171. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js.map +0 -1
  172. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js.map +0 -1
  173. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js.map +0 -1
  174. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.d.ts +0 -1
  175. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js +0 -48
  176. package/lib/test/Integration/Gateways/PorticoConnector/PorticoManagementTokenTest.js.map +0 -1
  177. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js.map +0 -1
  178. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js.map +0 -1
  179. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.d.ts +0 -1
  180. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js +0 -44
  181. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/GetInformationCertificationTest.js.map +0 -1
  182. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.d.ts +0 -1
  183. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js +0 -221
  184. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayAccountCertificationTest.js.map +0 -1
  185. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.d.ts +0 -1
  186. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js +0 -60
  187. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayFundCertificationTest.js.map +0 -1
  188. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.d.ts +0 -1
  189. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js +0 -80
  190. package/lib/test/Integration/Gateways/ProPayConnector/Certifications/ProPayInNetworkTransactionCertificationTest.js.map +0 -1
  191. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.d.ts +0 -1
  192. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js +0 -44
  193. package/lib/test/Integration/Gateways/ProPayConnector/GetInformationTest.js.map +0 -1
  194. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.d.ts +0 -1
  195. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js +0 -330
  196. package/lib/test/Integration/Gateways/ProPayConnector/ProPayAccountTest.js.map +0 -1
  197. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.d.ts +0 -1
  198. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js +0 -60
  199. package/lib/test/Integration/Gateways/ProPayConnector/ProPayFundsTest.js.map +0 -1
  200. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.d.ts +0 -1
  201. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js +0 -80
  202. package/lib/test/Integration/Gateways/ProPayConnector/ProPayInNetworkTransactionTest.js.map +0 -1
  203. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.d.ts +0 -1
  204. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js +0 -149
  205. package/lib/test/Integration/Gateways/Terminals/UPA/UpaMicTest.js.map +0 -1
  206. package/lib/test/Integration/Services/CheckServiceTest.js.map +0 -1
  207. package/lib/test/Integration/Services/CreditServiceTest.js.map +0 -1
  208. package/lib/test/Integration/Services/DebitServiceTest.js.map +0 -1
  209. package/lib/test/Integration/Services/EBTServiceTest.js.map +0 -1
  210. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js.map +0 -1
  211. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js.map +0 -1
  212. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js +0 -34
  213. package/lib/test/Unit/Gateways/GpEcomConnector/CreditTest.js.map +0 -1
  214. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js.map +0 -1
@@ -1,1025 +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 BaseGpApiTestConfig_1 = require("../../../Data/BaseGpApiTestConfig");
9
- const DTO_1 = require("../../../../src/Entities/GpApi/DTO");
10
- const runSerially = true;
11
- const test = runSerially ? ava_1.default.serial : ava_1.default;
12
- const date = new Date();
13
- const currency = "USD";
14
- const card = new src_1.CreditCardData();
15
- card.number = "4263970000005262";
16
- card.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
17
- card.expYear = (date.getFullYear() + 1).toString();
18
- card.cvn = "131";
19
- card.cardHolderName = "James Mason";
20
- test.beforeEach(() => {
21
- src_1.ServicesContainer.configureService(BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent));
22
- });
23
- test("credit sale", async (t) => {
24
- const address = new src_1.Address();
25
- address.streetAddress1 = "123 Main St.";
26
- address.city = "Dallas";
27
- address.state = "TX";
28
- address.postalCode = "98765";
29
- address.country = "USA";
30
- const response = await card
31
- .charge(69)
32
- .withCurrency(currency)
33
- .withAddress(address)
34
- .execute();
35
- t.truthy(response);
36
- t.is("SUCCESS", response.responseCode);
37
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
38
- t.falsy(response.payerDetails);
39
- t.is("123456", response.authorizationCode);
40
- });
41
- test("credit sale with fingerprint", async (t) => {
42
- const address = new src_1.Address();
43
- address.streetAddress1 = "123 Main St.";
44
- address.city = "Dallas";
45
- address.state = "TX";
46
- address.postalCode = "98765";
47
- address.country = "USA";
48
- const customer = new src_1.Customer();
49
- customer.deviceFingerPrint = "ALWAYS";
50
- const response = await card
51
- .charge(69)
52
- .withCurrency(currency)
53
- .withAddress(address)
54
- .withCustomerData(customer)
55
- .execute();
56
- t.truthy(response);
57
- t.is("SUCCESS", response.responseCode);
58
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
59
- t.truthy(response.fingerprint);
60
- t.truthy(response.fingerprintIndicator);
61
- t.is("123456", response.authorizationCode);
62
- });
63
- test("credit sale with fingerprint success", async (t) => {
64
- const customer = new src_1.Customer();
65
- customer.deviceFingerPrint = "ON_SUCCESS";
66
- const response = await card
67
- .charge(69)
68
- .withCurrency(currency)
69
- .withCustomerData(customer)
70
- .execute();
71
- t.truthy(response);
72
- t.is("SUCCESS", response.responseCode);
73
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
74
- t.truthy(response.fingerprint);
75
- t.truthy(response.fingerprintIndicator);
76
- t.is("00", response.cardIssuerResponse.result);
77
- });
78
- test("credit authorization", async (t) => {
79
- const response = await card
80
- .authorize(42)
81
- .withCurrency(currency)
82
- .withAllowDuplicates(true)
83
- .execute();
84
- t.truthy(response);
85
- t.is("SUCCESS", response.responseCode);
86
- t.is(src_1.TransactionStatus.PREAUTHORIZED, response.responseMessage);
87
- t.falsy(response.payerDetails);
88
- });
89
- test("credit authorization then capture", async (t) => {
90
- const transaction = await card
91
- .authorize(42)
92
- .withCurrency(currency)
93
- .withOrderId("123456-78910")
94
- .withAllowDuplicates(true)
95
- .execute();
96
- t.truthy(transaction);
97
- t.is("SUCCESS", transaction.responseCode);
98
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
99
- t.is("123456", transaction.authorizationCode);
100
- const capture = await transaction.capture(30).withGratuity(12).execute();
101
- t.truthy(capture);
102
- t.is("SUCCESS", capture.responseCode);
103
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
104
- t.is("000000", capture.authorizationCode);
105
- });
106
- test("credit authorization then capture with fingerprint", async (t) => {
107
- const customer = new src_1.Customer();
108
- customer.deviceFingerPrint = "ON_SUCCESS";
109
- const transaction = await card
110
- .authorize(42)
111
- .withCurrency(currency)
112
- .withOrderId("123456-78910")
113
- .withAllowDuplicates(true)
114
- .withCustomerData(customer)
115
- .execute();
116
- t.truthy(transaction);
117
- t.is("SUCCESS", transaction.responseCode);
118
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
119
- t.truthy(transaction.fingerprint);
120
- t.truthy(transaction.fingerprintIndicator);
121
- const capture = await transaction.capture(30).withGratuity(12).execute();
122
- t.truthy(capture);
123
- t.is("SUCCESS", capture.responseCode);
124
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
125
- });
126
- test("credit authorization then capture with idempotency", async (t) => {
127
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
128
- const transaction = await card
129
- .authorize(42)
130
- .withCurrency(currency)
131
- .withIdempotencyKey(idempotencyKey)
132
- .withAllowDuplicates(true)
133
- .execute();
134
- t.truthy(transaction);
135
- t.is("SUCCESS", transaction.responseCode);
136
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
137
- const error = await t.throwsAsync(async () => await transaction
138
- .capture(30)
139
- .withIdempotencyKey(idempotencyKey)
140
- .withGratuity(12)
141
- .execute(), {
142
- instanceOf: src_1.GatewayError,
143
- });
144
- t.truthy(error);
145
- t.is(error?.responseCode, "40039");
146
- t.true(error?.message.includes("Idempotency Key seen before"));
147
- });
148
- test("credit authorization for multicapture", async (t) => {
149
- const transaction = await card
150
- .authorize(42)
151
- .withCurrency("EUR")
152
- .withMultiCapture(true)
153
- .withAllowDuplicates(true)
154
- .execute();
155
- t.truthy(transaction);
156
- t.is("SUCCESS", transaction.responseCode);
157
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
158
- t.truthy(transaction.multiCapture);
159
- const capture = await transaction.capture(10).execute();
160
- t.truthy(capture);
161
- t.is("SUCCESS", capture.responseCode);
162
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
163
- const capture2 = await transaction.capture(10).execute();
164
- t.truthy(capture2);
165
- t.is("SUCCESS", capture2.responseCode);
166
- t.is(src_1.TransactionStatus.CAPTURED, capture2.responseMessage);
167
- const capture3 = await transaction.capture(10).execute();
168
- t.truthy(capture3);
169
- t.is("SUCCESS", capture3.responseCode);
170
- t.is(src_1.TransactionStatus.CAPTURED, capture3.responseMessage);
171
- });
172
- test("credit charge with same idempotency key", async (t) => {
173
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
174
- const transaction = await card
175
- .charge(69)
176
- .withCurrency("EUR")
177
- .withIdempotencyKey(idempotencyKey)
178
- .execute();
179
- t.truthy(transaction);
180
- t.is("SUCCESS", transaction.responseCode);
181
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
182
- const error = await t.throwsAsync(async () => await card
183
- .charge(69)
184
- .withCurrency("EUR")
185
- .withIdempotencyKey(idempotencyKey)
186
- .execute(), {
187
- instanceOf: src_1.GatewayError,
188
- });
189
- t.truthy(error);
190
- t.is(error?.responseCode, "40039");
191
- t.true(error?.message.includes("Idempotency Key seen before"));
192
- t.true(error?.message.includes("DUPLICATE_ACTION"));
193
- t.true(error?.message.includes(transaction.transactionId));
194
- });
195
- test("credit refund", async (t) => {
196
- const response = await card
197
- .refund(16)
198
- .withCurrency(currency)
199
- .withAllowDuplicates(true)
200
- .execute();
201
- t.truthy(response);
202
- t.is("SUCCESS", response.responseCode);
203
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
204
- });
205
- test("credit refund with fingerprint", async (t) => {
206
- const customer = new src_1.Customer();
207
- customer.deviceFingerPrint = "ON_SUCCESS";
208
- const response = await card
209
- .refund(16)
210
- .withCurrency(currency)
211
- .withAllowDuplicates(true)
212
- .withCustomerData(customer)
213
- .execute();
214
- t.truthy(response);
215
- t.is("SUCCESS", response.responseCode);
216
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
217
- t.truthy(response.fingerprint);
218
- t.truthy(response.fingerprintIndicator);
219
- });
220
- test("credit default refund", async (t) => {
221
- const transaction = await card
222
- .charge(50)
223
- .withCurrency(currency)
224
- .withAllowDuplicates(true)
225
- .execute();
226
- t.truthy(transaction);
227
- t.is("SUCCESS", transaction.responseCode);
228
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
229
- const response = await transaction
230
- .refund()
231
- .withCurrency(currency)
232
- .withAllowDuplicates(true)
233
- .execute();
234
- t.truthy(response);
235
- t.is("SUCCESS", response.responseCode);
236
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
237
- });
238
- test("credit default refund with idempotency key", async (t) => {
239
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
240
- const transaction = await card
241
- .charge(50)
242
- .withCurrency(currency)
243
- .withIdempotencyKey(idempotencyKey)
244
- .withAllowDuplicates(true)
245
- .execute();
246
- t.truthy(transaction);
247
- t.is("SUCCESS", transaction.responseCode);
248
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
249
- const error = await t.throwsAsync(async () => await transaction
250
- .refund(50)
251
- .withCurrency(currency)
252
- .withIdempotencyKey(idempotencyKey)
253
- .withAllowDuplicates(true)
254
- .execute(), {
255
- instanceOf: src_1.GatewayError,
256
- });
257
- t.truthy(error);
258
- t.is(error?.responseCode, "40039");
259
- t.true(error?.message.includes("Idempotency Key seen before"));
260
- });
261
- test("credit sale tokenized with stored credentials", async (t) => {
262
- const storedCredentials = new src_1.StoredCredential();
263
- storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
264
- storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
265
- storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
266
- storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
267
- const tokenizeResponse = await card.tokenize().execute();
268
- const tokenId = tokenizeResponse.token;
269
- const tokenizedCard = new src_1.CreditCardData();
270
- tokenizedCard.token = tokenId;
271
- tokenizedCard.cardHolderName = "James Mason";
272
- const response = await tokenizedCard
273
- .charge(50)
274
- .withCurrency("EUR")
275
- .withStoredCredentials(storedCredentials)
276
- .execute();
277
- t.truthy(response);
278
- t.is("SUCCESS", response.responseCode);
279
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
280
- });
281
- test("credit sale with stored credentials", async (t) => {
282
- const storedCredentials = new src_1.StoredCredential();
283
- storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
284
- storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
285
- storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
286
- storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
287
- const response = await card
288
- .charge(50)
289
- .withCurrency("EUR")
290
- .withStoredCredentials(storedCredentials)
291
- .execute();
292
- t.truthy(response);
293
- t.is("SUCCESS", response.responseCode);
294
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
295
- });
296
- test("credit sale with dynamic descriptor", async (t) => {
297
- const dynamicDescriptor = "My company";
298
- const response = await card
299
- .charge(50)
300
- .withCurrency("EUR")
301
- .withDynamicDescriptor(dynamicDescriptor)
302
- .execute();
303
- t.truthy(response);
304
- t.is("SUCCESS", response.responseCode);
305
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
306
- });
307
- test("credit reverse with wrong ID", async (t) => {
308
- const transaction = new src_1.Transaction();
309
- transaction.transactionId = src_1.GenerationUtils.getGuuid();
310
- const error = await t.throwsAsync(async () => {
311
- await transaction
312
- .reverse()
313
- .withCurrency(currency)
314
- .withAllowDuplicates(true)
315
- .execute();
316
- }, {
317
- instanceOf: src_1.GatewayError,
318
- });
319
- t.truthy(error);
320
- t.is(error?.responseCode, "40008");
321
- t.true(error?.message.includes(`RESOURCE_NOT_FOUND`));
322
- });
323
- test("credit verification", async (t) => {
324
- const response = await card.verify().withCurrency(currency).execute();
325
- t.truthy(response);
326
- t.is("SUCCESS", response.responseCode);
327
- t.is("VERIFIED", response.responseMessage);
328
- });
329
- test("credit verification with stored credentials", async (t) => {
330
- const storedCredentials = new src_1.StoredCredential();
331
- storedCredentials.initiator = src_1.StoredCredentialInitiator.Merchant;
332
- storedCredentials.type = src_1.StoredCredentialType.INSTALLMENT;
333
- storedCredentials.sequence = src_1.StoredCredentialSequence.SUBSEQUENT;
334
- storedCredentials.reason = src_1.StoredCredentialReason.INCREMENTAL;
335
- const response = await card
336
- .verify()
337
- .withCurrency(currency)
338
- .withStoredCredentials(storedCredentials)
339
- .execute();
340
- t.truthy(response);
341
- t.is("SUCCESS", response.responseCode);
342
- t.is("VERIFIED", response.responseMessage);
343
- });
344
- test("credit verification with idempotency key", async (t) => {
345
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
346
- const response = await card
347
- .verify()
348
- .withCurrency(currency)
349
- .withIdempotencyKey(idempotencyKey)
350
- .execute();
351
- t.truthy(response);
352
- t.is("SUCCESS", response.responseCode);
353
- t.is("VERIFIED", response.responseMessage);
354
- const error = await t.throwsAsync(async () => await card
355
- .verify()
356
- .withCurrency(currency)
357
- .withIdempotencyKey(idempotencyKey)
358
- .execute(), {
359
- instanceOf: src_1.GatewayError,
360
- });
361
- t.truthy(error);
362
- t.is(error?.responseCode, "40039");
363
- t.true(error?.message.includes("Status Code: DUPLICATE_ACTION - Idempotency Key seen before: "));
364
- });
365
- test("credit verification with address", async (t) => {
366
- const address = new src_1.Address();
367
- address.streetAddress1 = "123 Main St.";
368
- address.city = "Downtown";
369
- address.state = "NJ";
370
- address.country = "US";
371
- address.postalCode = "12345";
372
- const response = await card
373
- .verify()
374
- .withCurrency(currency)
375
- .withAddress(address)
376
- .execute();
377
- t.truthy(response);
378
- t.is("SUCCESS", response.responseCode);
379
- t.is("VERIFIED", response.responseMessage);
380
- });
381
- test("credit verification without currency", async (t) => {
382
- const error = await t.throwsAsync(async () => await card.verify().execute(), {
383
- instanceOf: src_1.GatewayError,
384
- });
385
- t.truthy(error);
386
- t.is(error?.responseCode, "40005");
387
- t.true(error?.message.includes("Status Code: MANDATORY_DATA_MISSING - Request expects the following fields currency"));
388
- });
389
- test("credit verification - invalid CVV", async (t) => {
390
- const wrongCard = new src_1.CreditCardData();
391
- wrongCard.number = "4263970000005262";
392
- wrongCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
393
- wrongCard.expYear = (date.getFullYear() + 1).toString();
394
- wrongCard.cardHolderName = "James Mason";
395
- wrongCard.cvn = "1234";
396
- const error = await t.throwsAsync(async () => await wrongCard.verify().withCurrency(currency).execute(), {
397
- instanceOf: src_1.GatewayError,
398
- });
399
- t.truthy(error);
400
- t.is(error?.responseCode, "40085");
401
- t.true(error?.message.includes("Status Code: INVALID_REQUEST_DATA - Security Code/CVV2/CVC must be 3 digits"));
402
- });
403
- test("credit verification - not numeric CVV", async (t) => {
404
- const wrongCard = new src_1.CreditCardData();
405
- wrongCard.number = "4263970000005262";
406
- wrongCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
407
- wrongCard.expYear = (date.getFullYear() + 1).toString();
408
- wrongCard.cardHolderName = "James Mason";
409
- wrongCard.cvn = "SMA";
410
- const error = await t.throwsAsync(async () => await wrongCard.verify().withCurrency(currency).execute(), {
411
- instanceOf: src_1.GatewayError,
412
- });
413
- t.truthy(error);
414
- t.is(error?.responseCode, "50018");
415
- t.true(error?.message.includes("Status Code: SYSTEM_ERROR_DOWNSTREAM - The line number 12 which contains ' [number] XXX [/number] ' does not conform to the schema"));
416
- });
417
- test("capture higher amount", async (t) => {
418
- const transaction = await card
419
- .authorize(55)
420
- .withCurrency(currency)
421
- .withAllowDuplicates(true)
422
- .execute();
423
- t.truthy(transaction);
424
- t.is("SUCCESS", transaction.responseCode);
425
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
426
- const capture = await transaction.capture("60").execute();
427
- t.truthy(capture);
428
- t.is("SUCCESS", capture.responseCode);
429
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
430
- const transaction2 = await card
431
- .authorize(30)
432
- .withCurrency(currency)
433
- .withAllowDuplicates(true)
434
- .execute();
435
- t.truthy(transaction2);
436
- t.is("SUCCESS", transaction2.responseCode);
437
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction2.responseMessage);
438
- const error = await t.throwsAsync(async () => await transaction2.capture("40").execute(), {
439
- instanceOf: src_1.GatewayError,
440
- });
441
- t.truthy(error);
442
- t.is(error?.responseCode, "50020");
443
- t.true(error?.message.includes("INVALID_REQUEST_DATA - Can't settle for more than 115% of that which you authorised"));
444
- });
445
- test("capture lower amount", async (t) => {
446
- const transaction = await card
447
- .authorize("55")
448
- .withCurrency(currency)
449
- .withAllowDuplicates(true)
450
- .execute();
451
- t.truthy(transaction);
452
- t.is("SUCCESS", transaction.responseCode);
453
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
454
- const capture = await transaction.capture("20").execute();
455
- t.truthy(capture);
456
- t.is("SUCCESS", capture.responseCode);
457
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
458
- });
459
- test("charge then refund higher amount", async (t) => {
460
- const transaction = await card
461
- .charge(50)
462
- .withCurrency(currency)
463
- .withAllowDuplicates(true)
464
- .execute();
465
- t.truthy(transaction);
466
- t.is("SUCCESS", transaction.responseCode);
467
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
468
- const error = await t.throwsAsync(async () => await transaction
469
- .refund(60)
470
- .withCurrency(currency)
471
- .withAllowDuplicates(true)
472
- .execute(), {
473
- instanceOf: src_1.GatewayError,
474
- });
475
- t.truthy(error);
476
- t.is(error?.responseCode, "40087");
477
- t.true(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount"));
478
- });
479
- test("capture then refund higher amount", async (t) => {
480
- const transaction = await card
481
- .authorize(55)
482
- .withCurrency(currency)
483
- .withAllowDuplicates(true)
484
- .execute();
485
- t.truthy(transaction);
486
- t.is("SUCCESS", transaction.responseCode);
487
- t.is(src_1.TransactionStatus.PREAUTHORIZED, transaction.responseMessage);
488
- const capture = await transaction.capture(55).execute();
489
- t.truthy(capture);
490
- t.is("SUCCESS", capture.responseCode);
491
- t.is(src_1.TransactionStatus.CAPTURED, capture.responseMessage);
492
- const error = await t.throwsAsync(async () => await transaction
493
- .refund(70)
494
- .withCurrency(currency)
495
- .withAllowDuplicates(true)
496
- .execute(), {
497
- instanceOf: src_1.GatewayError,
498
- });
499
- t.truthy(error);
500
- t.is(error?.responseCode, "40087");
501
- t.true(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount"));
502
- });
503
- test("manual transaction", async (t) => {
504
- const entryModes = [
505
- src_1.ManualEntryMethod.MOTO,
506
- src_1.ManualEntryMethod.MAIL,
507
- src_1.ManualEntryMethod.PHONE,
508
- ];
509
- for (const entryMode of entryModes) {
510
- const entryModeCard = new src_1.CreditCardData();
511
- entryModeCard.number = "4263970000005262";
512
- entryModeCard.expMonth = (date.getMonth() + 1).toString().padStart(2, "0");
513
- entryModeCard.expYear = (date.getFullYear() + 1).toString();
514
- entryModeCard.cardHolderName = "James Mason";
515
- entryModeCard.cvn = "SMA";
516
- entryModeCard.entryMethod = entryMode;
517
- const response = await card.charge(69).withCurrency(currency).execute();
518
- t.truthy(response);
519
- t.is("SUCCESS", response.responseCode);
520
- t.is(src_1.TransactionStatus.CAPTURED, response.responseMessage);
521
- }
522
- });
523
- test("credit sale - expiry card", async (t) => {
524
- const previousCardExpYear = card.expYear;
525
- card.expYear = (date.getFullYear() - 1).toString();
526
- const error = await t.throwsAsync(async () => await card.charge(1).withCurrency("USD").execute(), {
527
- instanceOf: src_1.GatewayError,
528
- });
529
- t.truthy(error);
530
- t.is(error?.responseCode, "40085");
531
- t.true(error?.message.includes("Status Code: INVALID_REQUEST_DATA - Expiry date invalid"));
532
- card.expYear = previousCardExpYear;
533
- });
534
- test("verify tokenized payment method with fingerprint", async (t) => {
535
- const customer = new src_1.Customer();
536
- customer.deviceFingerPrint = "ALWAYS";
537
- const response = await card.tokenize().withCustomerData(customer).execute();
538
- t.truthy(response);
539
- t.is("SUCCESS", response.responseCode);
540
- t.truthy(response.fingerprint);
541
- const tokenizedCard = new src_1.CreditCardData();
542
- tokenizedCard.token = response.token;
543
- const verifyResponse = await tokenizedCard
544
- .verify()
545
- .withCurrency(currency)
546
- .withCustomerData(customer)
547
- .execute();
548
- t.truthy(verifyResponse);
549
- t.is("SUCCESS", verifyResponse.responseCode);
550
- t.is("VERIFIED", verifyResponse.responseMessage);
551
- t.truthy(verifyResponse.fingerprint);
552
- });
553
- test("verify tokenized payment method with invalid fingerprint", async (t) => {
554
- const customer = new src_1.Customer();
555
- customer.deviceFingerPrint = "NOT_ALWAYS";
556
- const error = await t.throwsAsync(async () => await card
557
- .charge(60)
558
- .withCurrency(currency)
559
- .withCustomerData(customer)
560
- .execute(), {
561
- instanceOf: src_1.GatewayError,
562
- });
563
- t.truthy(error);
564
- t.is(error?.responseCode, "40213");
565
- t.true(error?.message.includes("Status Code: INVALID_REQUEST_DATA - fingerprint_mode contains unexpected data"));
566
- });
567
- test("credit sale without permissions", async (t) => {
568
- const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
569
- config.permissions = ["TRN_POST_Capture"];
570
- src_1.ServicesContainer.configureService(config, "configWithoutSalePermission");
571
- const error = await t.throwsAsync(async () => await card
572
- .charge(50)
573
- .withCurrency(currency)
574
- .withAllowDuplicates(true)
575
- .execute("configWithoutSalePermission"), {
576
- instanceOf: src_1.GatewayError,
577
- });
578
- t.truthy(error);
579
- t.is(error?.responseCode, "40212");
580
- t.is(error?.message, "Status Code: ACTION_NOT_AUTHORIZED - Permission not enabled to execute action");
581
- });
582
- test("transaction then refund", async (t) => {
583
- const transaction = await card
584
- .charge(50)
585
- .withCurrency(currency)
586
- .withAllowDuplicates(true)
587
- .execute();
588
- t.truthy(transaction);
589
- t.is("SUCCESS", transaction.responseCode);
590
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
591
- const partialAmount = "7.51";
592
- const partialRefund = await transaction
593
- .refund(partialAmount)
594
- .withCurrency(currency)
595
- .execute();
596
- t.truthy(partialRefund);
597
- t.is("SUCCESS", partialRefund.responseCode);
598
- t.is(src_1.TransactionStatus.CAPTURED, partialRefund.responseMessage);
599
- t.is(partialAmount, partialRefund.balanceAmount);
600
- const error = await t.throwsAsync(async () => await transaction.refund().withCurrency(currency).execute(), {
601
- instanceOf: src_1.GatewayError,
602
- });
603
- t.truthy(error);
604
- t.is(error?.responseCode, "40087");
605
- t.true(error?.message.includes("INVALID_REQUEST_DATA - You may only refund up to 115% of the original amount"));
606
- });
607
- test("transaction then reversal", async (t) => {
608
- const transaction = await card
609
- .charge(20)
610
- .withCurrency(currency)
611
- .withAllowDuplicates(true)
612
- .execute();
613
- t.truthy(transaction);
614
- t.is("SUCCESS", transaction.responseCode);
615
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
616
- const reverse = await transaction.reverse(20).execute();
617
- t.truthy(reverse);
618
- t.is("SUCCESS", reverse.responseCode);
619
- t.is(src_1.TransactionStatus.REVERSED, reverse.responseMessage);
620
- });
621
- test("transaction then default reversal", async (t) => {
622
- const transaction = await card
623
- .charge(20)
624
- .withCurrency(currency)
625
- .withAllowDuplicates(true)
626
- .execute();
627
- t.truthy(transaction);
628
- t.is("SUCCESS", transaction.responseCode);
629
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
630
- const reverse = await transaction.reverse().execute();
631
- t.truthy(reverse);
632
- t.is("SUCCESS", reverse.responseCode);
633
- t.is(src_1.TransactionStatus.REVERSED, reverse.responseMessage);
634
- });
635
- test("transaction then reversal with idempotency key", async (t) => {
636
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
637
- const transaction = await card
638
- .charge(20)
639
- .withCurrency(currency)
640
- .withAllowDuplicates(true)
641
- .withIdempotencyKey(idempotencyKey)
642
- .execute();
643
- t.truthy(transaction);
644
- t.is("SUCCESS", transaction.responseCode);
645
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
646
- const error = await t.throwsAsync(async () => await transaction.reverse().withIdempotencyKey(idempotencyKey).execute(), {
647
- instanceOf: src_1.GatewayError,
648
- });
649
- t.truthy(error);
650
- t.is(error?.responseCode, "40039");
651
- t.true(error?.message.includes("Idempotency Key seen before"));
652
- });
653
- test("transaction then partial reversal", async (t) => {
654
- const transaction = await card
655
- .charge(20)
656
- .withCurrency(currency)
657
- .withAllowDuplicates(true)
658
- .execute();
659
- t.truthy(transaction);
660
- t.is("SUCCESS", transaction.responseCode);
661
- t.is(src_1.TransactionStatus.CAPTURED, transaction.responseMessage);
662
- const error = await t.throwsAsync(async () => await transaction.reverse(10).execute(), {
663
- instanceOf: src_1.GatewayError,
664
- });
665
- t.truthy(error);
666
- t.is(error?.responseCode, "40214");
667
- t.is(error?.message, "Status Code: INVALID_REQUEST_DATA - partial reversal not supported");
668
- });
669
- test("card tokenization", async (t) => {
670
- const response = await card.tokenize().execute();
671
- t.truthy(response);
672
- t.is("SUCCESS", response.responseCode);
673
- t.is("ACTIVE", response.responseMessage);
674
- });
675
- test("card tokenization then paying with token - Single to Multi-Use", async (t) => {
676
- const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
677
- config.permissions = ["PMT_POST_Create_Single"];
678
- src_1.ServicesContainer.configureService(config, "singleUseToken");
679
- const response = await card
680
- .tokenize(true, src_1.PaymentMethodUsageMode.SINGLE)
681
- .execute("singleUseToken");
682
- const tokenId = response.token;
683
- const tokenizedCard = new src_1.CreditCardData();
684
- tokenizedCard.token = tokenId;
685
- tokenizedCard.cardHolderName = "James Mason";
686
- const chargeResponse = await tokenizedCard
687
- .charge(10)
688
- .withCurrency("USD")
689
- .withRequestMultiUseToken(true)
690
- .execute();
691
- t.truthy(chargeResponse);
692
- t.is(chargeResponse.responseCode, "SUCCESS");
693
- t.is(chargeResponse.responseMessage, src_1.TransactionStatus.CAPTURED);
694
- t.truthy(chargeResponse.token.startsWith(DTO_1.PaymentMethod.PAYMENT_METHOD_TOKEN_PREFIX));
695
- tokenizedCard.token = chargeResponse.token;
696
- const secondChargeResponse = await tokenizedCard
697
- .charge(10)
698
- .withCurrency("USD")
699
- .execute();
700
- t.truthy(secondChargeResponse);
701
- t.is(secondChargeResponse.responseCode, "SUCCESS");
702
- t.is(secondChargeResponse.responseMessage, src_1.TransactionStatus.CAPTURED);
703
- });
704
- test("card tokenization with idempotency key", async (t) => {
705
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
706
- const response = await card
707
- .tokenize()
708
- .withIdempotencyKey(idempotencyKey)
709
- .execute();
710
- t.truthy(response);
711
- t.is(response.responseCode, "SUCCESS");
712
- t.is(response.responseMessage, "ACTIVE");
713
- let exceptionCaught = false;
714
- try {
715
- await card.tokenize().withIdempotencyKey(idempotencyKey).execute();
716
- }
717
- catch (e) {
718
- exceptionCaught = true;
719
- t.is(e.responseCode, "40039");
720
- t.true(e.message.includes("Idempotency Key seen before"));
721
- }
722
- finally {
723
- t.true(exceptionCaught);
724
- }
725
- });
726
- test("card tokenization then paying with token", async (t) => {
727
- const response = await card.tokenize().execute();
728
- const tokenId = response.token;
729
- const tokenizedCard = new src_1.CreditCardData();
730
- tokenizedCard.token = tokenId;
731
- tokenizedCard.cardHolderName = "James Mason";
732
- const chargeResponse = await tokenizedCard
733
- .charge(69)
734
- .withCurrency("EUR")
735
- .withOrderId("124214-214221")
736
- .execute();
737
- t.truthy(chargeResponse);
738
- t.is(chargeResponse.responseCode, "SUCCESS");
739
- t.is(chargeResponse.responseMessage, src_1.TransactionStatus.CAPTURED);
740
- });
741
- test("verify tokenized payment method", async (t) => {
742
- const tokenizeResponse = await card.tokenize().execute();
743
- t.truthy(tokenizeResponse);
744
- t.is(tokenizeResponse.responseCode, "SUCCESS");
745
- t.is(tokenizeResponse.responseMessage, "ACTIVE");
746
- const tokenizedCard = new src_1.CreditCardData();
747
- tokenizedCard.token = tokenizeResponse.token;
748
- const response = await tokenizedCard
749
- .verify()
750
- .withCurrency(currency)
751
- .execute();
752
- t.truthy(response);
753
- t.is(response.responseCode, "SUCCESS");
754
- t.is(response.responseMessage, "VERIFIED");
755
- });
756
- test("verify tokenized payment method with idempotency key", async (t) => {
757
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
758
- const tokenizeResponse = await card.tokenize().execute();
759
- t.truthy(tokenizeResponse);
760
- t.is(tokenizeResponse.responseCode, "SUCCESS");
761
- t.is(tokenizeResponse.responseMessage, "ACTIVE");
762
- const tokenizedCard = new src_1.CreditCardData();
763
- tokenizedCard.token = tokenizeResponse.token;
764
- const response = await tokenizedCard
765
- .verify()
766
- .withCurrency(currency)
767
- .withIdempotencyKey(idempotencyKey)
768
- .execute();
769
- t.truthy(response);
770
- t.is(response.responseCode, "SUCCESS");
771
- t.is(response.responseMessage, "VERIFIED");
772
- const error = await t.throwsAsync(async () => {
773
- await tokenizedCard.verify().withIdempotencyKey(idempotencyKey).execute();
774
- }, {
775
- instanceOf: src_1.GatewayError,
776
- });
777
- t.truthy(error);
778
- t.is(error?.responseCode, "40039");
779
- t.is(error?.message.includes(`Idempotency Key seen before`), true);
780
- });
781
- test("verify tokenized payment method with wrong ID", async (t) => {
782
- const tokenizedCard = new src_1.CreditCardData();
783
- tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
784
- const error = await t.throwsAsync(async () => {
785
- await tokenizedCard.verify().withCurrency(currency).execute();
786
- }, {
787
- instanceOf: src_1.GatewayError,
788
- });
789
- t.truthy(error);
790
- t.is(error?.responseCode, "40116");
791
- t.is(error?.message, `Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
792
- });
793
- test.skip("card tokenization then delete", async (t) => {
794
- //Permission not enabled to execute action for this appId/appKey
795
- const response = await card.tokenize().execute();
796
- const tokenId = response.token;
797
- const tokenizedCard = new src_1.CreditCardData();
798
- tokenizedCard.token = tokenId;
799
- const deleteTokenExpiryRes = await tokenizedCard.deleteToken();
800
- t.truthy(deleteTokenExpiryRes);
801
- const deleteTokenExpiryRes2 = await tokenizedCard.deleteToken();
802
- t.falsy(deleteTokenExpiryRes2);
803
- });
804
- test.skip("card tokenization then delete with idempotency key", async (t) => {
805
- //Permission not enabled to execute action for this appId/appKey
806
- const response = await card.tokenize().execute();
807
- const tokenId = response.token;
808
- const tokenizedCard = new src_1.CreditCardData();
809
- tokenizedCard.token = tokenId;
810
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
811
- const deleteTokenExpiryRes = await new src_1.ManagementBuilder(src_1.TransactionType.TokenDelete)
812
- .withPaymentMethod(tokenizedCard)
813
- .withIdempotencyKey(idempotencyKey)
814
- .execute();
815
- t.truthy(deleteTokenExpiryRes);
816
- t.is(deleteTokenExpiryRes.responseCode, "SUCCESS");
817
- t.is(deleteTokenExpiryRes.responseMessage, "DELETED");
818
- const error = await t.throwsAsync(async () => {
819
- await new src_1.ManagementBuilder(src_1.TransactionType.TokenDelete)
820
- .withPaymentMethod(tokenizedCard)
821
- .withIdempotencyKey(idempotencyKey)
822
- .execute();
823
- }, {
824
- instanceOf: src_1.GatewayError,
825
- });
826
- t.truthy(error);
827
- t.is(error?.responseCode, "40039");
828
- if (error?.message) {
829
- t.regex(error?.message, new RegExp("Idempotency Key seen before"));
830
- }
831
- });
832
- test.skip("card delete wrong id", async (t) => {
833
- //Permission not enabled to execute action for this appId/appKey
834
- const tokenizedCard = new src_1.CreditCardData();
835
- tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
836
- const error = await t.throwsAsync(async () => {
837
- await tokenizedCard.deleteToken();
838
- }, {
839
- instanceOf: src_1.GatewayError,
840
- });
841
- t.truthy(error);
842
- t.is(error?.responseCode, "40116");
843
- t.is(error?.message, `Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
844
- });
845
- test("card tokenization then update", async (t) => {
846
- const response = await card.tokenize().execute();
847
- const tokenId = response.token;
848
- const tokenizedCard = new src_1.CreditCardData();
849
- tokenizedCard.token = tokenId;
850
- const date = new Date();
851
- tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
852
- tokenizedCard.expYear = (date.getFullYear() + 2).toString();
853
- const updateTokenExpiryRes = await tokenizedCard.updateTokenExpiry();
854
- t.truthy(updateTokenExpiryRes);
855
- });
856
- test("card update wrong ID", async (t) => {
857
- const tokenizedCard = new src_1.CreditCardData();
858
- tokenizedCard.token = "PMT_" + src_1.GenerationUtils.getGuuid();
859
- const date = new Date();
860
- tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
861
- tokenizedCard.expYear = (date.getFullYear() + 2).toString();
862
- const error = await t.throwsAsync(async () => {
863
- await tokenizedCard.updateTokenExpiry();
864
- }, {
865
- instanceOf: src_1.GatewayError,
866
- });
867
- t.truthy(error);
868
- t.is(error?.message, `Status Code: RESOURCE_NOT_FOUND - payment_method ${tokenizedCard.token} not found at this location.`);
869
- });
870
- test("card tokenization then update with idempotency key", async (t) => {
871
- const response = await card.tokenize().execute();
872
- const tokenId = response.token;
873
- const tokenizedCard = new src_1.CreditCardData();
874
- tokenizedCard.token = tokenId;
875
- const date = new Date();
876
- tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
877
- tokenizedCard.expYear = (date.getFullYear() + 2).toString();
878
- const idempotencyKey = src_1.GenerationUtils.getGuuid();
879
- const updateTokenExpiryRes = await new src_1.ManagementBuilder(src_1.TransactionType.TokenUpdate)
880
- .withPaymentMethod(tokenizedCard)
881
- .withIdempotencyKey(idempotencyKey)
882
- .execute();
883
- t.truthy(updateTokenExpiryRes);
884
- t.is(updateTokenExpiryRes.responseCode, "SUCCESS");
885
- t.is(updateTokenExpiryRes.responseMessage, "ACTIVE");
886
- const error = await t.throwsAsync(async () => {
887
- await new src_1.ManagementBuilder(src_1.TransactionType.TokenUpdate)
888
- .withPaymentMethod(tokenizedCard)
889
- .withIdempotencyKey(idempotencyKey)
890
- .execute();
891
- }, {
892
- instanceOf: src_1.GatewayError,
893
- });
894
- t.truthy(error);
895
- t.is(error?.responseCode, "40039");
896
- if (error?.responseMessage) {
897
- t.regex(error?.responseMessage, new RegExp("Idempotency Key seen before"));
898
- }
899
- const verifyResponse = await tokenizedCard
900
- .verify()
901
- .withCurrency(currency)
902
- .withIdempotencyKey(idempotencyKey)
903
- .execute();
904
- t.truthy(verifyResponse);
905
- t.is(verifyResponse.responseCode, "SUCCESS");
906
- t.is(verifyResponse.responseMessage, "VERIFIED");
907
- tokenizedCard.expYear = (date.getFullYear() + 3).toString();
908
- const updateTokenExpiryRes2 = await tokenizedCard.updateTokenExpiry();
909
- t.truthy(updateTokenExpiryRes2);
910
- });
911
- test("credit refund transaction wrong ID", async (t) => {
912
- const transaction = new src_1.Transaction();
913
- transaction.transactionId = src_1.GenerationUtils.getGuuid();
914
- const error = await t.throwsAsync(async () => {
915
- await transaction
916
- .refund(10)
917
- .withCurrency(currency)
918
- .withAllowDuplicates(true)
919
- .execute();
920
- }, {
921
- instanceOf: src_1.GatewayError,
922
- });
923
- t.truthy(error);
924
- t.true(error?.message.includes(`RESOURCE_NOT_FOUND`));
925
- });
926
- test("card tokenization - Missing card number", async (t) => {
927
- const card = new src_1.CreditCardData();
928
- const error = await t.throwsAsync(async () => {
929
- await card.tokenize().execute();
930
- }, {
931
- instanceOf: src_1.GatewayError,
932
- });
933
- t.truthy(error);
934
- t.is(error?.message, "Status Code: MANDATORY_DATA_MISSING - Request expects the following fields : number");
935
- });
936
- test("update payment token", async (t) => {
937
- const startDate = new Date();
938
- startDate.setDate(startDate.getDate() - 30);
939
- startDate.setHours(0);
940
- startDate.setMinutes(0);
941
- startDate.setSeconds(0);
942
- const response = await src_1.ReportingService.findStoredPaymentMethodsPaged(1, 1)
943
- .orderBy(src_1.StoredPaymentMethodSortProperty.TimeCreated, src_1.SortDirection.Desc)
944
- .where(src_1.SearchCriteria.StartDate, `${startDate.getFullYear()}-${(startDate.getMonth() + 1)
945
- .toString()
946
- .padStart(2, "0")}-${startDate.getDate().toString().padStart(2, "0")}`)
947
- .execute();
948
- t.is(response.result.length, 1);
949
- const pmtToken = response.result[0];
950
- t.truthy(pmtToken);
951
- const tokenizedCard = new src_1.CreditCardData();
952
- tokenizedCard.token = pmtToken.paymentMethodId;
953
- const date = new Date();
954
- tokenizedCard.cardHolderName = "James BondUp";
955
- tokenizedCard.expMonth = (date.getMonth() + 2).toString().padStart(2, "0");
956
- tokenizedCard.expYear = (date.getFullYear() + 4).toString();
957
- tokenizedCard.number = "4263970000005262";
958
- const responseUpdateToken = await tokenizedCard
959
- .updateToken()
960
- .withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.MULTIPLE)
961
- .execute();
962
- t.truthy(responseUpdateToken);
963
- t.is(responseUpdateToken.responseCode, "SUCCESS");
964
- t.is(responseUpdateToken.responseMessage, "ACTIVE");
965
- t.is(responseUpdateToken.token, pmtToken.paymentMethodId);
966
- t.is(responseUpdateToken.tokenUsageMode, src_1.PaymentMethodUsageMode.MULTIPLE);
967
- });
968
- test("card tokenization then update then charge", async (t) => {
969
- const config = BaseGpApiTestConfig_1.BaseGpApiTestConfig.gpApiSetupConfig(src_1.Channel.CardNotPresent);
970
- config.permissions = ["PMT_POST_Create_Single"];
971
- src_1.ServicesContainer.configureService(config, "singleUseToken");
972
- const response = await card
973
- .tokenize()
974
- .withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.SINGLE)
975
- .execute("singleUseToken");
976
- const tokenId = response.token;
977
- const tokenizedCard = new src_1.CreditCardData();
978
- tokenizedCard.token = tokenId;
979
- tokenizedCard.cardHolderName = "GpApi";
980
- const responseUpdateToken = await tokenizedCard
981
- .updateToken()
982
- .withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.MULTIPLE)
983
- .execute();
984
- t.truthy(responseUpdateToken);
985
- t.is(responseUpdateToken.responseCode, "SUCCESS");
986
- t.is(responseUpdateToken.responseMessage, "ACTIVE");
987
- t.is(responseUpdateToken.tokenUsageMode, src_1.PaymentMethodUsageMode.MULTIPLE);
988
- const chargeResponse = await tokenizedCard
989
- .charge(1)
990
- .withCurrency(currency)
991
- .execute();
992
- t.truthy(chargeResponse);
993
- t.is(chargeResponse.responseCode, "SUCCESS");
994
- t.is(chargeResponse.responseMessage, src_1.TransactionStatus.CAPTURED);
995
- });
996
- test("card tokenization then update to single usage", async (t) => {
997
- const tokenizedCard = new src_1.CreditCardData();
998
- tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
999
- const error = await t.throwsAsync(async () => {
1000
- await tokenizedCard
1001
- .updateToken()
1002
- .withPaymentMethodUsageMode(src_1.PaymentMethodUsageMode.SINGLE)
1003
- .execute();
1004
- }, {
1005
- instanceOf: src_1.GatewayError,
1006
- });
1007
- t.truthy(error);
1008
- t.is(error?.responseCode, "50020");
1009
- t.is(error?.message, "Status Code: INVALID_REQUEST_DATA - Tokentype can only be MULTI");
1010
- });
1011
- test("card tokenization then update to without usage mode", async (t) => {
1012
- const tokenizedCard = new src_1.CreditCardData();
1013
- tokenizedCard.token = `PMT_${src_1.GenerationUtils.getGuuid()}`;
1014
- const error = await t.throwsAsync(async () => {
1015
- await tokenizedCard.updateToken().execute();
1016
- }, {
1017
- instanceOf: src_1.GatewayError,
1018
- });
1019
- t.truthy(error);
1020
- t.is(error?.responseCode, "50021");
1021
- t.is(error?.message, "Status Code: MANDATORY_DATA_MISSING - Mandatory Fields missing [card expdate] See Developers Guide");
1022
- });
1023
- test.after(() => BaseGpApiTestConfig_1.BaseGpApiTestConfig.resetGpApiConfig());
1024
- test.afterEach(() => BaseGpApiTestConfig_1.BaseGpApiTestConfig.resetGpApiConfig());
1025
- //# sourceMappingURL=CreditCardNotPresentTest.js.map