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
@@ -0,0 +1,523 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.RealexConnector = void 0;
19
+ var elementtree_1 = require("@azz/elementtree");
20
+ var __1 = require("../");
21
+ var XmlGateway_1 = require("./XmlGateway");
22
+ var RealexConnector = /** @class */ (function (_super) {
23
+ __extends(RealexConnector, _super);
24
+ function RealexConnector() {
25
+ var _this = _super !== null && _super.apply(this, arguments) || this;
26
+ _this.supportsHostedPayments = true;
27
+ _this.supportsRetrieval = false;
28
+ _this.supportsUpdatePaymentDetails = true;
29
+ return _this;
30
+ }
31
+ RealexConnector.prototype.processAuthorization = function (builder) {
32
+ var _this = this;
33
+ var timestamp = __1.GenerationUtils.generateTimestamp();
34
+ var orderId = builder.orderId
35
+ ? builder.orderId
36
+ : __1.GenerationUtils.generateOrderId();
37
+ // build Request
38
+ var request = elementtree_1.Element("request", {
39
+ timestamp: timestamp,
40
+ type: this.mapAuthRequestType(builder),
41
+ });
42
+ if (this.merchantId) {
43
+ elementtree_1.SubElement(request, "merchantid").append(elementtree_1.CData(this.merchantId));
44
+ }
45
+ if (this.accountId) {
46
+ elementtree_1.SubElement(request, "account").append(elementtree_1.CData(this.accountId));
47
+ }
48
+ if (this.channel) {
49
+ elementtree_1.SubElement(request, "channel").append(elementtree_1.CData(this.channel));
50
+ }
51
+ elementtree_1.SubElement(request, "orderid").append(elementtree_1.CData(orderId));
52
+ if (builder.amount) {
53
+ var amountAttrs = builder.currency
54
+ ? { currency: builder.currency }
55
+ : {};
56
+ elementtree_1.SubElement(request, "amount", amountAttrs).append(elementtree_1.CData(this.numberFormat(builder.amount)));
57
+ }
58
+ // hydrate the payment data fields
59
+ if (builder.paymentMethod instanceof __1.CreditCardData) {
60
+ var card = builder.paymentMethod;
61
+ if (builder.transactionModifier === __1.TransactionModifier.EncryptedMobile) {
62
+ elementtree_1.SubElement(request, "token").append(elementtree_1.CData(card.token));
63
+ elementtree_1.SubElement(request, "mobile").append(elementtree_1.CData(card.mobileType));
64
+ }
65
+ else {
66
+ var cardElement = elementtree_1.SubElement(request, "card");
67
+ elementtree_1.SubElement(cardElement, "number").append(elementtree_1.CData(card.number));
68
+ var date = __1.StringUtils.leftPad(card.expMonth, 2, "0") +
69
+ __1.StringUtils.leftPad((card.expYear || "").substr(2, 2), 2, "0");
70
+ elementtree_1.SubElement(cardElement, "expdate").append(elementtree_1.CData(date));
71
+ elementtree_1.SubElement(cardElement, "type").append(elementtree_1.CData(card.getCardType().toUpperCase()));
72
+ elementtree_1.SubElement(cardElement, "chname").append(elementtree_1.CData(card.cardHolderName));
73
+ if (card.cvn) {
74
+ var cvnElement = elementtree_1.SubElement(cardElement, "cvn");
75
+ elementtree_1.SubElement(cvnElement, "number").append(elementtree_1.CData(card.cvn));
76
+ elementtree_1.SubElement(cvnElement, "presind").append(elementtree_1.CData(card.cvnPresenceIndicator.toString()));
77
+ }
78
+ // issueno
79
+ }
80
+ var isVerify = builder.transactionType === __1.TransactionType.Verify;
81
+ elementtree_1.SubElement(request, "sha1hash").append(elementtree_1.CData(this.generateHash(timestamp, orderId, builder.amount ? this.numberFormat(builder.amount) : "", builder.currency, builder.transactionModifier === __1.TransactionModifier.EncryptedMobile
82
+ ? card.token
83
+ : card.number, isVerify)));
84
+ }
85
+ if (builder.paymentMethod instanceof __1.RecurringPaymentMethod) {
86
+ var recurring = builder.paymentMethod;
87
+ elementtree_1.SubElement(request, "payerref").append(elementtree_1.CData(recurring.customerKey));
88
+ elementtree_1.SubElement(request, "paymentmethod").append(elementtree_1.CData(recurring.key || recurring.id));
89
+ if (builder.cvn) {
90
+ var paymentData = elementtree_1.SubElement(request, "paymentdata");
91
+ var cvn = elementtree_1.SubElement(paymentData, "cvn");
92
+ elementtree_1.SubElement(cvn, "number").append(elementtree_1.CData(builder.cvn));
93
+ }
94
+ var isVerify = builder.transactionType === __1.TransactionType.Verify;
95
+ elementtree_1.SubElement(request, "sha1hash").append(elementtree_1.CData(this.generateHash(timestamp, orderId, builder.amount ? this.numberFormat(builder.amount) : "", builder.currency, recurring.customerKey, isVerify)));
96
+ }
97
+ // refund hash
98
+ if (builder.transactionType === __1.TransactionType.Refund) {
99
+ elementtree_1.SubElement(request, "refundhash").append(elementtree_1.CData(__1.GenerationUtils.generateHash(this.refundPassword) || ""));
100
+ }
101
+ // this needs to be figured out based on txn type and set to 0, 1 or MULTI
102
+ if (builder.transactionType === __1.TransactionType.Sale ||
103
+ builder.transactionType === __1.TransactionType.Auth) {
104
+ var autoSettle = builder.transactionType === __1.TransactionType.Sale ? "1" : "0";
105
+ elementtree_1.SubElement(request, "autosettle", { flag: autoSettle });
106
+ }
107
+ if (builder.description) {
108
+ var comments = elementtree_1.SubElement(request, "comments");
109
+ elementtree_1.SubElement(comments, "comment", { id: 1 }).append(elementtree_1.CData(builder.description));
110
+ }
111
+ if (builder.customerId ||
112
+ builder.productId ||
113
+ builder.customerIpAddress ||
114
+ builder.clientTransactionId) {
115
+ var tssInfo = elementtree_1.SubElement(request, "tssinfo");
116
+ elementtree_1.SubElement(tssInfo, "custnum").append(elementtree_1.CData(builder.customerId));
117
+ elementtree_1.SubElement(tssInfo, "prodid").append(elementtree_1.CData(builder.productId));
118
+ elementtree_1.SubElement(tssInfo, "varref").append(elementtree_1.CData(builder.clientTransactionId));
119
+ elementtree_1.SubElement(tssInfo, "custipaddress").append(elementtree_1.CData(builder.customerIpAddress));
120
+ }
121
+ if (builder.ecommerceInfo) {
122
+ var mpi = elementtree_1.SubElement(request, "mpi");
123
+ elementtree_1.SubElement(mpi, "cavv").append(elementtree_1.CData(builder.ecommerceInfo.cavv));
124
+ elementtree_1.SubElement(mpi, "xid").append(elementtree_1.CData(builder.ecommerceInfo.xid));
125
+ elementtree_1.SubElement(mpi, "eci").append(elementtree_1.CData(builder.ecommerceInfo.eci));
126
+ }
127
+ return this.doTransaction(this.buildEnvelope(request)).then(function (response) {
128
+ return _this.mapResponse(response);
129
+ });
130
+ };
131
+ RealexConnector.prototype.serializeRequest = function (builder) {
132
+ if (!this.hostedPaymentConfig) {
133
+ throw new __1.ApiError("Hosted configuration missing. Please check your configuration");
134
+ }
135
+ var encoder = this.hostedPaymentConfig.version === __1.HppVersion.Version2
136
+ ? function (t) { return t; }
137
+ : __1.StringUtils.btoa;
138
+ var request = {};
139
+ var orderId = builder.orderId || __1.GenerationUtils.generateOrderId();
140
+ var timestamp = builder.timestamp || __1.GenerationUtils.generateTimestamp();
141
+ if (builder.transactionType !== __1.TransactionType.Sale &&
142
+ builder.transactionType !== __1.TransactionType.Auth &&
143
+ builder.transactionType !== __1.TransactionType.Verify) {
144
+ throw new __1.UnsupportedTransactionError();
145
+ }
146
+ request.MERCHANT_ID = encoder(this.merchantId || "");
147
+ request.ACCOUNT = encoder(this.accountId || "");
148
+ request.CHANNEL = encoder(this.channel || "");
149
+ request.ORDER_ID = encoder(orderId || "");
150
+ if (builder.amount) {
151
+ request.AMOUNT = encoder(this.numberFormat(builder.amount) || "");
152
+ }
153
+ request.CURRENCY = encoder(builder.currency || "");
154
+ request.TIMESTAMP = encoder(timestamp || "");
155
+ request.AUTO_SETTLE_FLAG = encoder(builder.transactionType === __1.TransactionType.Sale ? "1" : "0" || "");
156
+ request.COMMENT1 = encoder(builder.Description || "");
157
+ // request.COMMENT2 = encoder( || "");
158
+ if (this.hostedPaymentConfig.requestTransactionStabilityScore) {
159
+ request.RETURN_TSS = encoder(this.hostedPaymentConfig.requestTransactionStabilityScore
160
+ ? "1"
161
+ : "0" || "");
162
+ }
163
+ if (this.hostedPaymentConfig.directCurrencyConversionEnabled) {
164
+ request.DCC_ENABLE = encoder(this.hostedPaymentConfig.directCurrencyConversionEnabled
165
+ ? "1"
166
+ : "0" || "");
167
+ }
168
+ if (builder.hostedPaymentData) {
169
+ request.CUST_NUM = encoder(builder.hostedPaymentData.customerNumber || "");
170
+ if (this.hostedPaymentConfig.displaySavedCards &&
171
+ builder.hostedPaymentData.customerKey) {
172
+ request.HPP_SELECT_STORED_CARD = encoder(builder.hostedPaymentData.customerKey || "");
173
+ }
174
+ if (builder.hostedPaymentData.offerToSaveCard) {
175
+ request.OFFER_SAVE_CARD = encoder(builder.hostedPaymentData.offerToSaveCard ? "1" : "0" || "");
176
+ }
177
+ if (builder.hostedPaymentData.customerExists) {
178
+ request.PAYER_EXIST = encoder(builder.hostedPaymentData.customerExists ? "1" : "0" || "");
179
+ }
180
+ request.PAYER_REF = encoder(builder.hostedPaymentData.customerKey || "");
181
+ request.PMT_REF = encoder(builder.hostedPaymentData.paymentKey || "");
182
+ request.PROD_ID = encoder(builder.hostedPaymentData.productId || "");
183
+ }
184
+ if (builder.shippingAddress) {
185
+ request.SHIPPING_CODE = encoder(builder.shippingAddress.postalCode || "");
186
+ request.SHIPPING_CO = encoder(builder.shippingAddress.country || "");
187
+ }
188
+ if (builder.sillingAddress) {
189
+ request.BILLING_CODE = encoder(builder.billingAddress.postalCode || "");
190
+ request.BILLING_CO = encoder(builder.billingAddress.country || "");
191
+ }
192
+ request.CUST_NUM = encoder(builder.customerId || "");
193
+ request.VAR_REF = encoder(builder.clientTransactionId || "");
194
+ request.HPP_LANG = encoder(this.hostedPaymentConfig.language || "");
195
+ request.MERCHANT_RESPONSE_URL = encoder(this.hostedPaymentConfig.responseUrl || "");
196
+ request.CARD_PAYMENT_BUTTON = encoder(this.hostedPaymentConfig.paymentButtonText || "");
197
+ if (this.hostedPaymentConfig.cardStorageEnabled) {
198
+ request.CARD_STORAGE_ENABLE = encoder(this.hostedPaymentConfig.cardStorageEnabled ? "1" : "0" || "");
199
+ }
200
+ if (builder.transactionType === __1.TransactionType.Verify) {
201
+ request.VALIDATE_CARD_ONLY = encoder("1" || "");
202
+ }
203
+ if (this.hostedPaymentConfig.fraudFilterMode) {
204
+ request.HPP_FRAUD_FILTER_MODE = encoder(this.hostedPaymentConfig.fraudFilterMode.toString() || "");
205
+ }
206
+ if (builder.recurringType || builder.recurringSequence) {
207
+ if (builder.recurringType) {
208
+ request.RECURRING_TYPE = encoder(builder.recurringType.toString().toLowerCase() || "");
209
+ }
210
+ if (builder.recurringSequence) {
211
+ request.RECURRING_SEQUENCE = encoder(builder.recurringSequence.toString().toLowerCase() || "");
212
+ }
213
+ }
214
+ if (this.hostedPaymentConfig.version) {
215
+ request.HPP_VERSION = encoder(this.hostedPaymentConfig.version.toString() || "");
216
+ }
217
+ var toHash = [
218
+ timestamp,
219
+ this.merchantId,
220
+ orderId,
221
+ builder.amount ? this.numberFormat(builder.amount) : null,
222
+ builder.currency,
223
+ ];
224
+ if (this.hostedPaymentConfig.cardStorageEnabled ||
225
+ (builder.hostedPaymentData && builder.hostedPaymentData.offerToSaveCard)) {
226
+ toHash.push(builder.hostedPaymentData.customerKey
227
+ ? builder.hostedPaymentData.customerKey
228
+ : null);
229
+ toHash.push(builder.hostedPaymentData.paymentKey
230
+ ? builder.hostedPaymentData.paymentKey
231
+ : null);
232
+ }
233
+ if (this.hostedPaymentConfig.fraudFilterMode &&
234
+ this.hostedPaymentConfig.fraudFilterMode !== __1.FraudFilterMode.None) {
235
+ toHash.push(this.hostedPaymentConfig.fraudFilterMode.toString());
236
+ }
237
+ request.SHA1HASH = encoder(__1.GenerationUtils.generateHash(toHash.join("."), this.sharedSecret) || "");
238
+ return JSON.stringify(request);
239
+ };
240
+ RealexConnector.prototype.manageTransaction = function (builder) {
241
+ var _this = this;
242
+ var timestamp = __1.GenerationUtils.generateTimestamp();
243
+ var orderId = builder.orderId || __1.GenerationUtils.generateOrderId();
244
+ // build Request
245
+ var request = elementtree_1.Element("request", {
246
+ timestamp: timestamp,
247
+ type: this.mapManageRequestType(builder.transactionType),
248
+ });
249
+ if (this.merchantId) {
250
+ elementtree_1.SubElement(request, "merchantid").append(elementtree_1.CData(this.merchantId));
251
+ }
252
+ if (this.accountId) {
253
+ elementtree_1.SubElement(request, "account").append(elementtree_1.CData(this.accountId));
254
+ }
255
+ if (this.channel) {
256
+ elementtree_1.SubElement(request, "channel").append(elementtree_1.CData(this.channel));
257
+ }
258
+ elementtree_1.SubElement(request, "orderid").append(elementtree_1.CData(orderId));
259
+ if (builder.paymentMethod) {
260
+ var ref = builder.paymentMethod;
261
+ elementtree_1.SubElement(request, "pasref").append(elementtree_1.CData(ref.transactionId));
262
+ }
263
+ if (builder.amount) {
264
+ var amountAttrs = builder.currency
265
+ ? { currency: builder.currency }
266
+ : {};
267
+ elementtree_1.SubElement(request, "amount", amountAttrs).append(elementtree_1.CData(this.numberFormat(builder.amount)));
268
+ }
269
+ else if (builder.transactionType === __1.TransactionType.Capture) {
270
+ throw new __1.BuilderError("Amount cannot be null for capture");
271
+ }
272
+ if (builder.transactionType === __1.TransactionType.Refund) {
273
+ if (builder.authorizationCode) {
274
+ elementtree_1.SubElement(request, "authcode").append(elementtree_1.CData(builder.authorizationCode));
275
+ }
276
+ elementtree_1.SubElement(request, "refundhash").append(elementtree_1.CData(__1.GenerationUtils.generateHash(this.rebatePassword)));
277
+ }
278
+ if (builder.reasonCode) {
279
+ elementtree_1.SubElement(request, "reasoncode").append(elementtree_1.CData(builder.reasonCode.toString()));
280
+ }
281
+ if (builder.description) {
282
+ var comments = elementtree_1.SubElement(request, "comments");
283
+ elementtree_1.SubElement(comments, "comment", { id: 1 }).append(elementtree_1.CData(builder.description));
284
+ }
285
+ elementtree_1.SubElement(request, "sha1hash").append(elementtree_1.CData(this.generateHash(timestamp, orderId, builder.amount ? this.numberFormat(builder.amount) : "", builder.currency, "")));
286
+ return this.doTransaction(this.buildEnvelope(request)).then(function (response) {
287
+ return _this.mapResponse(response);
288
+ });
289
+ };
290
+ RealexConnector.prototype.processReport = function (_builder) {
291
+ throw new __1.UnsupportedTransactionError("Reporting functionality is not supported through this gateway.");
292
+ };
293
+ RealexConnector.prototype.processRecurring = function (builder) {
294
+ var _this = this;
295
+ var timestamp = __1.GenerationUtils.generateTimestamp();
296
+ var orderId = builder.orderId || __1.GenerationUtils.generateOrderId();
297
+ // build Request
298
+ var request = elementtree_1.Element("request", {
299
+ timestamp: timestamp,
300
+ type: this.mapRecurringRequestType(builder),
301
+ });
302
+ if (this.merchantId) {
303
+ elementtree_1.SubElement(request, "merchantid").append(elementtree_1.CData(this.merchantId));
304
+ }
305
+ if (this.accountId) {
306
+ elementtree_1.SubElement(request, "account").append(elementtree_1.CData(this.accountId));
307
+ }
308
+ elementtree_1.SubElement(request, "orderid").append(elementtree_1.CData(orderId));
309
+ if (builder.transactionType === __1.TransactionType.Create ||
310
+ builder.transactionType === __1.TransactionType.Edit) {
311
+ if (builder.entity instanceof __1.Customer) {
312
+ var customer = builder.entity;
313
+ request.append(this.buildCustomer(customer));
314
+ elementtree_1.SubElement(request, "sha1hash").append(elementtree_1.CData(__1.GenerationUtils.generateHash([timestamp, this.merchantId, orderId, "", "", customer.key].join("."), this.sharedSecret)));
315
+ }
316
+ else if (builder.entity instanceof __1.RecurringPaymentMethod) {
317
+ var payment = builder.entity;
318
+ var cardElement = elementtree_1.SubElement(request, "card");
319
+ elementtree_1.SubElement(cardElement, "ref").append(elementtree_1.CData(payment.key || payment.id));
320
+ elementtree_1.SubElement(cardElement, "payerref").append(elementtree_1.CData(payment.customerKey));
321
+ if (payment.paymentMethod) {
322
+ var card = payment.paymentMethod;
323
+ var expiry = __1.StringUtils.leftPad(card.expMonth, 2, "0") +
324
+ __1.StringUtils.leftPad((card.expYear || "").substr(2, 2), 2, "0");
325
+ elementtree_1.SubElement(cardElement, "number").append(elementtree_1.CData(card.number));
326
+ elementtree_1.SubElement(cardElement, "expdate").append(elementtree_1.CData(expiry));
327
+ elementtree_1.SubElement(cardElement, "chname").append(elementtree_1.CData(card.cardHolderName));
328
+ elementtree_1.SubElement(cardElement, "type").append(elementtree_1.CData(card.getCardType().toUpperCase()));
329
+ var sha1hash = "";
330
+ if (builder.transactionType === __1.TransactionType.Create) {
331
+ sha1hash = __1.GenerationUtils.generateHash([
332
+ timestamp,
333
+ this.merchantId,
334
+ orderId,
335
+ "",
336
+ "",
337
+ payment.customerKey,
338
+ card.cardHolderName,
339
+ card.number,
340
+ ].join("."), this.sharedSecret);
341
+ }
342
+ else {
343
+ sha1hash = __1.GenerationUtils.generateHash([
344
+ timestamp,
345
+ this.merchantId,
346
+ payment.customerKey,
347
+ payment.key || payment.id,
348
+ expiry,
349
+ card.number,
350
+ ].join("."), this.sharedSecret);
351
+ }
352
+ elementtree_1.SubElement(request, "sha1hash").append(elementtree_1.CData(sha1hash));
353
+ }
354
+ }
355
+ }
356
+ else if (builder.transactionType === __1.TransactionType.Delete) {
357
+ if (builder.entity instanceof __1.RecurringPaymentMethod) {
358
+ var payment = builder.entity;
359
+ var cardElement = elementtree_1.SubElement(request, "card");
360
+ elementtree_1.SubElement(cardElement, "ref").append(elementtree_1.CData(payment.key || payment.id));
361
+ elementtree_1.SubElement(cardElement, "payerref").append(elementtree_1.CData(payment.customerKey));
362
+ }
363
+ }
364
+ return this.doTransaction(this.buildEnvelope(request)).then(function (response) {
365
+ return _this.mapRecurringResponse(response, builder);
366
+ });
367
+ };
368
+ RealexConnector.prototype.buildEnvelope = function (transaction) {
369
+ return new elementtree_1.ElementTree(transaction).write();
370
+ };
371
+ RealexConnector.prototype.buildCustomer = function (customer) {
372
+ var payer = elementtree_1.Element("payer", {
373
+ ref: customer.key || __1.StringUtils.uuid(),
374
+ type: "Retail",
375
+ });
376
+ elementtree_1.SubElement(payer, "title").append(elementtree_1.CData(customer.title));
377
+ elementtree_1.SubElement(payer, "firstname").append(elementtree_1.CData(customer.firstName));
378
+ elementtree_1.SubElement(payer, "surname").append(elementtree_1.CData(customer.lastName));
379
+ elementtree_1.SubElement(payer, "company").append(elementtree_1.CData(customer.company));
380
+ if (customer.address) {
381
+ var address = elementtree_1.SubElement(payer, "address");
382
+ elementtree_1.SubElement(address, "line1").append(elementtree_1.CData(customer.address.streetAddress1));
383
+ elementtree_1.SubElement(address, "line2").append(elementtree_1.CData(customer.address.streetAddress2));
384
+ elementtree_1.SubElement(address, "line3").append(elementtree_1.CData(customer.address.streetAddress3));
385
+ elementtree_1.SubElement(address, "city").append(elementtree_1.CData(customer.address.city));
386
+ elementtree_1.SubElement(address, "county").append(elementtree_1.CData(customer.address.province));
387
+ elementtree_1.SubElement(address, "postcode").append(elementtree_1.CData(customer.address.postalCode));
388
+ if (customer.address.country) {
389
+ elementtree_1.SubElement(address, "country", { code: "GB" }).append(elementtree_1.CData(customer.address.country));
390
+ }
391
+ }
392
+ var phone = elementtree_1.SubElement(payer, "phonenumbers");
393
+ elementtree_1.SubElement(phone, "home").append(elementtree_1.CData(customer.homePhone));
394
+ elementtree_1.SubElement(phone, "work").append(elementtree_1.CData(customer.workPhone));
395
+ elementtree_1.SubElement(phone, "fax").append(elementtree_1.CData(customer.fax));
396
+ elementtree_1.SubElement(phone, "mobile").append(elementtree_1.CData(customer.mobilePhone));
397
+ elementtree_1.SubElement(payer, "email").append(elementtree_1.CData(customer.email));
398
+ return payer;
399
+ };
400
+ RealexConnector.prototype.mapResponse = function (rawResponse) {
401
+ var result = new __1.Transaction();
402
+ var root = elementtree_1.XML(rawResponse);
403
+ this.checkResponse(root);
404
+ result.responseCode = root.findtext(".//result");
405
+ result.responseMessage = root.findtext(".//message");
406
+ result.cvnResponseCode = root.findtext(".//cvnresult");
407
+ result.avsResponseCode = root.findtext(".//avspostcoderesponse");
408
+ result.timestamp = root.findtext(".//timestamp");
409
+ result.transactionReference = new __1.TransactionReference();
410
+ result.transactionReference.authCode = root.findtext(".//authcode");
411
+ result.transactionReference.orderId = root.findtext(".//orderid");
412
+ result.transactionReference.paymentMethodType = __1.PaymentMethodType.Credit;
413
+ result.transactionReference.transactionId = root.findtext(".//pasref");
414
+ return result;
415
+ };
416
+ RealexConnector.prototype.mapRecurringResponse = function (rawResponse, builder) {
417
+ var root = elementtree_1.XML(rawResponse);
418
+ this.checkResponse(root);
419
+ return builder.entity;
420
+ };
421
+ RealexConnector.prototype.checkResponse = function (root, acceptedCodes) {
422
+ if (!acceptedCodes) {
423
+ acceptedCodes = ["00"];
424
+ }
425
+ var responseCode = root.findtext(".//result");
426
+ var responseMessage = root.findtext(".//message");
427
+ if (acceptedCodes.indexOf(responseCode) === -1) {
428
+ throw new __1.GatewayError("Unexpected Gateway Response: " + responseCode + " - " + responseMessage, responseCode, responseMessage);
429
+ }
430
+ };
431
+ RealexConnector.prototype.generateHash = function (timestamp, orderId, amount, currency, paymentData, verify) {
432
+ if (verify === void 0) { verify = false; }
433
+ var data = [timestamp, this.merchantId, orderId];
434
+ if (false === verify) {
435
+ data.push(amount);
436
+ data.push(currency);
437
+ }
438
+ data.push(paymentData);
439
+ return __1.GenerationUtils.generateHash(data.join("."), this.sharedSecret);
440
+ };
441
+ RealexConnector.prototype.mapAuthRequestType = function (builder) {
442
+ switch (builder.transactionType) {
443
+ case __1.TransactionType.Sale:
444
+ case __1.TransactionType.Auth:
445
+ if (builder.paymentMethod.paymentMethodType === __1.PaymentMethodType.Credit) {
446
+ if (builder.transactionModifier === __1.TransactionModifier.Offline) {
447
+ return "offline";
448
+ }
449
+ if (builder.transactionModifier === __1.TransactionModifier.EncryptedMobile) {
450
+ return "auth-mobile";
451
+ }
452
+ return "auth";
453
+ }
454
+ return "receipt-in";
455
+ case __1.TransactionType.Capture:
456
+ return "settle";
457
+ case __1.TransactionType.Verify:
458
+ if (builder.paymentMethod.paymentMethodType === __1.PaymentMethodType.Credit) {
459
+ return "otb";
460
+ }
461
+ return "receipt-in-otb";
462
+ case __1.TransactionType.Refund:
463
+ if (builder.paymentMethod.paymentMethodType === __1.PaymentMethodType.Credit) {
464
+ return "credit";
465
+ }
466
+ return "payment-out";
467
+ case __1.TransactionType.Reversal:
468
+ default:
469
+ throw new __1.UnsupportedTransactionError("The selected gateway does not support this transaction type.");
470
+ }
471
+ };
472
+ RealexConnector.prototype.mapManageRequestType = function (type) {
473
+ switch (type) {
474
+ case __1.TransactionType.Capture:
475
+ return "settle";
476
+ case __1.TransactionType.Hold:
477
+ return "hold";
478
+ case __1.TransactionType.Refund:
479
+ return "rebate";
480
+ case __1.TransactionType.Release:
481
+ return "release";
482
+ case __1.TransactionType.Void:
483
+ case __1.TransactionType.Reversal:
484
+ return "void";
485
+ default:
486
+ return "unknown";
487
+ }
488
+ };
489
+ RealexConnector.prototype.mapRecurringRequestType = function (builder) {
490
+ var entity = builder.entity;
491
+ switch (builder.transactionType) {
492
+ case __1.TransactionType.Create:
493
+ if (entity instanceof __1.Customer) {
494
+ return "payer-new";
495
+ }
496
+ if (entity instanceof __1.Schedule) {
497
+ throw new __1.UnsupportedTransactionError();
498
+ }
499
+ return "card-new";
500
+ case __1.TransactionType.Edit:
501
+ if (entity instanceof __1.Customer) {
502
+ return "payer-edit";
503
+ }
504
+ if (entity instanceof __1.Schedule) {
505
+ throw new __1.UnsupportedTransactionError();
506
+ }
507
+ return "card-update-card";
508
+ case __1.TransactionType.Delete:
509
+ if (entity instanceof __1.Customer || entity instanceof __1.Schedule) {
510
+ throw new __1.UnsupportedTransactionError();
511
+ }
512
+ return "card-cancel-card";
513
+ default:
514
+ throw new __1.UnsupportedTransactionError();
515
+ }
516
+ };
517
+ RealexConnector.prototype.numberFormat = function (amount) {
518
+ var f = parseFloat(amount.toString()) * 100;
519
+ return parseFloat(f.toFixed(2)).toString();
520
+ };
521
+ return RealexConnector;
522
+ }(XmlGateway_1.XmlGateway));
523
+ exports.RealexConnector = RealexConnector;
@@ -1,4 +1,4 @@
1
- import { AuthorizationBuilder, DccProcessor, DccRateType, EncryptionData, InquiryType, ManagementBuilder, PaymentMethodType, PaymentMethodUsageMode, Transaction } from "../";
1
+ import { AuthorizationBuilder, DccProcessor, DccRateType, EncryptionData, InquiryType, ManagementBuilder, PaymentMethodType, PaymentMethodUsageMode, ThreeDSecure, Transaction } from "../";
2
2
  import { IAuthable, IBalanceable, IChargable, IEncryptable, IPrePayable, IRefundable, IReversable, ISecure3d, ITokenizable, IVerifyable } from "./Interfaces";
