globalpayments-api 1.4.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/package.json +3 -4
  3. package/lib/src/Builders/AuthorizationBuilder.d.ts +0 -325
  4. package/lib/src/Builders/AuthorizationBuilder.js +0 -599
  5. package/lib/src/Builders/BaseBuilder/ValidationClause.d.ts +0 -14
  6. package/lib/src/Builders/BaseBuilder/ValidationClause.js +0 -61
  7. package/lib/src/Builders/BaseBuilder/ValidationTarget.d.ts +0 -16
  8. package/lib/src/Builders/BaseBuilder/ValidationTarget.js +0 -28
  9. package/lib/src/Builders/BaseBuilder/Validations.d.ts +0 -11
  10. package/lib/src/Builders/BaseBuilder/Validations.js +0 -56
  11. package/lib/src/Builders/BaseBuilder.d.ts +0 -11
  12. package/lib/src/Builders/BaseBuilder.js +0 -16
  13. package/lib/src/Builders/ManagementBuilder.d.ts +0 -103
  14. package/lib/src/Builders/ManagementBuilder.js +0 -227
  15. package/lib/src/Builders/RecurringBuilder.d.ts +0 -13
  16. package/lib/src/Builders/RecurringBuilder.js +0 -47
  17. package/lib/src/Builders/ReportBuilder.d.ts +0 -8
  18. package/lib/src/Builders/ReportBuilder.js +0 -36
  19. package/lib/src/Builders/TransactionBuilder.d.ts +0 -10
  20. package/lib/src/Builders/TransactionBuilder.js +0 -46
  21. package/lib/src/Builders/TransactionReportBuilder.d.ts +0 -15
  22. package/lib/src/Builders/TransactionReportBuilder.js +0 -79
  23. package/lib/src/Builders/index.d.ts +0 -7
  24. package/lib/src/Builders/index.js +0 -19
  25. package/lib/src/Entities/Address.d.ts +0 -13
  26. package/lib/src/Entities/Address.js +0 -19
  27. package/lib/src/Entities/BatchSummary.d.ts +0 -6
  28. package/lib/src/Entities/BatchSummary.js +0 -9
  29. package/lib/src/Entities/Customer.d.ts +0 -64
  30. package/lib/src/Entities/Customer.js +0 -47
  31. package/lib/src/Entities/EcommerceInfo.d.ts +0 -12
  32. package/lib/src/Entities/EcommerceInfo.js +0 -14
  33. package/lib/src/Entities/EncryptionData.d.ts +0 -6
  34. package/lib/src/Entities/EncryptionData.js +0 -9
  35. package/lib/src/Entities/Enums.d.ts +0 -230
  36. package/lib/src/Entities/Enums.js +0 -267
  37. package/lib/src/Entities/Errors.d.ts +0 -23
  38. package/lib/src/Entities/Errors.js +0 -106
  39. package/lib/src/Entities/HostedPaymentData.d.ts +0 -10
  40. package/lib/src/Entities/HostedPaymentData.js +0 -10
  41. package/lib/src/Entities/RecurringEntity.d.ts +0 -14
  42. package/lib/src/Entities/RecurringEntity.js +0 -86
  43. package/lib/src/Entities/Schedule.d.ts +0 -47
  44. package/lib/src/Entities/Schedule.js +0 -253
  45. package/lib/src/Entities/Transaction.d.ts +0 -76
  46. package/lib/src/Entities/Transaction.js +0 -108
  47. package/lib/src/Entities/TransactionSummary.d.ts +0 -61
  48. package/lib/src/Entities/TransactionSummary.js +0 -9
  49. package/lib/src/Entities/index.d.ts +0 -12
  50. package/lib/src/Entities/index.js +0 -24
  51. package/lib/src/Gateways/Gateway.d.ts +0 -10
  52. package/lib/src/Gateways/Gateway.js +0 -42
  53. package/lib/src/Gateways/IPaymentGateway.d.ts +0 -8
  54. package/lib/src/Gateways/IPaymentGateway.js +0 -2
  55. package/lib/src/Gateways/IRecurringService.d.ts +0 -6
  56. package/lib/src/Gateways/IRecurringService.js +0 -2
  57. package/lib/src/Gateways/PayPlanConnector.d.ts +0 -42
  58. package/lib/src/Gateways/PayPlanConnector.js +0 -552
  59. package/lib/src/Gateways/PorticoConnector.d.ts +0 -44
  60. package/lib/src/Gateways/PorticoConnector.js +0 -1018
  61. package/lib/src/Gateways/RealexConnector.d.ts +0 -30
  62. package/lib/src/Gateways/RealexConnector.js +0 -523
  63. package/lib/src/Gateways/RestGateway.d.ts +0 -6
  64. package/lib/src/Gateways/RestGateway.js +0 -31
  65. package/lib/src/Gateways/XmlGateway.d.ts +0 -6
  66. package/lib/src/Gateways/XmlGateway.js +0 -38
  67. package/lib/src/Gateways/https-wrapper.d.ts +0 -3
  68. package/lib/src/Gateways/https-wrapper.js +0 -35
  69. package/lib/src/Gateways/index.d.ts +0 -7
  70. package/lib/src/Gateways/index.js +0 -19
  71. package/lib/src/HostedPaymentConfig.d.ts +0 -12
  72. package/lib/src/HostedPaymentConfig.js +0 -9
  73. package/lib/src/PaymentMethods/Cash.d.ts +0 -8
  74. package/lib/src/PaymentMethods/Cash.js +0 -36
  75. package/lib/src/PaymentMethods/Credit.d.ts +0 -85
  76. package/lib/src/PaymentMethods/Credit.js +0 -106
  77. package/lib/src/PaymentMethods/CreditCardData.d.ts +0 -19
  78. package/lib/src/PaymentMethods/CreditCardData.js +0 -51
  79. package/lib/src/PaymentMethods/CreditTrackData.d.ts +0 -7
  80. package/lib/src/PaymentMethods/CreditTrackData.js +0 -27
  81. package/lib/src/PaymentMethods/Debit.d.ts +0 -40
  82. package/lib/src/PaymentMethods/Debit.js +0 -70
  83. package/lib/src/PaymentMethods/DebitTrackData.d.ts +0 -7
  84. package/lib/src/PaymentMethods/DebitTrackData.js +0 -27
  85. package/lib/src/PaymentMethods/EBT.d.ts +0 -48
  86. package/lib/src/PaymentMethods/EBT.js +0 -88
  87. package/lib/src/PaymentMethods/EBTCardData.d.ts +0 -16
  88. package/lib/src/PaymentMethods/EBTCardData.js +0 -32
  89. package/lib/src/PaymentMethods/EBTTrackData.d.ts +0 -8
  90. package/lib/src/PaymentMethods/EBTTrackData.js +0 -27
  91. package/lib/src/PaymentMethods/ECheck.d.ts +0 -32
  92. package/lib/src/PaymentMethods/ECheck.js +0 -40
  93. package/lib/src/PaymentMethods/GiftCard.d.ts +0 -131
  94. package/lib/src/PaymentMethods/GiftCard.js +0 -205
  95. package/lib/src/PaymentMethods/Interfaces.d.ts +0 -55
  96. package/lib/src/PaymentMethods/Interfaces.js +0 -2
  97. package/lib/src/PaymentMethods/PaymentMethod.d.ts +0 -19
  98. package/lib/src/PaymentMethods/PaymentMethod.js +0 -114
  99. package/lib/src/PaymentMethods/RecurringPaymentMethod.d.ts +0 -23
  100. package/lib/src/PaymentMethods/RecurringPaymentMethod.js +0 -77
  101. package/lib/src/PaymentMethods/TransactionReference.d.ts +0 -10
  102. package/lib/src/PaymentMethods/TransactionReference.js +0 -12
  103. package/lib/src/PaymentMethods/index.d.ts +0 -15
  104. package/lib/src/PaymentMethods/index.js +0 -27
  105. package/lib/src/Services/BatchService.d.ts +0 -4
  106. package/lib/src/Services/BatchService.js +0 -17
  107. package/lib/src/Services/CheckService.d.ts +0 -6
  108. package/lib/src/Services/CheckService.js +0 -20
  109. package/lib/src/Services/CreditService.d.ts +0 -12
  110. package/lib/src/Services/CreditService.js +0 -54
  111. package/lib/src/Services/DebitService.d.ts +0 -7
  112. package/lib/src/Services/DebitService.js +0 -28
  113. package/lib/src/Services/EBTService.d.ts +0 -8
  114. package/lib/src/Services/EBTService.js +0 -32
  115. package/lib/src/Services/GiftService.d.ts +0 -16
  116. package/lib/src/Services/GiftService.js +0 -54
  117. package/lib/src/Services/HostedService.d.ts +0 -9
  118. package/lib/src/Services/HostedService.js +0 -59
  119. package/lib/src/Services/RecurringService.d.ts +0 -8
  120. package/lib/src/Services/RecurringService.js +0 -27
  121. package/lib/src/Services/ReportingService.d.ts +0 -6
  122. package/lib/src/Services/ReportingService.js +0 -19
  123. package/lib/src/Services/index.d.ts +0 -9
  124. package/lib/src/Services/index.js +0 -21
  125. package/lib/src/ServicesConfig.d.ts +0 -23
  126. package/lib/src/ServicesConfig.js +0 -50
  127. package/lib/src/ServicesContainer.d.ts +0 -11
  128. package/lib/src/ServicesContainer.js +0 -73
  129. package/lib/src/Utils/GenerationUtils.d.ts +0 -5
  130. package/lib/src/Utils/GenerationUtils.js +0 -36
  131. package/lib/src/Utils/InputValidation.d.ts +0 -12
  132. package/lib/src/Utils/InputValidation.js +0 -72
  133. package/lib/src/Utils/Sha1.d.ts +0 -6
  134. package/lib/src/Utils/Sha1.js +0 -225
  135. package/lib/src/Utils/StringUtils.d.ts +0 -6
  136. package/lib/src/Utils/StringUtils.js +0 -53
  137. package/lib/src/Utils/index.d.ts +0 -2
  138. package/lib/src/Utils/index.js +0 -14
  139. package/lib/src/index.d.ts +0 -11
  140. package/lib/src/index.js +0 -27
  141. package/lib/test/Data/TestCards.d.ts +0 -24
  142. package/lib/test/Data/TestCards.js +0 -232
  143. package/lib/test/Data/TestChecks.d.ts +0 -4
  144. package/lib/test/Data/TestChecks.js +0 -32
  145. package/lib/test/Data/index.d.ts +0 -2
  146. package/lib/test/Data/index.js +0 -14
  147. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.d.ts +0 -1
  148. package/lib/test/Integration/Gateways/PorticoConnector/AchTest.js +0 -112
  149. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.d.ts +0 -1
  150. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/CheckTest.js +0 -483
  151. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.d.ts +0 -1
  152. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceCheckTest.js +0 -83
  153. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.d.ts +0 -1
  154. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.js +0 -1720
  155. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.d.ts +0 -1
  156. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoCheckTest.js +0 -83
  157. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.d.ts +0 -1
  158. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/MotoTest.js +0 -1757
  159. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.d.ts +0 -1
  160. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.js +0 -682
  161. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.d.ts +0 -1
  162. package/lib/test/Integration/Gateways/PorticoConnector/Certifications/RetailTest.js +0 -2218
  163. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.d.ts +0 -1
  164. package/lib/test/Integration/Gateways/PorticoConnector/CreditTest.js +0 -708
  165. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.d.ts +0 -1
  166. package/lib/test/Integration/Gateways/PorticoConnector/DebitTest.js +0 -151
  167. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.d.ts +0 -1
  168. package/lib/test/Integration/Gateways/PorticoConnector/EbtTest.js +0 -171
  169. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.d.ts +0 -1
  170. package/lib/test/Integration/Gateways/PorticoConnector/EcommerceTest.js +0 -192
  171. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.d.ts +0 -1
  172. package/lib/test/Integration/Gateways/PorticoConnector/GiftTest.js +0 -377
  173. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.d.ts +0 -1
  174. package/lib/test/Integration/Gateways/PorticoConnector/RecurringTest.js +0 -196
  175. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.d.ts +0 -1
  176. package/lib/test/Integration/Gateways/PorticoConnector/ReportingTest.js +0 -47
  177. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.d.ts +0 -1
  178. package/lib/test/Integration/Gateways/RealexConnector/Certification/AuthTest.js +0 -4373
  179. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.d.ts +0 -1
  180. package/lib/test/Integration/Gateways/RealexConnector/Certification/AvsTest.js +0 -758
  181. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.d.ts +0 -1
  182. package/lib/test/Integration/Gateways/RealexConnector/Certification/CreditTest.js +0 -2399
  183. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.d.ts +0 -1
  184. package/lib/test/Integration/Gateways/RealexConnector/Certification/HoldTest.js +0 -1656
  185. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.d.ts +0 -1
  186. package/lib/test/Integration/Gateways/RealexConnector/Certification/ManualTest.js +0 -5650
  187. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.d.ts +0 -1
  188. package/lib/test/Integration/Gateways/RealexConnector/Certification/OtbTest.js +0 -1985
  189. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.d.ts +0 -1
  190. package/lib/test/Integration/Gateways/RealexConnector/Certification/RebateTest.js +0 -2369
  191. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.d.ts +0 -1
  192. package/lib/test/Integration/Gateways/RealexConnector/Certification/ReleaseTest.js +0 -1703
  193. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.d.ts +0 -1
  194. package/lib/test/Integration/Gateways/RealexConnector/Certification/SettleTest.js +0 -2053
  195. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.d.ts +0 -1
  196. package/lib/test/Integration/Gateways/RealexConnector/Certification/ValidationTest.js +0 -2469
  197. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.d.ts +0 -1
  198. package/lib/test/Integration/Gateways/RealexConnector/Certification/VerifyEnrolledTest.js +0 -3116
  199. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.d.ts +0 -1
  200. package/lib/test/Integration/Gateways/RealexConnector/Certification/VoidTest.js +0 -2031
  201. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.d.ts +0 -1
  202. package/lib/test/Integration/Gateways/RealexConnector/CreditTest.js +0 -322
  203. package/lib/test/Integration/Gateways/RealexConnector/HppTest.d.ts +0 -1
  204. package/lib/test/Integration/Gateways/RealexConnector/HppTest.js +0 -98
  205. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.d.ts +0 -1
  206. package/lib/test/Integration/Gateways/RealexConnector/RecurringTest.js +0 -263
  207. package/lib/test/Integration/Services/CheckServiceTest.d.ts +0 -1
  208. package/lib/test/Integration/Services/CheckServiceTest.js +0 -98
  209. package/lib/test/Integration/Services/CreditServiceTest.d.ts +0 -1
  210. package/lib/test/Integration/Services/CreditServiceTest.js +0 -313
  211. package/lib/test/Integration/Services/DebitServiceTest.d.ts +0 -1
  212. package/lib/test/Integration/Services/DebitServiceTest.js +0 -154
  213. package/lib/test/Integration/Services/EBTServiceTest.d.ts +0 -1
  214. package/lib/test/Integration/Services/EBTServiceTest.js +0 -135
  215. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.d.ts +0 -1
  216. package/lib/test/Unit/Builders/AuthorizationBuilder/ValidationTest.js +0 -161
  217. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.d.ts +0 -1
  218. package/lib/test/Unit/Builders/ReportBuilder/ValidationTest.js +0 -139
  219. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.d.ts +0 -1
  220. package/lib/test/Unit/Gateways/PorticoConnector/InputValidationTest.js +0 -202
  221. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.d.ts +0 -1
  222. package/lib/test/Unit/Gateways/RealexConnector/CreditTest.js +0 -29
  223. package/logger.txt +0 -4
