@blockchyp/blockchyp-ts 1.0.0 → 2.18.6

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/README.md +8 -9
  2. package/_bundles/blockchyp.js +71404 -0
  3. package/_bundles/blockchyp.js.map +1 -0
  4. package/_bundles/blockchyp.min.js +3 -0
  5. package/_bundles/blockchyp.min.js.LICENSE.txt +16 -0
  6. package/_bundles/blockchyp.min.js.map +1 -0
  7. package/lib/index.d.ts +3 -0
  8. package/{index.js → lib/index.js} +1 -0
  9. package/lib/index.js.map +1 -0
  10. package/lib/spec/CryptoSpec.d.ts +1 -0
  11. package/{spec → lib/spec}/CryptoSpec.js +1 -0
  12. package/lib/spec/CryptoSpec.js.map +1 -0
  13. package/lib/spec/SanitySpec.d.ts +1 -0
  14. package/{spec → lib/spec}/SanitySpec.js +2 -1
  15. package/lib/spec/SanitySpec.js.map +1 -0
  16. package/lib/src/client.d.ts +463 -0
  17. package/{src → lib/src}/client.js +9 -7
  18. package/lib/src/client.js.map +1 -0
  19. package/lib/src/cryptoutils.d.ts +16 -0
  20. package/{src → lib/src}/cryptoutils.js +18 -13
  21. package/lib/src/cryptoutils.js.map +1 -0
  22. package/lib/src/global.d.ts +1 -0
  23. package/lib/src/global.js +30 -0
  24. package/lib/src/global.js.map +1 -0
  25. package/lib/src/models.d.ts +9591 -0
  26. package/{src → lib/src}/models.js +3 -1
  27. package/lib/src/models.js.map +1 -0
  28. package/package.json +23 -9
  29. package/spec/SanitySpec.ts +1 -1
  30. package/src/client.ts +9 -9
  31. package/src/cryptoutils.ts +7 -6
  32. package/src/global.ts +1 -1
  33. package/src/models.ts +7 -0
  34. package/itest/ActivateTerminalITestSpec.js +0 -87
  35. package/itest/ActivateTerminalITestSpec.ts +0 -58
  36. package/itest/AddTestMerchantITestSpec.js +0 -89
  37. package/itest/AddTestMerchantITestSpec.ts +0 -60
  38. package/itest/BatchHistoryITestSpec.js +0 -101
  39. package/itest/BatchHistoryITestSpec.ts +0 -73
  40. package/itest/BooleanPromptITestSpec.js +0 -104
  41. package/itest/BooleanPromptITestSpec.ts +0 -76
  42. package/itest/CancelPaymentLinkITestSpec.js +0 -116
  43. package/itest/CancelPaymentLinkITestSpec.ts +0 -93
  44. package/itest/CaptureSignatureITestSpec.js +0 -101
  45. package/itest/CaptureSignatureITestSpec.ts +0 -73
  46. package/itest/DeactivateTerminalITestSpec.js +0 -82
  47. package/itest/DeactivateTerminalITestSpec.ts +0 -52
  48. package/itest/DeleteBrandingAssetITestSpec.js +0 -96
  49. package/itest/DeleteBrandingAssetITestSpec.ts +0 -69
  50. package/itest/DeleteCustomerITestSpec.js +0 -102
  51. package/itest/DeleteCustomerITestSpec.ts +0 -75
  52. package/itest/DeleteMediaAssetITestSpec.js +0 -100
  53. package/itest/DeleteMediaAssetITestSpec.ts +0 -71
  54. package/itest/DeleteQueuedTransactionITestSpec.js +0 -117
  55. package/itest/DeleteQueuedTransactionITestSpec.ts +0 -89
  56. package/itest/DeleteSlideShowITestSpec.js +0 -96
  57. package/itest/DeleteSlideShowITestSpec.ts +0 -69
  58. package/itest/DeleteSurveyQuestionITestSpec.js +0 -97
  59. package/itest/DeleteSurveyQuestionITestSpec.ts +0 -70
  60. package/itest/DeleteTestMerchantITestSpec.js +0 -96
  61. package/itest/DeleteTestMerchantITestSpec.ts +0 -69
  62. package/itest/DeleteTokenITestSpec.js +0 -102
  63. package/itest/DeleteTokenITestSpec.ts +0 -75
  64. package/itest/EmptyBrandingAssetITestSpec.js +0 -85
  65. package/itest/EmptyBrandingAssetITestSpec.ts +0 -57
  66. package/itest/EmptySlideShowITestSpec.js +0 -87
  67. package/itest/EmptySlideShowITestSpec.ts +0 -58
  68. package/itest/GatewayTimeoutITestSpec.js +0 -103
  69. package/itest/GatewayTimeoutITestSpec.ts +0 -73
  70. package/itest/GetCustomerITestSpec.js +0 -102
  71. package/itest/GetCustomerITestSpec.ts +0 -75
  72. package/itest/GetMerchantsITestSpec.js +0 -84
  73. package/itest/GetMerchantsITestSpec.ts +0 -56
  74. package/itest/InviteMerchantUserITestSpec.js +0 -86
  75. package/itest/InviteMerchantUserITestSpec.ts +0 -58
  76. package/itest/LinkTokenITestSpec.js +0 -103
  77. package/itest/LinkTokenITestSpec.ts +0 -76
  78. package/itest/ListQueuedTransactionsITestSpec.js +0 -116
  79. package/itest/ListQueuedTransactionsITestSpec.ts +0 -88
  80. package/itest/ListTerminalsITestSpec.js +0 -83
  81. package/itest/ListTerminalsITestSpec.ts +0 -56
  82. package/itest/MediaAssetITestSpec.js +0 -105
  83. package/itest/MediaAssetITestSpec.ts +0 -75
  84. package/itest/MediaITestSpec.js +0 -83
  85. package/itest/MediaITestSpec.ts +0 -56
  86. package/itest/MediaUploadITestSpec.js +0 -94
  87. package/itest/MediaUploadITestSpec.ts +0 -63
  88. package/itest/MerchantCredentialGenerationITestSpec.js +0 -85
  89. package/itest/MerchantCredentialGenerationITestSpec.ts +0 -57
  90. package/itest/MerchantInvoiceDetailITestSpec.js +0 -84
  91. package/itest/MerchantInvoiceDetailITestSpec.ts +0 -56
  92. package/itest/MerchantInvoicesITestSpec.js +0 -84
  93. package/itest/MerchantInvoicesITestSpec.ts +0 -56
  94. package/itest/MerchantPlatformsITestSpec.js +0 -96
  95. package/itest/MerchantPlatformsITestSpec.ts +0 -69
  96. package/itest/MerchantProfileITestSpec.js +0 -84
  97. package/itest/MerchantProfileITestSpec.ts +0 -56
  98. package/itest/MerchantUsersITestSpec.js +0 -83
  99. package/itest/MerchantUsersITestSpec.ts +0 -56
  100. package/itest/NewTransactionDisplayITestSpec.js +0 -115
  101. package/itest/NewTransactionDisplayITestSpec.ts +0 -92
  102. package/itest/PANChargeITestSpec.js +0 -118
  103. package/itest/PANChargeITestSpec.ts +0 -88
  104. package/itest/PANEnrollITestSpec.js +0 -118
  105. package/itest/PANEnrollITestSpec.ts +0 -90
  106. package/itest/PANPreauthITestSpec.js +0 -116
  107. package/itest/PANPreauthITestSpec.ts +0 -87
  108. package/itest/PartialRefundITestSpec.js +0 -119
  109. package/itest/PartialRefundITestSpec.ts +0 -91
  110. package/itest/PartnerCommissionBreakdownITestSpec.js +0 -84
  111. package/itest/PartnerCommissionBreakdownITestSpec.ts +0 -56
  112. package/itest/PartnerStatementDetailITestSpec.js +0 -84
  113. package/itest/PartnerStatementDetailITestSpec.ts +0 -56
  114. package/itest/PartnerStatementsITestSpec.js +0 -84
  115. package/itest/PartnerStatementsITestSpec.ts +0 -56
  116. package/itest/PaymentLinkStatusITestSpec.js +0 -116
  117. package/itest/PaymentLinkStatusITestSpec.ts +0 -93
  118. package/itest/PricingPolicyITestSpec.js +0 -85
  119. package/itest/PricingPolicyITestSpec.ts +0 -57
  120. package/itest/ResendPaymentLinkITestSpec.js +0 -116
  121. package/itest/ResendPaymentLinkITestSpec.ts +0 -93
  122. package/itest/SearchCustomerITestSpec.js +0 -101
  123. package/itest/SearchCustomerITestSpec.ts +0 -75
  124. package/itest/SendPaymentLinkITestSpec.js +0 -107
  125. package/itest/SendPaymentLinkITestSpec.ts +0 -82
  126. package/itest/SimpleBatchCloseITestSpec.js +0 -101
  127. package/itest/SimpleBatchCloseITestSpec.ts +0 -73
  128. package/itest/SimpleCaptureITestSpec.js +0 -101
  129. package/itest/SimpleCaptureITestSpec.ts +0 -74
  130. package/itest/SimpleGiftActivateITestSpec.js +0 -104
  131. package/itest/SimpleGiftActivateITestSpec.ts +0 -75
  132. package/itest/SimpleLocateITestSpec.js +0 -85
  133. package/itest/SimpleLocateITestSpec.ts +0 -57
  134. package/itest/SimpleMessageITestSpec.js +0 -101
  135. package/itest/SimpleMessageITestSpec.ts +0 -73
  136. package/itest/SimplePingITestSpec.js +0 -100
  137. package/itest/SimplePingITestSpec.ts +0 -72
  138. package/itest/SimpleRefundITestSpec.js +0 -118
  139. package/itest/SimpleRefundITestSpec.ts +0 -90
  140. package/itest/SimpleReversalITestSpec.js +0 -103
  141. package/itest/SimpleReversalITestSpec.ts +0 -75
  142. package/itest/SimpleVoidITestSpec.js +0 -103
  143. package/itest/SimpleVoidITestSpec.ts +0 -75
  144. package/itest/SlideShowITestSpec.js +0 -98
  145. package/itest/SlideShowITestSpec.ts +0 -70
  146. package/itest/SlideShowsITestSpec.js +0 -95
  147. package/itest/SlideShowsITestSpec.ts +0 -69
  148. package/itest/SurveyQuestionITestSpec.js +0 -95
  149. package/itest/SurveyQuestionITestSpec.ts +0 -68
  150. package/itest/SurveyQuestionsITestSpec.js +0 -96
  151. package/itest/SurveyQuestionsITestSpec.ts +0 -70
  152. package/itest/SurveyResultsITestSpec.js +0 -95
  153. package/itest/SurveyResultsITestSpec.ts +0 -68
  154. package/itest/TCDeleteTemplateITestSpec.js +0 -98
  155. package/itest/TCDeleteTemplateITestSpec.ts +0 -70
  156. package/itest/TCEntryITestSpec.js +0 -103
  157. package/itest/TCEntryITestSpec.ts +0 -76
  158. package/itest/TCLogITestSpec.js +0 -83
  159. package/itest/TCLogITestSpec.ts +0 -56
  160. package/itest/TCTemplateITestSpec.js +0 -101
  161. package/itest/TCTemplateITestSpec.ts +0 -72
  162. package/itest/TCTemplateUpdateITestSpec.js +0 -91
  163. package/itest/TCTemplateUpdateITestSpec.ts +0 -61
  164. package/itest/TCTemplatesITestSpec.js +0 -83
  165. package/itest/TCTemplatesITestSpec.ts +0 -56
  166. package/itest/TerminalBrandingITestSpec.js +0 -83
  167. package/itest/TerminalBrandingITestSpec.ts +0 -56
  168. package/itest/TerminalChargeITestSpec.js +0 -113
  169. package/itest/TerminalChargeITestSpec.ts +0 -84
  170. package/itest/TerminalClearITestSpec.js +0 -100
  171. package/itest/TerminalClearITestSpec.ts +0 -72
  172. package/itest/TerminalEBTBalanceITestSpec.js +0 -103
  173. package/itest/TerminalEBTBalanceITestSpec.ts +0 -74
  174. package/itest/TerminalEBTChargeITestSpec.js +0 -115
  175. package/itest/TerminalEBTChargeITestSpec.ts +0 -86
  176. package/itest/TerminalEnrollITestSpec.js +0 -112
  177. package/itest/TerminalEnrollITestSpec.ts +0 -83
  178. package/itest/TerminalGiftCardBalanceITestSpec.js +0 -102
  179. package/itest/TerminalGiftCardBalanceITestSpec.ts +0 -73
  180. package/itest/TerminalKeyedChargeITestSpec.js +0 -114
  181. package/itest/TerminalKeyedChargeITestSpec.ts +0 -85
  182. package/itest/TerminalManualEBTChargeITestSpec.js +0 -116
  183. package/itest/TerminalManualEBTChargeITestSpec.ts +0 -87
  184. package/itest/TerminalPreauthITestSpec.js +0 -113
  185. package/itest/TerminalPreauthITestSpec.ts +0 -84
  186. package/itest/TerminalQueuedTransactionITestSpec.js +0 -108
  187. package/itest/TerminalQueuedTransactionITestSpec.ts +0 -78
  188. package/itest/TerminalStatusITestSpec.js +0 -100
  189. package/itest/TerminalStatusITestSpec.ts +0 -72
  190. package/itest/TerminalTimeoutITestSpec.js +0 -99
  191. package/itest/TerminalTimeoutITestSpec.ts +0 -70
  192. package/itest/TermsAndConditionsITestSpec.js +0 -105
  193. package/itest/TermsAndConditionsITestSpec.ts +0 -77
  194. package/itest/TextPromptITestSpec.js +0 -103
  195. package/itest/TextPromptITestSpec.ts +0 -74
  196. package/itest/TokenMetadataITestSpec.js +0 -102
  197. package/itest/TokenMetadataITestSpec.ts +0 -75
  198. package/itest/TransactionHistoryITestSpec.js +0 -101
  199. package/itest/TransactionHistoryITestSpec.ts +0 -73
  200. package/itest/UnlinkTokenITestSpec.js +0 -103
  201. package/itest/UnlinkTokenITestSpec.ts +0 -76
  202. package/itest/UpdateBrandingAssetITestSpec.js +0 -109
  203. package/itest/UpdateBrandingAssetITestSpec.ts +0 -80
  204. package/itest/UpdateCustomerITestSpec.js +0 -90
  205. package/itest/UpdateCustomerITestSpec.ts +0 -63
  206. package/itest/UpdateMerchantITestSpec.js +0 -92
  207. package/itest/UpdateMerchantITestSpec.ts +0 -65
  208. package/itest/UpdateMerchantPlatformsITestSpec.js +0 -98
  209. package/itest/UpdateMerchantPlatformsITestSpec.ts +0 -71
  210. package/itest/UpdateSlideShowITestSpec.js +0 -106
  211. package/itest/UpdateSlideShowITestSpec.ts +0 -78
  212. package/itest/UpdateSurveyQuestionITestSpec.js +0 -89
  213. package/itest/UpdateSurveyQuestionITestSpec.ts +0 -60
  214. package/itest/UpdateTransactionDisplayITestSpec.js +0 -115
  215. package/itest/UpdateTransactionDisplayITestSpec.ts +0 -92
  216. package/itest/UploadStatusITestSpec.js +0 -100
  217. package/itest/UploadStatusITestSpec.ts +0 -71
  218. package/itest/support/aviato.png +0 -0
  219. package/itest/support/config.js +0 -67
  220. package/itest/support/config.ts +0 -106
  221. package/itest/support/jasmine.json +0 -11
  222. package/spec/support/jasmine.json +0 -11
  223. package/src/global.js +0 -9
