@blockchyp/blockchyp-ts 1.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 (207) hide show
  1. package/.eslintrc.json +20 -0
  2. package/LICENSE +21 -0
  3. package/README.md +4314 -0
  4. package/index.js +24 -0
  5. package/index.ts +3 -0
  6. package/itest/ActivateTerminalITestSpec.js +87 -0
  7. package/itest/ActivateTerminalITestSpec.ts +58 -0
  8. package/itest/AddTestMerchantITestSpec.js +89 -0
  9. package/itest/AddTestMerchantITestSpec.ts +60 -0
  10. package/itest/BatchHistoryITestSpec.js +101 -0
  11. package/itest/BatchHistoryITestSpec.ts +73 -0
  12. package/itest/BooleanPromptITestSpec.js +104 -0
  13. package/itest/BooleanPromptITestSpec.ts +76 -0
  14. package/itest/CancelPaymentLinkITestSpec.js +116 -0
  15. package/itest/CancelPaymentLinkITestSpec.ts +93 -0
  16. package/itest/CaptureSignatureITestSpec.js +101 -0
  17. package/itest/CaptureSignatureITestSpec.ts +73 -0
  18. package/itest/DeactivateTerminalITestSpec.js +82 -0
  19. package/itest/DeactivateTerminalITestSpec.ts +52 -0
  20. package/itest/DeleteBrandingAssetITestSpec.js +96 -0
  21. package/itest/DeleteBrandingAssetITestSpec.ts +69 -0
  22. package/itest/DeleteCustomerITestSpec.js +102 -0
  23. package/itest/DeleteCustomerITestSpec.ts +75 -0
  24. package/itest/DeleteMediaAssetITestSpec.js +100 -0
  25. package/itest/DeleteMediaAssetITestSpec.ts +71 -0
  26. package/itest/DeleteQueuedTransactionITestSpec.js +117 -0
  27. package/itest/DeleteQueuedTransactionITestSpec.ts +89 -0
  28. package/itest/DeleteSlideShowITestSpec.js +96 -0
  29. package/itest/DeleteSlideShowITestSpec.ts +69 -0
  30. package/itest/DeleteSurveyQuestionITestSpec.js +97 -0
  31. package/itest/DeleteSurveyQuestionITestSpec.ts +70 -0
  32. package/itest/DeleteTestMerchantITestSpec.js +96 -0
  33. package/itest/DeleteTestMerchantITestSpec.ts +69 -0
  34. package/itest/DeleteTokenITestSpec.js +102 -0
  35. package/itest/DeleteTokenITestSpec.ts +75 -0
  36. package/itest/EmptyBrandingAssetITestSpec.js +85 -0
  37. package/itest/EmptyBrandingAssetITestSpec.ts +57 -0
  38. package/itest/EmptySlideShowITestSpec.js +87 -0
  39. package/itest/EmptySlideShowITestSpec.ts +58 -0
  40. package/itest/GatewayTimeoutITestSpec.js +103 -0
  41. package/itest/GatewayTimeoutITestSpec.ts +73 -0
  42. package/itest/GetCustomerITestSpec.js +102 -0
  43. package/itest/GetCustomerITestSpec.ts +75 -0
  44. package/itest/GetMerchantsITestSpec.js +84 -0
  45. package/itest/GetMerchantsITestSpec.ts +56 -0
  46. package/itest/InviteMerchantUserITestSpec.js +86 -0
  47. package/itest/InviteMerchantUserITestSpec.ts +58 -0
  48. package/itest/LinkTokenITestSpec.js +103 -0
  49. package/itest/LinkTokenITestSpec.ts +76 -0
  50. package/itest/ListQueuedTransactionsITestSpec.js +116 -0
  51. package/itest/ListQueuedTransactionsITestSpec.ts +88 -0
  52. package/itest/ListTerminalsITestSpec.js +83 -0
  53. package/itest/ListTerminalsITestSpec.ts +56 -0
  54. package/itest/MediaAssetITestSpec.js +105 -0
  55. package/itest/MediaAssetITestSpec.ts +75 -0
  56. package/itest/MediaITestSpec.js +83 -0
  57. package/itest/MediaITestSpec.ts +56 -0
  58. package/itest/MediaUploadITestSpec.js +94 -0
  59. package/itest/MediaUploadITestSpec.ts +63 -0
  60. package/itest/MerchantCredentialGenerationITestSpec.js +85 -0
  61. package/itest/MerchantCredentialGenerationITestSpec.ts +57 -0
  62. package/itest/MerchantInvoiceDetailITestSpec.js +84 -0
  63. package/itest/MerchantInvoiceDetailITestSpec.ts +56 -0
  64. package/itest/MerchantInvoicesITestSpec.js +84 -0
  65. package/itest/MerchantInvoicesITestSpec.ts +56 -0
  66. package/itest/MerchantPlatformsITestSpec.js +96 -0
  67. package/itest/MerchantPlatformsITestSpec.ts +69 -0
  68. package/itest/MerchantProfileITestSpec.js +84 -0
  69. package/itest/MerchantProfileITestSpec.ts +56 -0
  70. package/itest/MerchantUsersITestSpec.js +83 -0
  71. package/itest/MerchantUsersITestSpec.ts +56 -0
  72. package/itest/NewTransactionDisplayITestSpec.js +115 -0
  73. package/itest/NewTransactionDisplayITestSpec.ts +92 -0
  74. package/itest/PANChargeITestSpec.js +118 -0
  75. package/itest/PANChargeITestSpec.ts +88 -0
  76. package/itest/PANEnrollITestSpec.js +118 -0
  77. package/itest/PANEnrollITestSpec.ts +90 -0
  78. package/itest/PANPreauthITestSpec.js +116 -0
  79. package/itest/PANPreauthITestSpec.ts +87 -0
  80. package/itest/PartialRefundITestSpec.js +119 -0
  81. package/itest/PartialRefundITestSpec.ts +91 -0
  82. package/itest/PartnerCommissionBreakdownITestSpec.js +84 -0
  83. package/itest/PartnerCommissionBreakdownITestSpec.ts +56 -0
  84. package/itest/PartnerStatementDetailITestSpec.js +84 -0
  85. package/itest/PartnerStatementDetailITestSpec.ts +56 -0
  86. package/itest/PartnerStatementsITestSpec.js +84 -0
  87. package/itest/PartnerStatementsITestSpec.ts +56 -0
  88. package/itest/PaymentLinkStatusITestSpec.js +116 -0
  89. package/itest/PaymentLinkStatusITestSpec.ts +93 -0
  90. package/itest/PricingPolicyITestSpec.js +85 -0
  91. package/itest/PricingPolicyITestSpec.ts +57 -0
  92. package/itest/ResendPaymentLinkITestSpec.js +116 -0
  93. package/itest/ResendPaymentLinkITestSpec.ts +93 -0
  94. package/itest/SearchCustomerITestSpec.js +101 -0
  95. package/itest/SearchCustomerITestSpec.ts +75 -0
  96. package/itest/SendPaymentLinkITestSpec.js +107 -0
  97. package/itest/SendPaymentLinkITestSpec.ts +82 -0
  98. package/itest/SimpleBatchCloseITestSpec.js +101 -0
  99. package/itest/SimpleBatchCloseITestSpec.ts +73 -0
  100. package/itest/SimpleCaptureITestSpec.js +101 -0
  101. package/itest/SimpleCaptureITestSpec.ts +74 -0
  102. package/itest/SimpleGiftActivateITestSpec.js +104 -0
  103. package/itest/SimpleGiftActivateITestSpec.ts +75 -0
  104. package/itest/SimpleLocateITestSpec.js +85 -0
  105. package/itest/SimpleLocateITestSpec.ts +57 -0
  106. package/itest/SimpleMessageITestSpec.js +101 -0
  107. package/itest/SimpleMessageITestSpec.ts +73 -0
  108. package/itest/SimplePingITestSpec.js +100 -0
  109. package/itest/SimplePingITestSpec.ts +72 -0
  110. package/itest/SimpleRefundITestSpec.js +118 -0
  111. package/itest/SimpleRefundITestSpec.ts +90 -0
  112. package/itest/SimpleReversalITestSpec.js +103 -0
  113. package/itest/SimpleReversalITestSpec.ts +75 -0
  114. package/itest/SimpleVoidITestSpec.js +103 -0
  115. package/itest/SimpleVoidITestSpec.ts +75 -0
  116. package/itest/SlideShowITestSpec.js +98 -0
  117. package/itest/SlideShowITestSpec.ts +70 -0
  118. package/itest/SlideShowsITestSpec.js +95 -0
  119. package/itest/SlideShowsITestSpec.ts +69 -0
  120. package/itest/SurveyQuestionITestSpec.js +95 -0
  121. package/itest/SurveyQuestionITestSpec.ts +68 -0
  122. package/itest/SurveyQuestionsITestSpec.js +96 -0
  123. package/itest/SurveyQuestionsITestSpec.ts +70 -0
  124. package/itest/SurveyResultsITestSpec.js +95 -0
  125. package/itest/SurveyResultsITestSpec.ts +68 -0
  126. package/itest/TCDeleteTemplateITestSpec.js +98 -0
  127. package/itest/TCDeleteTemplateITestSpec.ts +70 -0
  128. package/itest/TCEntryITestSpec.js +103 -0
  129. package/itest/TCEntryITestSpec.ts +76 -0
  130. package/itest/TCLogITestSpec.js +83 -0
  131. package/itest/TCLogITestSpec.ts +56 -0
  132. package/itest/TCTemplateITestSpec.js +101 -0
  133. package/itest/TCTemplateITestSpec.ts +72 -0
  134. package/itest/TCTemplateUpdateITestSpec.js +91 -0
  135. package/itest/TCTemplateUpdateITestSpec.ts +61 -0
  136. package/itest/TCTemplatesITestSpec.js +83 -0
  137. package/itest/TCTemplatesITestSpec.ts +56 -0
  138. package/itest/TerminalBrandingITestSpec.js +83 -0
  139. package/itest/TerminalBrandingITestSpec.ts +56 -0
  140. package/itest/TerminalChargeITestSpec.js +113 -0
  141. package/itest/TerminalChargeITestSpec.ts +84 -0
  142. package/itest/TerminalClearITestSpec.js +100 -0
  143. package/itest/TerminalClearITestSpec.ts +72 -0
  144. package/itest/TerminalEBTBalanceITestSpec.js +103 -0
  145. package/itest/TerminalEBTBalanceITestSpec.ts +74 -0
  146. package/itest/TerminalEBTChargeITestSpec.js +115 -0
  147. package/itest/TerminalEBTChargeITestSpec.ts +86 -0
  148. package/itest/TerminalEnrollITestSpec.js +112 -0
  149. package/itest/TerminalEnrollITestSpec.ts +83 -0
  150. package/itest/TerminalGiftCardBalanceITestSpec.js +102 -0
  151. package/itest/TerminalGiftCardBalanceITestSpec.ts +73 -0
  152. package/itest/TerminalKeyedChargeITestSpec.js +114 -0
  153. package/itest/TerminalKeyedChargeITestSpec.ts +85 -0
  154. package/itest/TerminalManualEBTChargeITestSpec.js +116 -0
  155. package/itest/TerminalManualEBTChargeITestSpec.ts +87 -0
  156. package/itest/TerminalPreauthITestSpec.js +113 -0
  157. package/itest/TerminalPreauthITestSpec.ts +84 -0
  158. package/itest/TerminalQueuedTransactionITestSpec.js +108 -0
  159. package/itest/TerminalQueuedTransactionITestSpec.ts +78 -0
  160. package/itest/TerminalStatusITestSpec.js +100 -0
  161. package/itest/TerminalStatusITestSpec.ts +72 -0
  162. package/itest/TerminalTimeoutITestSpec.js +99 -0
  163. package/itest/TerminalTimeoutITestSpec.ts +70 -0
  164. package/itest/TermsAndConditionsITestSpec.js +105 -0
  165. package/itest/TermsAndConditionsITestSpec.ts +77 -0
  166. package/itest/TextPromptITestSpec.js +103 -0
  167. package/itest/TextPromptITestSpec.ts +74 -0
  168. package/itest/TokenMetadataITestSpec.js +102 -0
  169. package/itest/TokenMetadataITestSpec.ts +75 -0
  170. package/itest/TransactionHistoryITestSpec.js +101 -0
  171. package/itest/TransactionHistoryITestSpec.ts +73 -0
  172. package/itest/UnlinkTokenITestSpec.js +103 -0
  173. package/itest/UnlinkTokenITestSpec.ts +76 -0
  174. package/itest/UpdateBrandingAssetITestSpec.js +109 -0
  175. package/itest/UpdateBrandingAssetITestSpec.ts +80 -0
  176. package/itest/UpdateCustomerITestSpec.js +90 -0
  177. package/itest/UpdateCustomerITestSpec.ts +63 -0
  178. package/itest/UpdateMerchantITestSpec.js +92 -0
  179. package/itest/UpdateMerchantITestSpec.ts +65 -0
  180. package/itest/UpdateMerchantPlatformsITestSpec.js +98 -0
  181. package/itest/UpdateMerchantPlatformsITestSpec.ts +71 -0
  182. package/itest/UpdateSlideShowITestSpec.js +106 -0
  183. package/itest/UpdateSlideShowITestSpec.ts +78 -0
  184. package/itest/UpdateSurveyQuestionITestSpec.js +89 -0
  185. package/itest/UpdateSurveyQuestionITestSpec.ts +60 -0
  186. package/itest/UpdateTransactionDisplayITestSpec.js +115 -0
  187. package/itest/UpdateTransactionDisplayITestSpec.ts +92 -0
  188. package/itest/UploadStatusITestSpec.js +100 -0
  189. package/itest/UploadStatusITestSpec.ts +71 -0
  190. package/itest/support/aviato.png +0 -0
  191. package/itest/support/config.js +67 -0
  192. package/itest/support/config.ts +106 -0
  193. package/itest/support/jasmine.json +11 -0
  194. package/package.json +73 -0
  195. package/spec/CryptoSpec.js +35 -0
  196. package/spec/CryptoSpec.ts +35 -0
  197. package/spec/SanitySpec.js +26 -0
  198. package/spec/SanitySpec.ts +23 -0
  199. package/spec/support/jasmine.json +11 -0
  200. package/src/client.js +941 -0
  201. package/src/client.ts +1012 -0
  202. package/src/cryptoutils.js +89 -0
  203. package/src/cryptoutils.ts +80 -0
  204. package/src/global.js +9 -0
  205. package/src/global.ts +5 -0
  206. package/src/models.js +9382 -0
  207. package/src/models.ts +16509 -0