@@ -1,552 +0,0 @@
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.PayPlanConnector = void 0;
19
- var __1 = require("../");
20
- var RestGateway_1 = require("./RestGateway");
21
- var PayPlanConnector = /** @class */ (function (_super) {
22
- __extends(PayPlanConnector, _super);
23
- function PayPlanConnector() {
24
- var _this = _super !== null && _super.apply(this, arguments) || this;
25
- _this.supportsRetrieval = true;
26
- _this.supportsUpdatePaymentDetails = false;
27
- return _this;
28
- }
29
- Object.defineProperty(PayPlanConnector.prototype, "secretApiKey", {
30
- get: function () {
31
- return this._secretApiKey;
32
- },
33
- set: function (value) {
34
- if (!value) {
35
- return;
36
- }
37
- this._secretApiKey = value;
38
- this.setAuthorizationHeader(this.secretApiKey);
39
- },
40
- enumerable: false,
41
- configurable: true
42
- });
43
- Object.defineProperty(PayPlanConnector.prototype, "username", {
44
- get: function () {
45
- return this._username;
46
- },
47
- set: function (value) {
48
- if (!value) {
49
- return;
50
- }
51
- this._username = value;
52
- this.setAuthorizationHeader(this.username + ":" + this.password);
53
- },
54
- enumerable: false,
55
- configurable: true
56
- });
57
- Object.defineProperty(PayPlanConnector.prototype, "password", {
58
- get: function () {
59
- return this._password;
60
- },
61
- set: function (value) {
62
- if (!value) {
63
- return;
64
- }
65
- this._password = value;
66
- this.setAuthorizationHeader(this.username + ":" + this.password);
67
- },
68
- enumerable: false,
69
- configurable: true
70
- });
71
- PayPlanConnector.prototype.processRecurring = function (builder) {
72
- var _this = this;
73
- var request = new Object();
74
- // todo
75
- if (builder.transactionType === __1.TransactionType.Create ||
76
- builder.transactionType === __1.TransactionType.Edit) {
77
- if (builder.entity instanceof __1.Customer) {
78
- request = this.buildCustomer(request, builder.entity);
79
- }
80
- if (builder.entity instanceof __1.RecurringPaymentMethod) {
81
- request = this.buildPaymentMethod(request, builder.entity, builder.transactionType);
82
- }
83
- if (builder.entity instanceof __1.Schedule) {
84
- request = this.buildSchedule(request, builder.entity, builder.transactionType);
85
- }
86
- }
87
- else if (builder.transactionType === __1.TransactionType.Search) {
88
- for (var entry in builder.searchCriteria) {
89
- if (builder.searchCriteria.hasOwnProperty(entry)) {
90
- request[entry] = builder.searchCriteria[entry];
91
- }
92
- }
93
- }
94
- this.maybeSetIdentityHeader();
95
- this.maybeSetIntegrationHeader();
96
- return this.doTransaction(this.mapMethod(builder.transactionType), this.mapUrl(builder), JSON.stringify(request)).then(function (response) { return _this.mapResponse(builder, response); });
97
- };
98
- PayPlanConnector.prototype.mapResponse = function (builder, rawResponse) {
99
- var _this = this;
100
- if (!rawResponse) {
101
- return new Object();
102
- }
103
- var response = JSON.parse(rawResponse);
104
- var result;
105
- if ((builder.entity instanceof __1.Customer || builder.entity.name === 'Customer') &&
106
- builder.transactionType === __1.TransactionType.Search) {
107
- result = response.results.map(function (customer) {
108
- return _this.hydrateCustomer(customer);
109
- });
110
- }
111
- else if (builder.entity instanceof __1.Customer) {
112
- result = this.hydrateCustomer(response);
113
- }
114
- if ((builder.entity instanceof __1.RecurringPaymentMethod || builder.entity.name === 'RecurringPaymentMethod') &&
115
- builder.transactionType === __1.TransactionType.Search) {
116
- result = response.results.map(function (paymentMethod) {
117
- return _this.hydrateRecurringPaymentMethod(paymentMethod);
118
- });
119
- }
120
- else if (builder.entity instanceof __1.RecurringPaymentMethod) {
121
- result = this.hydrateRecurringPaymentMethod(response);
122
- }
123
- if ((builder.entity instanceof __1.Schedule || builder.entity.name === 'Schedule') &&
124
- builder.transactionType === __1.TransactionType.Search) {
125
- result = response.results.map(function (schedule) {
126
- return _this.hydrateSchedule(schedule);
127
- });
128
- }
129
- else if (builder.entity instanceof __1.Schedule) {
130
- result = this.hydrateSchedule(response);
131
- }
132
- return result;
133
- };
134
- PayPlanConnector.prototype.buildCustomer = function (request, entity) {
135
- if (entity) {
136
- request.customerIdentifier = entity.id;
137
- request.firstName = entity.firstName;
138
- request.lastName = entity.lastName;
139
- request.company = entity.company;
140
- request.customerStatus = entity.status;
141
- request.primaryEmail = entity.email;
142
- request.phoneDay = entity.homePhone;
143
- request.phoneEvening = entity.workPhone;
144
- request.phoneMobile = entity.mobilePhone;
145
- request.fax = entity.fax;
146
- request.title = entity.title;
147
- request.department = entity.department;
148
- request = this.buildAddress(request, entity.address);
149
- }
150
- return request;
151
- };
152
- PayPlanConnector.prototype.buildPaymentMethod = function (request, entity, transactionType) {
153
- if (entity) {
154
- request.preferredPayment = entity.preferredPayment;
155
- request.paymentMethodIdentifier = entity.id;
156
- request.customerKey = entity.customerKey;
157
- request.nameOnAccount = entity.nameOnAccount;
158
- request = this.buildAddress(request, entity.address);
159
- if (transactionType === __1.TransactionType.Create) {
160
- var _a = this.hasToken(entity.paymentMethod), hasToken = _a.hasToken, tokenValue = _a.tokenValue;
161
- var paymentInfo = {};
162
- if (entity.paymentMethod.isCardData) {
163
- var method = entity.paymentMethod;
164
- paymentInfo.type = hasToken ? "SINGLEUSETOKEN" : null;
165
- paymentInfo[hasToken ? "token" : "number"] = hasToken
166
- ? tokenValue
167
- : method.number;
168
- paymentInfo.expMon = method.expMonth;
169
- paymentInfo.expYear = method.expYear;
170
- request.cardVerificationValue = method.cvn;
171
- request[hasToken ? "alternateIdentity" : "card"] = paymentInfo;
172
- }
173
- else if (entity.paymentMethod.isTrackData) {
174
- var method = entity.paymentMethod;
175
- paymentInfo.data = method.value;
176
- paymentInfo.dataEntryMode = method.entryMethod
177
- .toString()
178
- .toUpperCase();
179
- request.track = paymentInfo;
180
- }
181
- else if (entity.paymentMethod instanceof __1.ECheck) {
182
- var check = entity.paymentMethod;
183
- request.achType = this.prepareAccountType(check.accountType);
184
- request.accountType = this.prepareCheckType(check.checkType);
185
- request.telephoneIndicator =
186
- check.secCode === __1.SecCode.CCD || check.SecCode === __1.SecCode.PPD
187
- ? false
188
- : true;
189
- request.routingNumber = check.routingNumber;
190
- request.accountNumber = check.accountNumber;
191
- request.accountHolderYob = check.birthYear.toString();
192
- request.driversLicenseState = check.driversLicenseState;
193
- request.driversLicenseNumber = check.driversLicenseNumber;
194
- request.socialSecurityNumberLast4 = check.ssnLast4;
195
- delete request.country;
196
- }
197
- if (entity.paymentMethod.isEncryptable) {
198
- var enc = entity.paymentMethod
199
- .encryptionData;
200
- if (enc) {
201
- paymentInfo.trackNumber = enc.trackNumber;
202
- paymentInfo.key = enc.ktb;
203
- paymentInfo.encryptionType = "E3";
204
- }
205
- }
206
- }
207
- else {
208
- // edit fields
209
- delete request.customerKey;
210
- request.paymentStatus = entity.status;
211
- request.cpcTaxType = entity.taxType;
212
- request.expirationDate = entity.expirationDate;
213
- }
214
- }
215
- return request;
216
- };
217
- PayPlanConnector.prototype.buildSchedule = function (request, entity, transactionType) {
218
- var mapDuration = function () {
219
- if (entity.numberOfPayments) {
220
- return "Limited Number";
221
- }
222
- else if (entity.endDate) {
223
- return "End Date";
224
- }
225
- else {
226
- return "Ongoing";
227
- }
228
- };
229
- var mapProcessingDate = function () {
230
- var frequencies = [
231
- "Monthly",
232
- "Bi-Monthly",
233
- "Quarterly",
234
- "Semi-Annually",
235
- ];
236
- if (entity.frequency &&
237
- frequencies.indexOf(entity.frequency.toString()) !== -1) {
238
- switch (entity.paymentSchedule) {
239
- case __1.PaymentSchedule.FirstDayOfTheMonth:
240
- return "First";
241
- case __1.PaymentSchedule.LastDayOfTheMonth:
242
- return "Last";
243
- default:
244
- var day = entity.startDate.getUTCDate();
245
- if (day > 28) {
246
- return "Last";
247
- }
248
- return day.toString();
249
- }
250
- }
251
- else if (entity.frequency &&
252
- entity.frequency.toString() === "Semi-Monthly") {
253
- if (entity.paymentSchedule === __1.PaymentSchedule.LastDayOfTheMonth) {
254
- return "Last";
255
- }
256
- return "First";
257
- }
258
- return null;
259
- };
260
- if (entity) {
261
- request.scheduleIdentifier = entity.id;
262
- request.scheduleName = entity.name;
263
- request.scheduleStatus = entity.status;
264
- request.paymentMethodKey = entity.paymentKey;
265
- request = this.buildAmount(request, "subtotalAmount", entity.amount, entity.currency, transactionType);
266
- request = this.buildAmount(request, "taxAmount", entity.taxAmount, entity.currency, transactionType);
267
- request.deviceId = entity.deviceId;
268
- request.processingDateInfo = mapProcessingDate();
269
- request = this.buildDate(request, "endDate", entity.endDate, transactionType === __1.TransactionType.Edit);
270
- request.reprocessingCount = entity.reprocessingCount || 3;
271
- if (entity.emailReceipt) {
272
- request.emailReceipt = entity.emailReceipt.toString();
273
- }
274
- request.emailAdvanceNotice = entity.emailNotification ? "Yes" : "No";
275
- // debt repay ind
276
- request.invoiceNbr = entity.invoiceNumber;
277
- request.poNumber = entity.poNumber;
278
- request.description = entity.description;
279
- request.numberOfPayments = entity.numberOfPayments;
280
- if (transactionType === __1.TransactionType.Create) {
281
- request.customerKey = entity.customerKey;
282
- request = this.buildDate(request, "startDate", entity.startDate);
283
- if (entity.frequency) {
284
- request.frequency = entity.frequency.toString();
285
- }
286
- request.duration = mapDuration();
287
- }
288
- else {
289
- // edit Fields
290
- if (!entity.hasStarted) {
291
- request = this.buildDate(request, "startDate", entity.startDate);
292
- if (entity.frequency) {
293
- request.frequency = entity.frequency.toString();
294
- }
295
- request.duration = mapDuration();
296
- }
297
- else {
298
- request = this.buildDate(request, "cancellationDate", entity.cancellationDate);
299
- request = this.buildDate(request, "nextProcressingDate", entity.nextProcessingDate);
300
- }
301
- }
302
- }
303
- return request;
304
- };
305
- PayPlanConnector.prototype.prepareAccountType = function (type) {
306
- switch (type) {
307
- case __1.AccountType.Savings:
308
- return "Savings";
309
- case __1.AccountType.Checking:
310
- default:
311
- return "Checking";
312
- }
313
- };
314
- PayPlanConnector.prototype.prepareCheckType = function (type) {
315
- switch (type) {
316
- case __1.CheckType.Business:
317
- return "Business";
318
- case __1.CheckType.Payroll:
319
- return "Payroll";
320
- case __1.CheckType.Personal:
321
- default:
322
- return "Personal";
323
- }
324
- };
325
- PayPlanConnector.prototype.buildAddress = function (request, address) {
326
- if (address) {
327
- request.addressLine1 = address.streetAddress1;
328
- request.addressLine2 = address.streetAddress2;
329
- request.city = address.city;
330
- request.country = address.country;
331
- request.stateProvince = address.state;
332
- request.zipPostalCode = address.postalCode;
333
- }
334
- return request;
335
- };
336
- PayPlanConnector.prototype.buildAmount = function (request, name, amount, currency, transactionType) {
337
- if (amount) {
338
- request[name] = {
339
- value: parseFloat(amount.toString()) * 100,
340
- };
341
- if (transactionType === __1.TransactionType.Create) {
342
- request[name].currency = currency;
343
- }
344
- }
345
- return request;
346
- };
347
- PayPlanConnector.prototype.buildDate = function (request, name, date, force) {
348
- if (force === void 0) { force = false; }
349
- var getDateValue = function (d) {
350
- if (typeof (date) === 'string' && date.length === 8) {
351
- return d;
352
- }
353
- var day = __1.StringUtils.leftPad(d.getUTCDate().toString(), 2, "0");
354
- var month = __1.StringUtils.leftPad((d.getUTCMonth() + 1).toString(), 2, "0");
355
- var year = __1.StringUtils.leftPad(d.getUTCFullYear().toString(), 4, "0");
356
- return month + day + year;
357
- };
358
- if (date || force) {
359
- var value = date ? getDateValue(date) : null;
360
- request[name] = value;
361
- }
362
- return request;
363
- };
364
- PayPlanConnector.prototype.mapMethod = function (transactionType) {
365
- switch (transactionType) {
366
- case __1.TransactionType.Create:
367
- case __1.TransactionType.Search:
368
- return "POST";
369
- case __1.TransactionType.Edit:
370
- return "PUT";
371
- case __1.TransactionType.Delete:
372
- return "DELETE";
373
- default:
374
- return "GET";
375
- }
376
- };
377
- PayPlanConnector.prototype.mapUrl = function (builder) {
378
- var suffix = "";
379
- if (builder.transactionType === __1.TransactionType.Fetch ||
380
- builder.transactionType === __1.TransactionType.Delete ||
381
- builder.transactionType === __1.TransactionType.Edit) {
382
- suffix = "/" + builder.entity.key;
383
- }
384
- if (builder.entity instanceof __1.Customer || builder.entity.name === 'Customer') {
385
- return ((builder.transactionType === __1.TransactionType.Search
386
- ? "searchCustomers"
387
- : "customers") + suffix);
388
- }
389
- if (builder.entity instanceof __1.RecurringPaymentMethod || builder.entity.name === 'RecurringPaymentMethod') {
390
- var paymentMethod = "";
391
- if (builder.transactionType === __1.TransactionType.Create) {
392
- paymentMethod =
393
- builder.entity.paymentMethod instanceof __1.Credit ? "CreditCard" : "ACH";
394
- }
395
- else if (builder.transactionType === __1.TransactionType.Edit) {
396
- paymentMethod = builder.entity.paymentType.replace(" ", "");
397
- }
398
- return ((builder.transactionType === __1.TransactionType.Search
399
- ? "searchPaymentMethods"
400
- : "paymentMethods") +
401
- paymentMethod +
402
- suffix);
403
- }
404
- if (builder.entity instanceof __1.Schedule || builder.entity.name === 'Schedule') {
405
- return ((builder.transactionType === __1.TransactionType.Search
406
- ? "searchSchedules"
407
- : "schedules") + suffix);
408
- }
409
- throw new __1.UnsupportedTransactionError();
410
- };
411
- PayPlanConnector.prototype.hydrateCustomer = function (response) {
412
- var customer = new __1.Customer();
413
- customer.key = response.customerKey;
414
- customer.id = response.customerIdentifier;
415
- customer.firstName = response.firstName;
416
- customer.lastName = response.lastName;
417
- customer.company = response.company;
418
- customer.status = response.customerStatus;
419
- customer.title = response.title;
420
- customer.department = response.department;
421
- customer.email = response.primaryEmail;
422
- customer.homePhone = response.phoneDay;
423
- customer.workPhone = response.phoneEvening;
424
- customer.mobilePhone = response.phoneMobile;
425
- customer.fax = response.fax;
426
- customer.address = new __1.Address();
427
- customer.address.streetAddress1 = response.addressLine1;
428
- customer.address.streetAddress2 = response.addressLine2;
429
- customer.address.city = response.city;
430
- customer.address.province = response.stateProvince;
431
- customer.address.postalCode = response.zipPostalCode;
432
- customer.address.country = response.country;
433
- return customer;
434
- };
435
- PayPlanConnector.prototype.hydrateRecurringPaymentMethod = function (response) {
436
- var paymentMethod = new __1.RecurringPaymentMethod();
437
- paymentMethod.key = response.paymentMethodKey;
438
- paymentMethod.paymentType = response.paymentMethodType;
439
- paymentMethod.preferredPayment = response.preferredPayment;
440
- paymentMethod.status = response.paymentStatus;
441
- paymentMethod.id = response.paymentMethodIdentifier;
442
- paymentMethod.customerKey = response.customerKey;
443
- paymentMethod.nameOnAccount = response.nameOnAccount;
444
- paymentMethod.commercialIndicator = response.cpcInd;
445
- paymentMethod.taxType = response.cpcTaxType;
446
- paymentMethod.expirationDate = response.expirationDate;
447
- paymentMethod.address = new __1.Address();
448
- paymentMethod.address.streetAddress1 = response.addressLine1;
449
- paymentMethod.address.streetAddress2 = response.addressLine2;
450
- paymentMethod.address.city = response.city;
451
- paymentMethod.address.state = response.stateProvince;
452
- paymentMethod.address.postalCode = response.zipPostalCode;
453
- paymentMethod.address.country = response.country;
454
- return paymentMethod;
455
- };
456
- PayPlanConnector.prototype.hydrateSchedule = function (response) {
457
- var schedule = new __1.Schedule();
458
- schedule.key = response.scheduleKey;
459
- schedule.id = response.scheduleIdentifier;
460
- schedule.customerKey = response.customerKey;
461
- schedule.name = response.scheduleName;
462
- schedule.status = response.scheduleStatus;
463
- schedule.paymentKey = response.paymentMethodKey;
464
- if (response.subtotalAmount) {
465
- var subtotal = response.subtotalAmount;
466
- schedule.amount = subtotal.value.slice(0, -2) + '.' + subtotal.value.slice(-2); // add the decimal back in
467
- schedule.currency = subtotal.currency;
468
- }
469
- if (response.taxAmount) {
470
- var taxAmount = response.taxAmount;
471
- schedule.taxAmount = taxAmount.value.slice(0, -2) + '.' + taxAmount.value.slice(-2); // add the decimal back in
472
- }
473
- schedule.deviceId = response.deviceId;
474
- schedule.startDate = response.startDate === "" ? null : response.startDate;
475
- schedule.paymentSchedule = (function (value) {
476
- switch (value) {
477
- case "Last":
478
- return __1.PaymentSchedule.LastDayOfTheMonth;
479
- case "First":
480
- return __1.PaymentSchedule.FirstDayOfTheMonth;
481
- default:
482
- return __1.PaymentSchedule.Dynamic;
483
- }
484
- })(response.processingDateInfo);
485
- schedule.frequency = response.frequency;
486
- schedule.endDate = response.endDate === "" ? null : response.endDate;
487
- schedule.reprocessingCount = response.reprocessingCount;
488
- schedule.emailReceipt = response.emailReceipt;
489
- schedule.emailNotification = (function (value) {
490
- if (!value) {
491
- return false;
492
- }
493
- return value === "No" ? false : true;
494
- })(response.emailNotification);
495
- // dept repay indicator
496
- schedule.invoiceNumber = response.invoiceNbr;
497
- schedule.poNumber = response.poNumber;
498
- schedule.description = response.description;
499
- // statusSetDate
500
- schedule.nextProcessingDate = response.nextProcessingDate === "" ? null : response.nextProcessingDate;
501
- // previousProcessingDate
502
- // approvedTransactionCount
503
- // failureCount
504
- // totalApprovedAmountToDate
505
- // numberOfPaymentsRemaining
506
- schedule.cancellationDate = response.cancellationDate === "" ? null : response.cancellationDate;
507
- // creationDate
508
- // lastChangeDate
509
- schedule.hasStarted = response.scheduleStarted;
510
- return schedule;
511
- };
512
- PayPlanConnector.prototype.hasToken = function (paymentMethod) {
513
- var tokenizable = paymentMethod;
514
- if (tokenizable.token) {
515
- return {
516
- hasToken: true,
517
- tokenValue: tokenizable.token,
518
- };
519
- }
520
- return {
521
- hasToken: false,
522
- tokenValue: "",
523
- };
524
- };
525
- PayPlanConnector.prototype.setAuthorizationHeader = function (value) {
526
- var buffer = (Buffer.from ? Buffer.from(value) : new Buffer(value));
527
- var auth = "Basic " + buffer.toString("base64");
528
- this.headers[RestGateway_1.RestGateway.AUTHORIZATION_HEADER] = auth;
529
- };
530
- PayPlanConnector.prototype.maybeSetIdentityHeader = function () {
531
- var identity = [];
532
- if (this.siteId) {
533
- identity.push("SiteID=" + this.siteId);
534
- }
535
- if (this.deviceId) {
536
- identity.push("DeviceID=" + this.deviceId);
537
- }
538
- if (this.licenseId) {
539
- identity.push("LicenseID=" + this.licenseId);
540
- }
541
- if (identity.length > 0) {
542
- this.headers['HPS-Identity'] = identity.join(',');
543
- }
544
- };
545
- PayPlanConnector.prototype.maybeSetIntegrationHeader = function () {
546
- if (this.versionNumber || this.developerId) {
547
- this.headers['HPS-Integration'] = "DeveloperId=" + this.developerId + ",VersionNbr=" + this.versionNumber;
548
- }
549
- };
550
- return PayPlanConnector;
551
- }(RestGateway_1.RestGateway));
552
- exports.PayPlanConnector = PayPlanConnector;
@@ -1,44 +0,0 @@
1
- import { Element } from "@azz/elementtree";
2
- import { AccountType, AuthorizationBuilder, CheckType, EntryMethod, InquiryType, IPaymentGateway, IPaymentMethod, ManagementBuilder, ReportBuilder, SecCode, TaxType, Transaction, TransactionBuilder, TransactionSummary } from "../";
3
- import { XmlGateway } from "./XmlGateway";
4
- export declare class PorticoConnector extends XmlGateway implements IPaymentGateway {
5
- protected static XmlNamespace: string;
6
- siteId: string;
7
- licenseId: string;
8
- deviceId: string;
9
- username: string;
10
- password: string;
11
- secretApiKey: string;
12
- developerId: string;
13
- versionNumber: string;
14
- sdkNameVersion: string;
15
- supportsHostedPayments: boolean;
16
- processAuthorization(builder: AuthorizationBuilder): Promise<Transaction>;
17
- serializeRequest(_builder: AuthorizationBuilder): string;
18
- manageTransaction(builder: ManagementBuilder): Promise<Transaction>;
19
- processReport<T>(builder: ReportBuilder<T>): Promise<T>;
20
- protected buildEnvelope(transaction: Element, clientTransactionId?: string): string;
21
- protected mapRequestType(builder: TransactionBuilder<Transaction>): string;
22
- protected mapReportRequestType<T>(builder: ReportBuilder<T>): string;
23
- protected mapResponse(rawResponse: string, builder: TransactionBuilder<Transaction>): Transaction;
24
- protected mapReportResponse<T>(rawResponse: string, builder: ReportBuilder<T>): T;
25
- protected normalizeResponse(input: string): string;
26
- protected hasToken(paymentMethod: IPaymentMethod): {
27
- hasToken: boolean;
28
- tokenValue: string;
29
- };
30
- protected hydrateAccountType(type: AccountType): "" | "CHECKING" | "SAVINGS";
31
- protected hydrateCheckType(type: CheckType): "" | "BUSINESS" | "PAYROLL" | "PERSONAL";
32
- protected hydrateCredentialOnFile(builder: AuthorizationBuilder): Element;
33
- protected hydrateEncryptionData(builder: TransactionBuilder<Transaction>): Element;
34
- protected hydrateEntryMethod(method: EntryMethod): "" | "Manual" | "Proximity" | "Swipe";
35
- protected hydrateHolder(builder: AuthorizationBuilder, isCheck: boolean): Element;
36
- protected hydrateInquiryType(type: InquiryType): "" | "CASH" | "FOODSTAMP" | "POINTS" | "STANDARD";
37
- protected hydrateManualEntry(block1: Element, builder: AuthorizationBuilder, hasToken: boolean, tokenValue: string): Element;
38
- protected hydrateSecCode(code: SecCode): "" | "CCD" | "PPD" | "POP" | "WEB" | "TEL" | "EBRONZE";
39
- protected hydrateTaxType(type: TaxType): "" | "NOTUSED" | "SALESTAX" | "TAXEXEMPT";
40
- protected hydrateTrackData(builder: TransactionBuilder<Transaction>, hasToken: boolean, tokenValue: string): Element;
41
- protected hydrateTransactionSummary(root: Element): TransactionSummary;
42
- protected shouldIncludeCredentialOnFile(builder: TransactionBuilder<Transaction>): boolean;
43
- protected isAppleOrGooglePay(paymentDataSource: string): boolean;
44
- }