@@ -1,116 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
4
- * by a license that can be found in the LICENSE file.
5
- *
6
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
7
- * file will be lost every time the code is regenerated.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
- return new (P || (P = Promise))(function (resolve, reject) {
35
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
- step((generator = generator.apply(thisArg, _arguments || [])).next());
39
- });
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- const config_1 = require("./support/config");
43
- const BlockChyp = __importStar(require("../index"));
44
- describe('TerminalManualEBTCharge', function () {
45
- let originalTimeout;
46
- let client;
47
- config_1.Config.load();
48
- beforeEach(function () {
49
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
50
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
51
- });
52
- it('Can process an ebt direct charge with a terminal', function (done) {
53
- client = BlockChyp.newClient(config_1.Config.getCreds(""));
54
- client.setGatewayHost(config_1.Config.getGatewayHost());
55
- client.setTestGatewayHost(config_1.Config.getTestGatewayHost());
56
- client.setDashboardHost(config_1.Config.getDashboardHost());
57
- const testDelay = process.env.BC_TEST_DELAY;
58
- let testDelayInt = 0;
59
- if (testDelay) {
60
- testDelayInt = parseInt(testDelay);
61
- }
62
- if (testDelayInt > 0) {
63
- const messageRequest = new BlockChyp.MessageRequest();
64
- messageRequest.test = true;
65
- messageRequest.terminalName = config_1.Config.getTerminalName();
66
- messageRequest.message = 'Running TerminalManualEBTCharge in ' + testDelay + ' seconds...';
67
- client.message(messageRequest)
68
- .then(function (httpResponse) {
69
- const response = httpResponse.data;
70
- expect(response.success).toBe(true);
71
- })
72
- .catch(function (error) {
73
- console.log('Error:', error);
74
- done();
75
- });
76
- }
77
- console.log('Running terminalManualEbtCharge...');
78
- setTimeout(function () {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
81
- try {
82
- // setup request object
83
- const request = new BlockChyp.AuthorizationRequest();
84
- request.terminalName = config_1.Config.getTerminalName();
85
- request.amount = '27.00';
86
- request.test = true;
87
- request.cardType = BlockChyp.CardType.EBT;
88
- request.manualEntry = true;
89
- const httpResponse = yield client.charge(request);
90
- const response = httpResponse.data;
91
- // response assertions
92
- expect(response.success).toBe(true);
93
- expect(response.approved).toBe(true);
94
- expect(response.test).toBe(true);
95
- expect((_a = response.authCode) === null || _a === void 0 ? void 0 : _a.length).toBe(6);
96
- expect((_b = response.transactionId) === null || _b === void 0 ? void 0 : _b.trim().length).toBeGreaterThan(0);
97
- expect((_c = response.timestamp) === null || _c === void 0 ? void 0 : _c.trim().length).toBeGreaterThan(0);
98
- expect((_d = response.tickBlock) === null || _d === void 0 ? void 0 : _d.trim().length).toBeGreaterThan(0);
99
- (_e = expect(response.responseDescription)) === null || _e === void 0 ? void 0 : _e.toEqual('approved');
100
- expect((_f = response.paymentType) === null || _f === void 0 ? void 0 : _f.trim().length).toBeGreaterThan(0);
101
- expect((_g = response.maskedPan) === null || _g === void 0 ? void 0 : _g.trim().length).toBeGreaterThan(0);
102
- expect((_h = response.entryMethod) === null || _h === void 0 ? void 0 : _h.trim().length).toBeGreaterThan(0);
103
- (_j = expect(response.authorizedAmount)) === null || _j === void 0 ? void 0 : _j.toEqual('27.00');
104
- (_k = expect(response.remainingBalance)) === null || _k === void 0 ? void 0 : _k.toEqual('73.00');
105
- }
106
- catch (error) {
107
- console.log('Error:', error);
108
- fail(error);
109
- }
110
- finally {
111
- done();
112
- }
113
- });
114
- }, testDelayInt * 1000);
115
- });
116
- });
@@ -1,87 +0,0 @@
1
- /**
2
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
3
- * by a license that can be found in the LICENSE file.
4
- *
5
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
6
- * file will be lost every time the code is regenerated.
7
- */
8
-
9
- import { v4 as uuidv4 } from 'uuid';
10
- import { Config } from './support/config';
11
- import * as BlockChyp from '../index';
12
-
13
- describe('TerminalManualEBTCharge', function () {
14
- let originalTimeout: number;
15
- let client: typeof BlockChyp.BlockChypClient;
16
- Config.load();
17
-
18
- beforeEach(function () {
19
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
20
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
21
- });
22
-
23
- it('Can process an ebt direct charge with a terminal', function (done) {
24
- client = BlockChyp.newClient(Config.getCreds(""));
25
- client.setGatewayHost(Config.getGatewayHost());
26
- client.setTestGatewayHost(Config.getTestGatewayHost());
27
- client.setDashboardHost(Config.getDashboardHost());
28
-
29
- const testDelay = process.env.BC_TEST_DELAY;
30
- let testDelayInt = 0;
31
- if (testDelay) {
32
- testDelayInt = parseInt(testDelay);
33
- }
34
-
35
- if (testDelayInt > 0) {
36
- const messageRequest = new BlockChyp.MessageRequest();
37
- messageRequest.test = true;
38
- messageRequest.terminalName = Config.getTerminalName();
39
- messageRequest.message = 'Running TerminalManualEBTCharge in ' + testDelay + ' seconds...';
40
- client.message(messageRequest)
41
- .then(function (httpResponse) {
42
- const response = httpResponse.data;
43
- expect(response.success).toBe(true);
44
- })
45
- .catch(function (error: any) {
46
- console.log('Error:', error);
47
- done();
48
- });
49
- }
50
- console.log('Running terminalManualEbtCharge...');
51
-
52
- setTimeout(async function () {
53
- try {
54
- // setup request object
55
- const request = new BlockChyp.AuthorizationRequest();
56
- request.terminalName = Config.getTerminalName();
57
- request.amount = '27.00';
58
- request.test = true;
59
- request.cardType = BlockChyp.CardType.EBT;
60
- request.manualEntry = true;
61
-
62
- const httpResponse = await client.charge(request)
63
- const response: BlockChyp.AuthorizationResponse = httpResponse.data;
64
- // response assertions
65
- expect(response.success).toBe(true);
66
- expect(response.approved).toBe(true);
67
- expect(response.test).toBe(true);
68
- expect(response.authCode?.length).toBe(6);
69
- expect(response.transactionId?.trim().length).toBeGreaterThan(0);
70
- expect(response.timestamp?.trim().length).toBeGreaterThan(0);
71
- expect(response.tickBlock?.trim().length).toBeGreaterThan(0);
72
- expect(response.responseDescription)?.toEqual('approved');
73
- expect(response.paymentType?.trim().length).toBeGreaterThan(0);
74
- expect(response.maskedPan?.trim().length).toBeGreaterThan(0);
75
- expect(response.entryMethod?.trim().length).toBeGreaterThan(0);
76
- expect(response.authorizedAmount)?.toEqual('27.00');
77
- expect(response.remainingBalance)?.toEqual('73.00');
78
-
79
- } catch (error) {
80
- console.log('Error:', error);
81
- fail(error);
82
- } finally {
83
- done();
84
- }
85
- }, testDelayInt * 1000);
86
- });
87
- });
@@ -1,113 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
4
- * by a license that can be found in the LICENSE file.
5
- *
6
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
7
- * file will be lost every time the code is regenerated.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
- return new (P || (P = Promise))(function (resolve, reject) {
35
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
- step((generator = generator.apply(thisArg, _arguments || [])).next());
39
- });
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- const config_1 = require("./support/config");
43
- const BlockChyp = __importStar(require("../index"));
44
- describe('TerminalPreauth', function () {
45
- let originalTimeout;
46
- let client;
47
- config_1.Config.load();
48
- beforeEach(function () {
49
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
50
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
51
- });
52
- it('Can process a preauthorization using a terminal', function (done) {
53
- client = BlockChyp.newClient(config_1.Config.getCreds(""));
54
- client.setGatewayHost(config_1.Config.getGatewayHost());
55
- client.setTestGatewayHost(config_1.Config.getTestGatewayHost());
56
- client.setDashboardHost(config_1.Config.getDashboardHost());
57
- const testDelay = process.env.BC_TEST_DELAY;
58
- let testDelayInt = 0;
59
- if (testDelay) {
60
- testDelayInt = parseInt(testDelay);
61
- }
62
- if (testDelayInt > 0) {
63
- const messageRequest = new BlockChyp.MessageRequest();
64
- messageRequest.test = true;
65
- messageRequest.terminalName = config_1.Config.getTerminalName();
66
- messageRequest.message = 'Running TerminalPreauth in ' + testDelay + ' seconds...';
67
- client.message(messageRequest)
68
- .then(function (httpResponse) {
69
- const response = httpResponse.data;
70
- expect(response.success).toBe(true);
71
- })
72
- .catch(function (error) {
73
- console.log('Error:', error);
74
- done();
75
- });
76
- }
77
- console.log('Running terminalPreauth...');
78
- setTimeout(function () {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
81
- try {
82
- // setup request object
83
- const request = new BlockChyp.AuthorizationRequest();
84
- request.terminalName = config_1.Config.getTerminalName();
85
- request.amount = '15.15';
86
- request.test = true;
87
- const httpResponse = yield client.preauth(request);
88
- const response = httpResponse.data;
89
- // response assertions
90
- expect(response.success).toBe(true);
91
- expect(response.approved).toBe(true);
92
- expect(response.test).toBe(true);
93
- expect((_a = response.authCode) === null || _a === void 0 ? void 0 : _a.length).toBe(6);
94
- expect((_b = response.transactionId) === null || _b === void 0 ? void 0 : _b.trim().length).toBeGreaterThan(0);
95
- expect((_c = response.timestamp) === null || _c === void 0 ? void 0 : _c.trim().length).toBeGreaterThan(0);
96
- expect((_d = response.tickBlock) === null || _d === void 0 ? void 0 : _d.trim().length).toBeGreaterThan(0);
97
- (_e = expect(response.responseDescription)) === null || _e === void 0 ? void 0 : _e.toEqual('approved');
98
- expect((_f = response.paymentType) === null || _f === void 0 ? void 0 : _f.trim().length).toBeGreaterThan(0);
99
- expect((_g = response.maskedPan) === null || _g === void 0 ? void 0 : _g.trim().length).toBeGreaterThan(0);
100
- expect((_h = response.entryMethod) === null || _h === void 0 ? void 0 : _h.trim().length).toBeGreaterThan(0);
101
- (_j = expect(response.authorizedAmount)) === null || _j === void 0 ? void 0 : _j.toEqual('15.15');
102
- }
103
- catch (error) {
104
- console.log('Error:', error);
105
- fail(error);
106
- }
107
- finally {
108
- done();
109
- }
110
- });
111
- }, testDelayInt * 1000);
112
- });
113
- });
@@ -1,84 +0,0 @@
1
- /**
2
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
3
- * by a license that can be found in the LICENSE file.
4
- *
5
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
6
- * file will be lost every time the code is regenerated.
7
- */
8
-
9
- import { v4 as uuidv4 } from 'uuid';
10
- import { Config } from './support/config';
11
- import * as BlockChyp from '../index';
12
-
13
- describe('TerminalPreauth', function () {
14
- let originalTimeout: number;
15
- let client: typeof BlockChyp.BlockChypClient;
16
- Config.load();
17
-
18
- beforeEach(function () {
19
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
20
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
21
- });
22
-
23
- it('Can process a preauthorization using a terminal', function (done) {
24
- client = BlockChyp.newClient(Config.getCreds(""));
25
- client.setGatewayHost(Config.getGatewayHost());
26
- client.setTestGatewayHost(Config.getTestGatewayHost());
27
- client.setDashboardHost(Config.getDashboardHost());
28
-
29
- const testDelay = process.env.BC_TEST_DELAY;
30
- let testDelayInt = 0;
31
- if (testDelay) {
32
- testDelayInt = parseInt(testDelay);
33
- }
34
-
35
- if (testDelayInt > 0) {
36
- const messageRequest = new BlockChyp.MessageRequest();
37
- messageRequest.test = true;
38
- messageRequest.terminalName = Config.getTerminalName();
39
- messageRequest.message = 'Running TerminalPreauth in ' + testDelay + ' seconds...';
40
- client.message(messageRequest)
41
- .then(function (httpResponse) {
42
- const response = httpResponse.data;
43
- expect(response.success).toBe(true);
44
- })
45
- .catch(function (error: any) {
46
- console.log('Error:', error);
47
- done();
48
- });
49
- }
50
- console.log('Running terminalPreauth...');
51
-
52
- setTimeout(async function () {
53
- try {
54
- // setup request object
55
- const request = new BlockChyp.AuthorizationRequest();
56
- request.terminalName = Config.getTerminalName();
57
- request.amount = '15.15';
58
- request.test = true;
59
-
60
- const httpResponse = await client.preauth(request)
61
- const response: BlockChyp.AuthorizationResponse = httpResponse.data;
62
- // response assertions
63
- expect(response.success).toBe(true);
64
- expect(response.approved).toBe(true);
65
- expect(response.test).toBe(true);
66
- expect(response.authCode?.length).toBe(6);
67
- expect(response.transactionId?.trim().length).toBeGreaterThan(0);
68
- expect(response.timestamp?.trim().length).toBeGreaterThan(0);
69
- expect(response.tickBlock?.trim().length).toBeGreaterThan(0);
70
- expect(response.responseDescription)?.toEqual('approved');
71
- expect(response.paymentType?.trim().length).toBeGreaterThan(0);
72
- expect(response.maskedPan?.trim().length).toBeGreaterThan(0);
73
- expect(response.entryMethod?.trim().length).toBeGreaterThan(0);
74
- expect(response.authorizedAmount)?.toEqual('15.15');
75
-
76
- } catch (error) {
77
- console.log('Error:', error);
78
- fail(error);
79
- } finally {
80
- done();
81
- }
82
- }, testDelayInt * 1000);
83
- });
84
- });
@@ -1,108 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
4
- * by a license that can be found in the LICENSE file.
5
- *
6
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
7
- * file will be lost every time the code is regenerated.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
33
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
34
- return new (P || (P = Promise))(function (resolve, reject) {
35
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
36
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
37
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38
- step((generator = generator.apply(thisArg, _arguments || [])).next());
39
- });
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- const uuid_1 = require("uuid");
43
- const config_1 = require("./support/config");
44
- const BlockChyp = __importStar(require("../index"));
45
- describe('TerminalQueuedTransaction', function () {
46
- let originalTimeout;
47
- let client;
48
- config_1.Config.load();
49
- beforeEach(function () {
50
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
51
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
52
- });
53
- it('Queues a terminal for later processing on a terminal', function (done) {
54
- client = BlockChyp.newClient(config_1.Config.getCreds(""));
55
- client.setGatewayHost(config_1.Config.getGatewayHost());
56
- client.setTestGatewayHost(config_1.Config.getTestGatewayHost());
57
- client.setDashboardHost(config_1.Config.getDashboardHost());
58
- const testDelay = process.env.BC_TEST_DELAY;
59
- let testDelayInt = 0;
60
- if (testDelay) {
61
- testDelayInt = parseInt(testDelay);
62
- }
63
- if (testDelayInt > 0) {
64
- const messageRequest = new BlockChyp.MessageRequest();
65
- messageRequest.test = true;
66
- messageRequest.terminalName = config_1.Config.getTerminalName();
67
- messageRequest.message = 'Running TerminalQueuedTransaction in ' + testDelay + ' seconds...';
68
- client.message(messageRequest)
69
- .then(function (httpResponse) {
70
- const response = httpResponse.data;
71
- expect(response.success).toBe(true);
72
- })
73
- .catch(function (error) {
74
- console.log('Error:', error);
75
- done();
76
- });
77
- }
78
- console.log('Running terminalQueuedTransaction...');
79
- setTimeout(function () {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- var _a;
82
- try {
83
- // setup request object
84
- const request = new BlockChyp.AuthorizationRequest();
85
- request.terminalName = config_1.Config.getTerminalName();
86
- request.transactionRef = (0, uuid_1.v4)();
87
- request.description = '1060 West Addison';
88
- request.amount = '25.15';
89
- request.test = true;
90
- request.queue = true;
91
- const httpResponse = yield client.charge(request);
92
- const response = httpResponse.data;
93
- // response assertions
94
- expect(response.success).toBe(true);
95
- expect(response.approved).toBe(false);
96
- (_a = expect(response.responseDescription)) === null || _a === void 0 ? void 0 : _a.toEqual('Queued');
97
- }
98
- catch (error) {
99
- console.log('Error:', error);
100
- fail(error);
101
- }
102
- finally {
103
- done();
104
- }
105
- });
106
- }, testDelayInt * 1000);
107
- });
108
- });
@@ -1,78 +0,0 @@
1
- /**
2
- * Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
3
- * by a license that can be found in the LICENSE file.
4
- *
5
- * This file was generated automatically by the BlockChyp SDK Generator. Changes to this
6
- * file will be lost every time the code is regenerated.
7
- */
8
-
9
- import { v4 as uuidv4 } from 'uuid';
10
- import { Config } from './support/config';
11
- import * as BlockChyp from '../index';
12
-
13
- describe('TerminalQueuedTransaction', function () {
14
- let originalTimeout: number;
15
- let client: typeof BlockChyp.BlockChypClient;
16
- Config.load();
17
-
18
- beforeEach(function () {
19
- originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
20
- jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
21
- });
22
-
23
- it('Queues a terminal for later processing on a terminal', function (done) {
24
- client = BlockChyp.newClient(Config.getCreds(""));
25
- client.setGatewayHost(Config.getGatewayHost());
26
- client.setTestGatewayHost(Config.getTestGatewayHost());
27
- client.setDashboardHost(Config.getDashboardHost());
28
-
29
- const testDelay = process.env.BC_TEST_DELAY;
30
- let testDelayInt = 0;
31
- if (testDelay) {
32
- testDelayInt = parseInt(testDelay);
33
- }
34
-
35
- if (testDelayInt > 0) {
36
- const messageRequest = new BlockChyp.MessageRequest();
37
- messageRequest.test = true;
38
- messageRequest.terminalName = Config.getTerminalName();
39
- messageRequest.message = 'Running TerminalQueuedTransaction in ' + testDelay + ' seconds...';
40
- client.message(messageRequest)
41
- .then(function (httpResponse) {
42
- const response = httpResponse.data;
43
- expect(response.success).toBe(true);
44
- })
45
- .catch(function (error: any) {
46
- console.log('Error:', error);
47
- done();
48
- });
49
- }
50
- console.log('Running terminalQueuedTransaction...');
51
-
52
- setTimeout(async function () {
53
- try {
54
- // setup request object
55
- const request = new BlockChyp.AuthorizationRequest();
56
- request.terminalName = Config.getTerminalName();
57
- request.transactionRef = uuidv4();
58
- request.description = '1060 West Addison';
59
- request.amount = '25.15';
60
- request.test = true;
61
- request.queue = true;
62
-
63
- const httpResponse = await client.charge(request)
64
- const response: BlockChyp.AuthorizationResponse = httpResponse.data;
65
- // response assertions
66
- expect(response.success).toBe(true);
67
- expect(response.approved).toBe(false);
68
- expect(response.responseDescription)?.toEqual('Queued');
69
-
70
- } catch (error) {
71
- console.log('Error:', error);
72
- fail(error);
73
- } finally {
74
- done();
75
- }
76
- }, testDelayInt * 1000);
77
- });
78
- });