3
3
  import { PaymentMethod } from "./PaymentMethod";
4
4
  export declare abstract class Credit extends PaymentMethod implements IEncryptable, ITokenizable, IChargable, IAuthable, IRefundable, IReversable, IVerifyable, IPrePayable, IBalanceable, ISecure3d {
@@ -22,6 +22,7 @@ export declare abstract class Credit extends PaymentMethod implements IEncryptab
22
22
  paymentSource: string;
23
23
  cryptogram: string;
24
24
  eci: string;
25
+ threeDSecure: ThreeDSecure;
25
26
  /**
26
27
  * Authorizes the payment method
27
28
  *
@@ -24,6 +24,7 @@ class Credit extends PaymentMethod_1.PaymentMethod {
24
24
  paymentSource;
25
25
  cryptogram;
26
26
  eci;
27
+ threeDSecure;
27
28
  /**
28
29
  * Authorizes the payment method
29
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Credit.js","sourceRoot":"","sources":["../../../src/PaymentMethods/Credit.ts"],"names":[],"mappings":";;;AAAA,2BAaa;AAab,mDAAgD;AAEhD,MAAsB,MACpB,SAAQ,6BAAa;IAad,cAAc,CAAiB;IAC/B,iBAAiB,GAAG,qBAAiB,CAAC,MAAM,CAAC;IAEpD;;;;;OAKG;IACI,KAAK,CAAS;IAErB;;;OAGG;IACI,UAAU,CAAS;IAC1B;;OAEG;IACI,aAAa,CAAS;IACtB,UAAU,CAAS;IACnB,GAAG,CAAS;IAEnB;;;;;;OAMG;IACI,SAAS,CAAC,MAAwB;QACvC,OAAO,IAAI,wBAAoB,CAAC,mBAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,UAAU,CACpE,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAwB;QACpC,OAAO,IAAI,wBAAoB,CAAC,mBAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,UAAU,CACpE,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,MAAwB;QACtC,OAAO,IAAI,wBAAoB,CAAC,mBAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,UAAU,CACxE,MAAM,CACP,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,OAAqB;QACzC,OAAO,IAAI,wBAAoB,CAC7B,mBAAe,CAAC,OAAO,EACvB,IAAI,CACL,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAwB;QACpC,OAAO,IAAI,wBAAoB,CAAC,mBAAe,CAAC,MAAM,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,IAAI,CAAC,KAAK,EAAE;YACf,MAAM,IAAI,gBAAY,CAAC,+BAA+B,CAAC,CAAC;SACzD;QAED,OAAO,MAAM,IAAI,qBAAiB,CAChC,mBAAe,CAAC,UAAU,EAC1B,IAAI,CACL,CAAC,OAAO,EAAE,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,WAAyB,EAAE,GAAkB;QAC7D,MAAM,WAAW,GAAG,IAAI,wBAAoB,CAC1C,mBAAe,CAAC,aAAa,EAC7B,IAAI,CACL,CAAC;QAEF,IAAI,WAAW,IAAI,GAAG,EAAE;YACtB,MAAM,WAAW,GAAG,IAAI,eAAW,EAAE,CAAC;YACtC,IAAI,GAAG;gBAAE,WAAW,CAAC,YAAY,GAAG,GAAG,CAAC;YACxC,IAAI,WAAW;gBAAE,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC;YACvD,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;SAC1C;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAlOD,wBAkOC"}
@@ -0,0 +1,27 @@
1
+ import { HostedPaymentConfig } from "./";
2
+ export declare class ServicesConfig {
3
+ siteId: string;
4
+ licenseId: string;
5
+ deviceId: string;
6
+ username: string;
7
+ password: string;
8
+ developerId: string;
9
+ versionNumber: string;
10
+ secretApiKey: string;
11
+ sdkNameVersion: string;
12
+ accountId: string;
13
+ merchantId: string;
14
+ sharedSecret: string;
15
+ channel: string;
16
+ rebatePassword: string;
17
+ refundPassword: string;
18
+ hostedPaymentConfig: HostedPaymentConfig;
19
+ certificationStr: string;
20
+ terminalID: string;
21
+ x509CertificateString: string;
22
+ x509CertificationPath: string;
23
+ serviceUrl: string;
24
+ timeout: number;
25
+ constructor();
26
+ validate(): void;
27
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServicesConfig = void 0;
4
+ var _1 = require("./");
5
+ var ServicesConfig = /** @class */ (function () {
6
+ function ServicesConfig() {
7
+ this.timeout = 65000;
8
+ }
9
+ ServicesConfig.prototype.validate = function () {
10
+ // portico api key
11
+ if (this.secretApiKey) {
12
+ if (this.siteId ||
13
+ this.licenseId ||
14
+ this.deviceId ||
15
+ this.username ||
16
+ this.password) {
17
+ throw new _1.ConfigurationError("Configuration contains both secret api key and legacy credentials. These are mutually exclusive.");
18
+ }
19
+ }
20
+ // portico legacy
21
+ if (this.siteId ||
22
+ this.licenseId ||
23
+ this.deviceId ||
24
+ this.username ||
25
+ this.password) {
26
+ if (!(this.siteId &&
27
+ this.licenseId &&
28
+ this.deviceId &&
29
+ this.username &&
30
+ this.password)) {
31
+ throw new _1.ConfigurationError("Site, License, Device, Username and Password should all have a values for this configuration.");
32
+ }
33
+ }
34
+ // realex
35
+ if (this.merchantId || this.sharedSecret) {
36
+ if (!this.merchantId) {
37
+ throw new _1.ConfigurationError("MerchantId is required for this configuration.");
38
+ }
39
+ if (!this.sharedSecret) {
40
+ throw new _1.ConfigurationError("SharedSecret is required for this configuration.");
41
+ }
42
+ }
43
+ // service url
44
+ if (!this.serviceUrl) {
45
+ throw new _1.ConfigurationError("Service URL could not be determined from the credentials provided. Please specify an endpoint.");
46
+ }
47
+ };
48
+ return ServicesConfig;
49
+ }());
50
+ exports.ServicesConfig = ServicesConfig;