@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/index.js ADDED
@@ -0,0 +1,24 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.BlockChypClient = void 0;
21
+ __exportStar(require("./src/client"), exports);
22
+ var client_1 = require("./src/client");
23
+ Object.defineProperty(exports, "BlockChypClient", { enumerable: true, get: function () { return __importDefault(client_1).default; } });
24
+ __exportStar(require("./src/models"), exports);
package/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './src/client'
2
+ export {default as BlockChypClient} from './src/client'
3
+ export * from './src/models'
@@ -0,0 +1,87 @@
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('ActivateTerminal', 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('activates 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
+ console.log('Running activateTerminal...');
63
+ setTimeout(function () {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ var _a;
66
+ try {
67
+ // setup request object
68
+ const request = new BlockChyp.TerminalActivationRequest();
69
+ request.terminalName = 'Bad Terminal Code';
70
+ request.activationCode = 'XXXXXX';
71
+ const httpResponse = yield client.activateTerminal(request);
72
+ const response = httpResponse.data;
73
+ // response assertions
74
+ expect(response.success).toBe(false);
75
+ (_a = expect(response.error)) === null || _a === void 0 ? void 0 : _a.toEqual('Invalid Activation Code');
76
+ }
77
+ catch (error) {
78
+ console.log('Error:', error);
79
+ fail(error);
80
+ }
81
+ finally {
82
+ done();
83
+ }
84
+ });
85
+ }, testDelayInt * 1000);
86
+ });
87
+ });
@@ -0,0 +1,58 @@
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('ActivateTerminal', 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('activates 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
+ console.log('Running activateTerminal...');
36
+
37
+ setTimeout(async function () {
38
+ try {
39
+ // setup request object
40
+ const request = new BlockChyp.TerminalActivationRequest();
41
+ request.terminalName = 'Bad Terminal Code';
42
+ request.activationCode = 'XXXXXX';
43
+
44
+ const httpResponse = await client.activateTerminal(request)
45
+ const response: BlockChyp.Acknowledgement = httpResponse.data;
46
+ // response assertions
47
+ expect(response.success).toBe(false);
48
+ expect(response.error)?.toEqual('Invalid Activation Code');
49
+
50
+ } catch (error) {
51
+ console.log('Error:', error);
52
+ fail(error);
53
+ } finally {
54
+ done();
55
+ }
56
+ }, testDelayInt * 1000);
57
+ });
58
+ });
@@ -0,0 +1,89 @@
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('AddTestMerchant', 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 add a test merchant', function (done) {
53
+ client = BlockChyp.newClient(config_1.Config.getCreds("partner"));
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
+ console.log('Running addTestMerchant...');
63
+ setTimeout(function () {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ var _a, _b;
66
+ try {
67
+ // setup request object
68
+ const request = new BlockChyp.AddTestMerchantRequest();
69
+ request.dbaName = 'Test Merchant';
70
+ request.companyName = 'Test Merchant';
71
+ const httpResponse = yield client.addTestMerchant(request);
72
+ const response = httpResponse.data;
73
+ // response assertions
74
+ expect(response.success).toBe(true);
75
+ (_a = expect(response.dbaName)) === null || _a === void 0 ? void 0 : _a.toEqual('Test Merchant');
76
+ (_b = expect(response.companyName)) === null || _b === void 0 ? void 0 : _b.toEqual('Test Merchant');
77
+ expect(response.visa).toBe(true);
78
+ }
79
+ catch (error) {
80
+ console.log('Error:', error);
81
+ fail(error);
82
+ }
83
+ finally {
84
+ done();
85
+ }
86
+ });
87
+ }, testDelayInt * 1000);
88
+ });
89
+ });
@@ -0,0 +1,60 @@
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('AddTestMerchant', 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 add a test merchant', function (done) {
24
+ client = BlockChyp.newClient(Config.getCreds("partner"));
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
+ console.log('Running addTestMerchant...');
36
+
37
+ setTimeout(async function () {
38
+ try {
39
+ // setup request object
40
+ const request = new BlockChyp.AddTestMerchantRequest();
41
+ request.dbaName = 'Test Merchant';
42
+ request.companyName = 'Test Merchant';
43
+
44
+ const httpResponse = await client.addTestMerchant(request)
45
+ const response: BlockChyp.MerchantProfileResponse = httpResponse.data;
46
+ // response assertions
47
+ expect(response.success).toBe(true);
48
+ expect(response.dbaName)?.toEqual('Test Merchant');
49
+ expect(response.companyName)?.toEqual('Test Merchant');
50
+ expect(response.visa).toBe(true);
51
+
52
+ } catch (error) {
53
+ console.log('Error:', error);
54
+ fail(error);
55
+ } finally {
56
+ done();
57
+ }
58
+ }, testDelayInt * 1000);
59
+ });
60
+ });
@@ -0,0 +1,101 @@
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('BatchHistory', 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('can retrieve transaction history', 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
+ console.log('Running batchHistory...');
64
+ setTimeout(function () {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ try {
67
+ // setup request object
68
+ const setupRequest = new BlockChyp.AuthorizationRequest();
69
+ setupRequest.pan = '4111111111111111';
70
+ setupRequest.expMonth = '12';
71
+ setupRequest.expYear = '2025';
72
+ setupRequest.amount = '25.55';
73
+ setupRequest.test = true;
74
+ setupRequest.transactionRef = (0, uuid_1.v4)();
75
+ let setupResponse = new BlockChyp.AuthorizationResponse();
76
+ const setupHttpResponse = yield client.charge(setupRequest);
77
+ if (setupHttpResponse.status !== 200) {
78
+ console.log('Error:', setupHttpResponse.statusText);
79
+ fail(setupHttpResponse.statusText);
80
+ done();
81
+ }
82
+ setupResponse = setupHttpResponse.data;
83
+ // setup request object
84
+ const request = new BlockChyp.BatchHistoryRequest();
85
+ request.maxResults = 10;
86
+ const httpResponse = yield client.batchHistory(request);
87
+ const response = httpResponse.data;
88
+ // response assertions
89
+ expect(response.success).toBe(true);
90
+ }
91
+ catch (error) {
92
+ console.log('Error:', error);
93
+ fail(error);
94
+ }
95
+ finally {
96
+ done();
97
+ }
98
+ });
99
+ }, testDelayInt * 1000);
100
+ });
101
+ });
@@ -0,0 +1,73 @@
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('BatchHistory', 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 retrieve transaction history', 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
+ console.log('Running batchHistory...');
36
+
37
+ setTimeout(async function () {
38
+ try {
39
+ // setup request object
40
+ const setupRequest = new BlockChyp.AuthorizationRequest();
41
+ setupRequest.pan = '4111111111111111';
42
+ setupRequest.expMonth = '12';
43
+ setupRequest.expYear = '2025';
44
+ setupRequest.amount = '25.55';
45
+ setupRequest.test = true;
46
+ setupRequest.transactionRef = uuidv4();
47
+ let setupResponse: BlockChyp.AuthorizationResponse = new BlockChyp.AuthorizationResponse();
48
+ const setupHttpResponse = await client.charge(setupRequest);
49
+ if (setupHttpResponse.status !== 200) {
50
+ console.log('Error:', setupHttpResponse.statusText);
51
+ fail(setupHttpResponse.statusText);
52
+ done();
53
+ }
54
+ setupResponse = setupHttpResponse.data
55
+
56
+ // setup request object
57
+ const request = new BlockChyp.BatchHistoryRequest();
58
+ request.maxResults = 10;
59
+
60
+ const httpResponse = await client.batchHistory(request)
61
+ const response: BlockChyp.BatchHistoryResponse = httpResponse.data;
62
+ // response assertions
63
+ expect(response.success).toBe(true);
64
+
65
+ } catch (error) {
66
+ console.log('Error:', error);
67
+ fail(error);
68
+ } finally {
69
+ done();
70
+ }
71
+ }, testDelayInt * 1000);
72
+ });
73
+ });
@@ -0,0 +1,104 @@
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('BooleanPrompt', 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 prompt the consumer for boolean input', 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 BooleanPrompt 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 booleanPrompt...');
78
+ setTimeout(function () {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ try {
81
+ // setup request object
82
+ const request = new BlockChyp.BooleanPromptRequest();
83
+ request.test = true;
84
+ request.terminalName = config_1.Config.getTerminalName();
85
+ request.prompt = 'Would you like to become a member?';
86
+ request.yesCaption = 'Yes';
87
+ request.noCaption = 'No';
88
+ const httpResponse = yield client.booleanPrompt(request);
89
+ const response = httpResponse.data;
90
+ // response assertions
91
+ expect(response.success).toBe(true);
92
+ expect(response.response).toBe(true);
93
+ }
94
+ catch (error) {
95
+ console.log('Error:', error);
96
+ fail(error);
97
+ }
98
+ finally {
99
+ done();
100
+ }
101
+ });
102
+ }, testDelayInt * 1000);
103
+ });
104
+ });
@@ -0,0 +1,76 @@
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('BooleanPrompt', 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 prompt the consumer for boolean input', 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 BooleanPrompt 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 booleanPrompt...');
51
+
52
+ setTimeout(async function () {
53
+ try {
54
+ // setup request object
55
+ const request = new BlockChyp.BooleanPromptRequest();
56
+ request.test = true;
57
+ request.terminalName = Config.getTerminalName();
58
+ request.prompt = 'Would you like to become a member?';
59
+ request.yesCaption = 'Yes';
60
+ request.noCaption = 'No';
61
+
62
+ const httpResponse = await client.booleanPrompt(request)
63
+ const response: BlockChyp.BooleanPromptResponse = httpResponse.data;
64
+ // response assertions
65
+ expect(response.success).toBe(true);
66
+ expect(response.response).toBe(true);
67
+
68
+ } catch (error) {
69
+ console.log('Error:', error);
70
+ fail(error);
71
+ } finally {
72
+ done();
73
+ }
74
+ }, testDelayInt * 1000);
75
+ });
76
+ });