package/src/client.js ADDED
@@ -0,0 +1,941 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.newClient = exports.BlockChypCredentials = exports.BlockChypClient = exports.HealthcareType = exports.CVMType = exports.AVSResponse = exports.PromptType = exports.RoundingMode = exports.SignatureFormat = exports.CardType = void 0;
39
+ /**
40
+ * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
41
+ * by a license that can be found in the LICENSE file.
42
+ *
43
+ * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
44
+ * file will be lost every time the code is regenerated.
45
+ */
46
+ const axios_1 = __importDefault(require("axios"));
47
+ const cryptoutils_1 = __importDefault(require("./cryptoutils"));
48
+ const nodeHttps = __importStar(require("https"));
49
+ /* eslint-disable no-unused-vars */
50
+ exports.CardType = Object.freeze({
51
+ CREDIT: 0,
52
+ DEBIT: 1,
53
+ EBT: 2,
54
+ BLOCKCHAIN_GIFT: 3,
55
+ HEALTHCARE: 4,
56
+ });
57
+ exports.SignatureFormat = Object.freeze({
58
+ NONE: '',
59
+ PNG: 'png',
60
+ JPG: 'jpg',
61
+ GIF: 'gif',
62
+ });
63
+ exports.RoundingMode = Object.freeze({
64
+ UP: 'up',
65
+ NEAREST: 'nearest',
66
+ DOWN: 'down',
67
+ });
68
+ exports.PromptType = Object.freeze({
69
+ AMOUNT: 'amount',
70
+ EMAIL: 'email',
71
+ PHONE_NUMBER: 'phone',
72
+ CUSTOMER_NUMBER: 'customer-number',
73
+ REWARDS_NUMBER: 'rewards-number',
74
+ FIRST_NAME: 'first-name',
75
+ LAST_NAME: 'last-name',
76
+ });
77
+ exports.AVSResponse = Object.freeze({
78
+ NOT_APPLICABLE: '',
79
+ NOT_SUPPORTED: 'not_supported',
80
+ RETRY: 'retry',
81
+ NO_MATCH: 'no_match',
82
+ ADDRESS_MATCH: 'address_match',
83
+ POSTAL_CODE_MATCH: 'zip_match',
84
+ ADDRESS_AND_POSTAL_CODE_MATCH: 'match',
85
+ });
86
+ exports.CVMType = Object.freeze({
87
+ SIGNATURE: 'Signature',
88
+ OFFLINE_PIN: 'Offline PIN',
89
+ ONLINE_PIN: 'Online PIN',
90
+ CDCVM: 'CDCVM',
91
+ NO_CVM: 'No CVM',
92
+ });
93
+ exports.HealthcareType = Object.freeze({
94
+ HEALTHCARE: 'healthcare',
95
+ PRESCRIPTION: 'prescription',
96
+ VISION: 'vision',
97
+ CLINIC: 'clinic',
98
+ DENTAL: 'dental',
99
+ });
100
+ /* eslint-enable no-unused-vars */
101
+ const VERSION = require('../package.json').version;
102
+ const USER_AGENT = `BlockChyp-TypeScript/${VERSION}`;
103
+ // Some browsers do not allow setting the user-agent header, so we set
104
+ // an alternative if running from a browser.
105
+ const AGENT_HEADER = (typeof window === 'undefined') ? 'User-Agent' : 'X-Requested-With';
106
+ class BlockChypClient {
107
+ constructor(gatewayHostOrCreds, testGatewayHostOrCreds, dashboardHostOrCreds, creds) {
108
+ this.gatewayHost = 'https://api.blockchyp.com';
109
+ this.testGatewayHost = 'https://test.blockchyp.com';
110
+ this.dashboardHost = 'https://dashboard.blockchyp.com';
111
+ if (typeof gatewayHostOrCreds === 'string') {
112
+ this.gatewayHost = gatewayHostOrCreds;
113
+ }
114
+ else if (typeof gatewayHostOrCreds === 'object') {
115
+ creds = gatewayHostOrCreds;
116
+ }
117
+ if (typeof testGatewayHostOrCreds === 'string') {
118
+ this.testGatewayHost = testGatewayHostOrCreds;
119
+ }
120
+ else if (typeof testGatewayHostOrCreds === 'object') {
121
+ creds = testGatewayHostOrCreds;
122
+ }
123
+ if (typeof dashboardHostOrCreds === 'string') {
124
+ this.dashboardHost = dashboardHostOrCreds;
125
+ }
126
+ else if (typeof dashboardHostOrCreds === 'object') {
127
+ creds = dashboardHostOrCreds;
128
+ }
129
+ this.credentials = creds;
130
+ this.https = true;
131
+ this.cloudRelay = false;
132
+ this.routeCacheTTL = 60;
133
+ this.gatewayTimeout = 20;
134
+ this.terminalTimeout = 120;
135
+ this._routeCache = {};
136
+ }
137
+ newClient(creds) {
138
+ return new BlockChypClient(creds);
139
+ }
140
+ getGatewayHost() {
141
+ return this.gatewayHost;
142
+ }
143
+ getDashboardHost() {
144
+ return this.dashboardHost;
145
+ }
146
+ setGatewayHost(host) {
147
+ this.gatewayHost = host;
148
+ }
149
+ setDashboardHost(host) {
150
+ this.dashboardHost = host;
151
+ }
152
+ setTestGatewayHost(host) {
153
+ this.testGatewayHost = host;
154
+ }
155
+ heartbeat() {
156
+ return this._gatewayRequest('get', '/api/heartbeat');
157
+ }
158
+ /**
159
+ * Tests connectivity with a payment terminal.
160
+ */
161
+ ping(request) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ return this.routeTerminalRequest('post', request, '/api/test', '/api/terminal-test');
164
+ });
165
+ }
166
+ /**
167
+ * Executes a standard direct preauth and capture.
168
+ */
169
+ charge(request) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ return this.routeTerminalRequest('post', request, '/api/charge', '/api/charge');
172
+ });
173
+ }
174
+ /**
175
+ * Executes a preauthorization intended to be captured later.
176
+ */
177
+ preauth(request) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ return this.routeTerminalRequest('post', request, '/api/preauth', '/api/preauth');
180
+ });
181
+ }
182
+ /**
183
+ * Executes a refund.
184
+ */
185
+ refund(request) {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ return this.routeTerminalRequest('post', request, '/api/refund', '/api/refund');
188
+ });
189
+ }
190
+ /**
191
+ * Adds a new payment method to the token vault.
192
+ */
193
+ enroll(request) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ return this.routeTerminalRequest('post', request, '/api/enroll', '/api/enroll');
196
+ });
197
+ }
198
+ /**
199
+ * Activates or recharges a gift card.
200
+ */
201
+ giftActivate(request) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ return this.routeTerminalRequest('post', request, '/api/gift-activate', '/api/gift-activate');
204
+ });
205
+ }
206
+ /**
207
+ * Checks the remaining balance on a payment method.
208
+ */
209
+ balance(request) {
210
+ return __awaiter(this, void 0, void 0, function* () {
211
+ return this.routeTerminalRequest('post', request, '/api/balance', '/api/balance');
212
+ });
213
+ }
214
+ /**
215
+ * Clears the line item display and any in progress transaction.
216
+ */
217
+ clear(request) {
218
+ return __awaiter(this, void 0, void 0, function* () {
219
+ return this.routeTerminalRequest('post', request, '/api/clear', '/api/terminal-clear');
220
+ });
221
+ }
222
+ /**
223
+ * Returns the current status of a terminal.
224
+ */
225
+ terminalStatus(request) {
226
+ return __awaiter(this, void 0, void 0, function* () {
227
+ return this.routeTerminalRequest('post', request, '/api/terminal-status', '/api/terminal-status');
228
+ });
229
+ }
230
+ /**
231
+ * Prompts the user to accept terms and conditions.
232
+ */
233
+ termsAndConditions(request) {
234
+ return __awaiter(this, void 0, void 0, function* () {
235
+ return this.routeTerminalRequest('post', request, '/api/tc', '/api/terminal-tc');
236
+ });
237
+ }
238
+ /**
239
+ * Captures and returns a signature.
240
+ */
241
+ captureSignature(request) {
242
+ return __awaiter(this, void 0, void 0, function* () {
243
+ return this.routeTerminalRequest('post', request, '/api/capture-signature', '/api/capture-signature');
244
+ });
245
+ }
246
+ /**
247
+ * Displays a new transaction on the terminal.
248
+ */
249
+ newTransactionDisplay(request) {
250
+ return __awaiter(this, void 0, void 0, function* () {
251
+ return this.routeTerminalRequest('post', request, '/api/txdisplay', '/api/terminal-txdisplay');
252
+ });
253
+ }
254
+ /**
255
+ * Appends items to an existing transaction display. Subtotal, Tax, and Total are
256
+ * overwritten by the request. Items with the same description are combined into
257
+ * groups.
258
+ */
259
+ updateTransactionDisplay(request) {
260
+ return __awaiter(this, void 0, void 0, function* () {
261
+ return this.routeTerminalRequest('put', request, '/api/txdisplay', '/api/terminal-txdisplay');
262
+ });
263
+ }
264
+ /**
265
+ * Displays a short message on the terminal.
266
+ */
267
+ message(request) {
268
+ return __awaiter(this, void 0, void 0, function* () {
269
+ return this.routeTerminalRequest('post', request, '/api/message', '/api/message');
270
+ });
271
+ }
272
+ /**
273
+ * Asks the consumer a yes/no question.
274
+ */
275
+ booleanPrompt(request) {
276
+ return __awaiter(this, void 0, void 0, function* () {
277
+ return this.routeTerminalRequest('post', request, '/api/boolean-prompt', '/api/boolean-prompt');
278
+ });
279
+ }
280
+ /**
281
+ * Asks the consumer a text based question.
282
+ */
283
+ textPrompt(request) {
284
+ return __awaiter(this, void 0, void 0, function* () {
285
+ return this.routeTerminalRequest('post', request, '/api/text-prompt', '/api/text-prompt');
286
+ });
287
+ }
288
+ /**
289
+ * Returns a list of queued transactions on a terminal.
290
+ */
291
+ listQueuedTransactions(request) {
292
+ return __awaiter(this, void 0, void 0, function* () {
293
+ return this.routeTerminalRequest('post', request, '/api/queue/list', '/api/queue/list');
294
+ });
295
+ }
296
+ /**
297
+ * Deletes a queued transaction from the terminal.
298
+ */
299
+ deleteQueuedTransaction(request) {
300
+ return __awaiter(this, void 0, void 0, function* () {
301
+ return this.routeTerminalRequest('post', request, '/api/queue/delete', '/api/queue/delete');
302
+ });
303
+ }
304
+ /**
305
+ * Reboot a payment terminal.
306
+ */
307
+ reboot(request) {
308
+ return __awaiter(this, void 0, void 0, function* () {
309
+ return this.routeTerminalRequest('post', request, '/api/reboot', '/api/terminal-reboot');
310
+ });
311
+ }
312
+ /**
313
+ * Returns routing and location data for a payment terminal.
314
+ */
315
+ locate(request) {
316
+ return this._gatewayRequest('post', '/api/terminal-locate', request);
317
+ }
318
+ /**
319
+ * Captures a preauthorization.
320
+ */
321
+ capture(request) {
322
+ return this._gatewayRequest('post', '/api/capture', request);
323
+ }
324
+ /**
325
+ * Discards a previous transaction.
326
+ */
327
+ void(request) {
328
+ return this._gatewayRequest('post', '/api/void', request);
329
+ }
330
+ /**
331
+ * Executes a manual time out reversal.
332
+ *
333
+ * We love time out reversals. Don't be afraid to use them whenever a request to a
334
+ * BlockChyp terminal times out. You have up to two minutes to reverse any transaction.
335
+ * The only caveat is that you must assign transactionRef values when you build the
336
+ * original request. Otherwise, we have no real way of knowing which transaction you're
337
+ * trying to reverse because we may not have assigned it an id yet. And if we did assign it an
338
+ * id, you wouldn't know what it is because your request to the terminal timed out before
339
+ * you got a response.
340
+ */
341
+ reverse(request) {
342
+ return this._gatewayRequest('post', '/api/reverse', request);
343
+ }
344
+ /**
345
+ * Closes the current credit card batch.
346
+ */
347
+ closeBatch(request) {
348
+ return this._gatewayRequest('post', '/api/close-batch', request);
349
+ }
350
+ /**
351
+ * Creates and send a payment link to a customer.
352
+ */
353
+ sendPaymentLink(request) {
354
+ return this._gatewayRequest('post', '/api/send-payment-link', request);
355
+ }
356
+ /**
357
+ * Resends payment link.
358
+ */
359
+ resendPaymentLink(request) {
360
+ return this._gatewayRequest('post', '/api/resend-payment-link', request);
361
+ }
362
+ /**
363
+ * Cancels a payment link.
364
+ */
365
+ cancelPaymentLink(request) {
366
+ return this._gatewayRequest('post', '/api/cancel-payment-link', request);
367
+ }
368
+ /**
369
+ * Retrieves the status of a payment link.
370
+ */
371
+ paymentLinkStatus(request) {
372
+ return this._gatewayRequest('post', '/api/payment-link-status', request);
373
+ }
374
+ /**
375
+ * Retrieves the current status of a transaction.
376
+ */
377
+ transactionStatus(request) {
378
+ return this._gatewayRequest('post', '/api/tx-status', request);
379
+ }
380
+ /**
381
+ * Updates or creates a customer record.
382
+ */
383
+ updateCustomer(request) {
384
+ return this._gatewayRequest('post', '/api/update-customer', request);
385
+ }
386
+ /**
387
+ * Retrieves a customer by id.
388
+ */
389
+ customer(request) {
390
+ return this._gatewayRequest('post', '/api/customer', request);
391
+ }
392
+ /**
393
+ * Searches the customer database.
394
+ */
395
+ customerSearch(request) {
396
+ return this._gatewayRequest('post', '/api/customer-search', request);
397
+ }
398
+ /**
399
+ * Calculates the discount for actual cash transactions.
400
+ */
401
+ cashDiscount(request) {
402
+ return this._gatewayRequest('post', '/api/cash-discount', request);
403
+ }
404
+ /**
405
+ * Returns the batch history for a merchant.
406
+ */
407
+ batchHistory(request) {
408
+ return this._gatewayRequest('post', '/api/batch-history', request);
409
+ }
410
+ /**
411
+ * Returns the batch details for a single batch.
412
+ */
413
+ batchDetails(request) {
414
+ return this._gatewayRequest('post', '/api/batch-details', request);
415
+ }
416
+ /**
417
+ * Returns the transaction history for a merchant.
418
+ */
419
+ transactionHistory(request) {
420
+ return this._gatewayRequest('post', '/api/tx-history', request);
421
+ }
422
+ /**
423
+ * Returns pricing policy for a merchant.
424
+ */
425
+ pricingPolicy(request) {
426
+ return this._gatewayRequest('post', '/api/read-pricing-policy', request);
427
+ }
428
+ /**
429
+ * Returns a list of partner statements.
430
+ */
431
+ partnerStatements(request) {
432
+ return this._gatewayRequest('post', '/api/partner-statement-list', request);
433
+ }
434
+ /**
435
+ * Returns detail for a single partner statement.
436
+ */
437
+ partnerStatementDetail(request) {
438
+ return this._gatewayRequest('post', '/api/partner-statement-detail', request);
439
+ }
440
+ /**
441
+ * Returns a list of merchant invoices.
442
+ */
443
+ merchantInvoices(request) {
444
+ return this._gatewayRequest('post', '/api/merchant-invoice-list', request);
445
+ }
446
+ /**
447
+ * Returns detail for a single merchant-invoice statement.
448
+ */
449
+ merchantInvoiceDetail(request) {
450
+ return this._gatewayRequest('post', '/api/merchant-invoice-detail', request);
451
+ }
452
+ /**
453
+ * Returns low level details for how partner commissions were calculated for a specific
454
+ * merchant statement.
455
+ */
456
+ partnerCommissionBreakdown(request) {
457
+ return this._gatewayRequest('post', '/api/partner-commission-breakdown', request);
458
+ }
459
+ /**
460
+ * Generates and returns api credentials for a given merchant.
461
+ */
462
+ merchantCredentialGeneration(request) {
463
+ return this._gatewayRequest('post', '/api/creds/generateMerchant', request);
464
+ }
465
+ /**
466
+ * Returns profile information for a merchant.
467
+ */
468
+ merchantProfile(request) {
469
+ return this._gatewayRequest('post', '/api/public-merchant-profile', request);
470
+ }
471
+ /**
472
+ * Deletes a customer record.
473
+ */
474
+ deleteCustomer(request) {
475
+ return this._gatewayRequest('delete', '/api/customer/' + request.customerId, request);
476
+ }
477
+ /**
478
+ * Retrieves payment token metadata.
479
+ */
480
+ tokenMetadata(request) {
481
+ return this._gatewayRequest('get', '/api/token/' + request.token, request);
482
+ }
483
+ /**
484
+ * Links a token to a customer record.
485
+ */
486
+ linkToken(request) {
487
+ return this._gatewayRequest('post', '/api/link-token', request);
488
+ }
489
+ /**
490
+ * Removes a link between a customer and a token.
491
+ */
492
+ unlinkToken(request) {
493
+ return this._gatewayRequest('post', '/api/unlink-token', request);
494
+ }
495
+ /**
496
+ * Deletes a payment token.
497
+ */
498
+ deleteToken(request) {
499
+ return this._gatewayRequest('delete', '/api/token/' + request.token, request);
500
+ }
501
+ /**
502
+ * Adds a test merchant account.
503
+ */
504
+ getMerchants(request) {
505
+ return this._dashboardRequest('post', '/api/get-merchants', request);
506
+ }
507
+ /**
508
+ * Adds or updates a merchant account. Can be used to create or update test merchants.
509
+ * Only gateway partners may create new live merchants.
510
+ */
511
+ updateMerchant(request) {
512
+ return this._dashboardRequest('post', '/api/update-merchant', request);
513
+ }
514
+ /**
515
+ * List all active users and pending invites for a merchant account.
516
+ */
517
+ merchantUsers(request) {
518
+ return this._dashboardRequest('post', '/api/merchant-users', request);
519
+ }
520
+ /**
521
+ * Invites a user to join a merchant account.
522
+ */
523
+ inviteMerchantUser(request) {
524
+ return this._dashboardRequest('post', '/api/invite-merchant-user', request);
525
+ }
526
+ /**
527
+ * Adds a test merchant account.
528
+ */
529
+ addTestMerchant(request) {
530
+ return this._dashboardRequest('post', '/api/add-test-merchant', request);
531
+ }
532
+ /**
533
+ * Deletes a test merchant account. Supports partner scoped API credentials only. Live
534
+ * merchant accounts cannot be deleted.
535
+ */
536
+ deleteTestMerchant(request) {
537
+ return this._dashboardRequest('delete', '/api/test-merchant/' + request.merchantId, request);
538
+ }
539
+ /**
540
+ * List all merchant platforms configured for a gateway merchant.
541
+ */
542
+ merchantPlatforms(request) {
543
+ return this._dashboardRequest('get', '/api/plugin-configs/' + request.merchantId, request);
544
+ }
545
+ /**
546
+ * List all merchant platforms configured for a gateway merchant.
547
+ */
548
+ updateMerchantPlatforms(request) {
549
+ return this._dashboardRequest('post', '/api/plugin-configs', request);
550
+ }
551
+ /**
552
+ * Deletes a boarding platform configuration.
553
+ */
554
+ deleteMerchantPlatforms(request) {
555
+ return this._dashboardRequest('delete', '/api/plugin-config/' + request.platformId, request);
556
+ }
557
+ /**
558
+ * Returns all terminals associated with the merchant account.
559
+ */
560
+ terminals(request) {
561
+ return this._dashboardRequest('get', '/api/terminals', request);
562
+ }
563
+ /**
564
+ * Deactivates a terminal.
565
+ */
566
+ deactivateTerminal(request) {
567
+ return this._dashboardRequest('delete', '/api/terminal/' + request.terminalId, request);
568
+ }
569
+ /**
570
+ * Activates a terminal.
571
+ */
572
+ activateTerminal(request) {
573
+ return this._dashboardRequest('post', '/api/terminal-activate', request);
574
+ }
575
+ /**
576
+ * Returns a list of terms and conditions templates associated with a merchant account.
577
+ */
578
+ tcTemplates(request) {
579
+ return this._dashboardRequest('get', '/api/tc-templates', request);
580
+ }
581
+ /**
582
+ * Returns a single terms and conditions template.
583
+ */
584
+ tcTemplate(request) {
585
+ return this._dashboardRequest('get', '/api/tc-templates/' + request.templateId, request);
586
+ }
587
+ /**
588
+ * Updates or creates a terms and conditions template.
589
+ */
590
+ tcUpdateTemplate(request) {
591
+ return this._dashboardRequest('post', '/api/tc-templates', request);
592
+ }
593
+ /**
594
+ * Deletes a single terms and conditions template.
595
+ */
596
+ tcDeleteTemplate(request) {
597
+ return this._dashboardRequest('delete', '/api/tc-templates/' + request.templateId, request);
598
+ }
599
+ /**
600
+ * Returns up to 250 entries from the Terms and Conditions log.
601
+ */
602
+ tcLog(request) {
603
+ return this._dashboardRequest('post', '/api/tc-log', request);
604
+ }
605
+ /**
606
+ * Returns a single detailed Terms and Conditions entry.
607
+ */
608
+ tcEntry(request) {
609
+ return this._dashboardRequest('get', '/api/tc-entry/' + request.logEntryId, request);
610
+ }
611
+ /**
612
+ * Returns all survey questions for a given merchant.
613
+ */
614
+ surveyQuestions(request) {
615
+ return this._dashboardRequest('get', '/api/survey-questions', request);
616
+ }
617
+ /**
618
+ * Returns a single survey question with response data.
619
+ */
620
+ surveyQuestion(request) {
621
+ return this._dashboardRequest('get', '/api/survey-questions/' + request.questionId, request);
622
+ }
623
+ /**
624
+ * Updates or creates a survey question.
625
+ */
626
+ updateSurveyQuestion(request) {
627
+ return this._dashboardRequest('post', '/api/survey-questions', request);
628
+ }
629
+ /**
630
+ * Deletes a survey question.
631
+ */
632
+ deleteSurveyQuestion(request) {
633
+ return this._dashboardRequest('delete', '/api/survey-questions/' + request.questionId, request);
634
+ }
635
+ /**
636
+ * Returns results for a single survey question.
637
+ */
638
+ surveyResults(request) {
639
+ return this._dashboardRequest('post', '/api/survey-results', request);
640
+ }
641
+ /**
642
+ * Returns the media library for a given partner, merchant, or organization.
643
+ */
644
+ media(request) {
645
+ return this._dashboardRequest('get', '/api/media', request);
646
+ }
647
+ /**
648
+ * Uploads a media asset to the media library.
649
+ */
650
+ uploadMedia(request, content) {
651
+ return this._uploadRequest('/api/upload-media', request, content);
652
+ }
653
+ /**
654
+ * Retrieves the current status of a file upload.
655
+ */
656
+ uploadStatus(request) {
657
+ return this._dashboardRequest('get', '/api/media-upload/' + request.uploadId, request);
658
+ }
659
+ /**
660
+ * Returns the media details for a single media asset.
661
+ */
662
+ mediaAsset(request) {
663
+ return this._dashboardRequest('get', '/api/media/' + request.mediaId, request);
664
+ }
665
+ /**
666
+ * Deletes a media asset.
667
+ */
668
+ deleteMediaAsset(request) {
669
+ return this._dashboardRequest('delete', '/api/media/' + request.mediaId, request);
670
+ }
671
+ /**
672
+ * Returns a collection of slide shows.
673
+ */
674
+ slideShows(request) {
675
+ return this._dashboardRequest('get', '/api/slide-shows', request);
676
+ }
677
+ /**
678
+ * Returns a single slide show with slides.
679
+ */
680
+ slideShow(request) {
681
+ return this._dashboardRequest('get', '/api/slide-shows/' + request.slideShowId, request);
682
+ }
683
+ /**
684
+ * Updates or creates a slide show.
685
+ */
686
+ updateSlideShow(request) {
687
+ return this._dashboardRequest('post', '/api/slide-shows', request);
688
+ }
689
+ /**
690
+ * Deletes a single slide show.
691
+ */
692
+ deleteSlideShow(request) {
693
+ return this._dashboardRequest('delete', '/api/slide-shows/' + request.slideShowId, request);
694
+ }
695
+ /**
696
+ * Returns the terminal branding stack for a given set of API credentials.
697
+ */
698
+ terminalBranding(request) {
699
+ return this._dashboardRequest('get', '/api/terminal-branding', request);
700
+ }
701
+ /**
702
+ * Updates a branding asset.
703
+ */
704
+ updateBrandingAsset(request) {
705
+ return this._dashboardRequest('post', '/api/terminal-branding', request);
706
+ }
707
+ /**
708
+ * Deletes a branding asset.
709
+ */
710
+ deleteBrandingAsset(request) {
711
+ return this._dashboardRequest('delete', '/api/terminal-branding/' + request.assetId, request);
712
+ }
713
+ routeTerminalRequest(method, request, terminalPath, cloudPath) {
714
+ return __awaiter(this, void 0, void 0, function* () {
715
+ if (this.isTerminalRouted(request)) {
716
+ const route = yield this._resolveTerminalRoute(request.terminalName);
717
+ if (route && !route.cloudRelayEnabled) {
718
+ return this._terminalRequest(method, route, terminalPath, request);
719
+ }
720
+ }
721
+ if (cloudPath) {
722
+ return this._relayRequest(method, cloudPath, request);
723
+ }
724
+ return this._gatewayRequest(method, terminalPath, request);
725
+ });
726
+ }
727
+ routeTerminalPost(request, terminalPath, cloudPath) {
728
+ return __awaiter(this, void 0, void 0, function* () {
729
+ return this.routeTerminalRequest('post', request, terminalPath, cloudPath);
730
+ });
731
+ }
732
+ returnValidationError(desc) {
733
+ const result = {
734
+ data: {
735
+ approved: false,
736
+ success: false,
737
+ error: desc
738
+ }
739
+ };
740
+ return result;
741
+ }
742
+ validateRequest(request) {
743
+ if (!this.validateCurrency(request.amount)) {
744
+ return false;
745
+ }
746
+ return true;
747
+ }
748
+ validateCurrency(val) {
749
+ const amt = parseFloat(val);
750
+ if (amt && !isNaN(amt)) {
751
+ const decMatch = val.match(/\./g);
752
+ if (decMatch && decMatch.length > 1) {
753
+ return false;
754
+ }
755
+ return true;
756
+ }
757
+ return false;
758
+ }
759
+ isTerminalRouted(request) {
760
+ if (this.cloudRelay) {
761
+ return false;
762
+ }
763
+ else if (request.terminalName) {
764
+ return true;
765
+ }
766
+ return false;
767
+ }
768
+ _relayRequest(method, path, request) {
769
+ return this._gatewayRequest(method, path, request, true);
770
+ }
771
+ _uploadRequest(path, request, content) {
772
+ const config = {
773
+ method: 'post',
774
+ url: this._assembleDashboardUrl(path),
775
+ timeout: this._getTimeout(request, this.gatewayTimeout) * 1000,
776
+ headers: {
777
+ [AGENT_HEADER]: USER_AGENT,
778
+ },
779
+ };
780
+ config.data = content;
781
+ if (this.credentials && this.credentials.apiKey) {
782
+ config.headers = Object.assign(config.headers, cryptoutils_1.default.generateGatewayHeaders(this.credentials));
783
+ }
784
+ if (request.fileSize) {
785
+ config.headers['X-File-Size'] = request.fileSize.toFixed();
786
+ }
787
+ if (request.fileName) {
788
+ config.headers['X-Upload-File-Name'] = request.fileName;
789
+ }
790
+ if (request.uploadId) {
791
+ config.headers['X-Upload-ID'] = request.uploadId;
792
+ }
793
+ return (0, axios_1.default)(config);
794
+ }
795
+ _dashboardRequest(method, path, request) {
796
+ const config = {
797
+ method: method,
798
+ url: this._assembleDashboardUrl(path),
799
+ timeout: this._getTimeout(request, this.gatewayTimeout) * 1000,
800
+ headers: {
801
+ [AGENT_HEADER]: USER_AGENT,
802
+ 'Content-Type': 'application/json',
803
+ },
804
+ };
805
+ if (method !== 'get') {
806
+ config.data = request;
807
+ }
808
+ if (this.credentials && this.credentials.apiKey) {
809
+ config.headers = Object.assign(config.headers, cryptoutils_1.default.generateGatewayHeaders(this.credentials));
810
+ }
811
+ return (0, axios_1.default)(config);
812
+ }
813
+ _gatewayRequest(method, path, request, relay) {
814
+ const config = {
815
+ method: method,
816
+ url: this._assembleGatewayUrl(path, request),
817
+ timeout: this._getTimeout(request, relay ? this.terminalTimeout : this.gatewayTimeout) * 1000,
818
+ headers: {
819
+ [AGENT_HEADER]: USER_AGENT,
820
+ 'Content-Type': 'application/json',
821
+ },
822
+ };
823
+ if (method !== 'get') {
824
+ config.data = request;
825
+ }
826
+ if (this.credentials && this.credentials.apiKey) {
827
+ config.headers = Object.assign(config.headers, cryptoutils_1.default.generateGatewayHeaders(this.credentials));
828
+ }
829
+ return (0, axios_1.default)(config);
830
+ }
831
+ _getTimeout(request, defaultTimeout) {
832
+ if (request && 'timeout' in request) {
833
+ return request['timeout'];
834
+ }
835
+ return defaultTimeout;
836
+ }
837
+ _assembleDashboardUrl(path) {
838
+ return this.dashboardHost + path;
839
+ }
840
+ _assembleGatewayUrl(path, payload) {
841
+ let result = '';
842
+ if (payload && payload.test) {
843
+ result = result + this.testGatewayHost;
844
+ }
845
+ else {
846
+ result = result + this.gatewayHost;
847
+ }
848
+ result = result + path;
849
+ return result;
850
+ }
851
+ _terminalRequest(method, route, path, request) {
852
+ return __awaiter(this, void 0, void 0, function* () {
853
+ const url = yield this._assembleTerminalUrl(route, path);
854
+ const config = {
855
+ method: method,
856
+ url: url,
857
+ headers: {
858
+ [AGENT_HEADER]: USER_AGENT,
859
+ 'Content-Type': 'application/json',
860
+ },
861
+ timeout: this._getTimeout(request, this.terminalTimeout) * 1000,
862
+ };
863
+ if (typeof window === 'undefined') {
864
+ if (this.https) {
865
+ config.httpsAgent = new nodeHttps.Agent({
866
+ rejectUnauthorized: false
867
+ });
868
+ }
869
+ }
870
+ else {
871
+ config.httpsAgent = {
872
+ protocol: 'https:',
873
+ rejectUnauthorized: false
874
+ };
875
+ }
876
+ if (request) {
877
+ config.data = {
878
+ apiKey: route.transientCredentials.apiKey,
879
+ bearerToken: route.transientCredentials.bearerToken,
880
+ signingKey: route.transientCredentials.signingKey,
881
+ request: request,
882
+ };
883
+ }
884
+ return (0, axios_1.default)(config);
885
+ });
886
+ }
887
+ _assembleTerminalUrl(route, path) {
888
+ return __awaiter(this, void 0, void 0, function* () {
889
+ let result = 'http';
890
+ if (this.https) {
891
+ result = result + 's';
892
+ }
893
+ result = result + '://';
894
+ result = result + route.ipAddress;
895
+ if (this.https) {
896
+ result = result + ':8443';
897
+ }
898
+ else {
899
+ result = result + ':8080';
900
+ }
901
+ result = result + path;
902
+ return result;
903
+ });
904
+ }
905
+ _resolveTerminalRoute(terminalName) {
906
+ return __awaiter(this, void 0, void 0, function* () {
907
+ const cacheEntry = this._routeCache[terminalName];
908
+ if (cacheEntry) {
909
+ if (cacheEntry.ttl >= new Date().getTime()) {
910
+ return cacheEntry.route;
911
+ }
912
+ }
913
+ const routeResponse = yield this._gatewayRequest('get', '/api/terminal-route?terminal=' + terminalName);
914
+ const route = routeResponse.data;
915
+ this._routeCache[terminalName] =
916
+ {
917
+ ttl: new Date().getTime() + (this.routeCacheTTL * 60000),
918
+ route: route
919
+ };
920
+ return route;
921
+ });
922
+ }
923
+ }
924
+ exports.BlockChypClient = BlockChypClient;
925
+ class BlockChypCredentials {
926
+ constructor(apiKey, bearerToken, signingKey) {
927
+ this.apiKey = apiKey;
928
+ this.bearerToken = bearerToken;
929
+ this.signingKey = signingKey;
930
+ this.apiKey = apiKey;
931
+ this.bearerToken = bearerToken;
932
+ this.signingKey = signingKey;
933
+ }
934
+ }
935
+ exports.BlockChypCredentials = BlockChypCredentials;
936
+ const BlockChyp = new BlockChypClient();
937
+ exports.default = BlockChyp;
938
+ function newClient(creds) {
939
+ return BlockChyp.newClient(creds);
940
+ }
941
+ exports.newClient = newClient;