@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.
- package/.eslintrc.json +20 -0
- package/LICENSE +21 -0
- package/README.md +4314 -0
- package/index.js +24 -0
- package/index.ts +3 -0
- package/itest/ActivateTerminalITestSpec.js +87 -0
- package/itest/ActivateTerminalITestSpec.ts +58 -0
- package/itest/AddTestMerchantITestSpec.js +89 -0
- package/itest/AddTestMerchantITestSpec.ts +60 -0
- package/itest/BatchHistoryITestSpec.js +101 -0
- package/itest/BatchHistoryITestSpec.ts +73 -0
- package/itest/BooleanPromptITestSpec.js +104 -0
- package/itest/BooleanPromptITestSpec.ts +76 -0
- package/itest/CancelPaymentLinkITestSpec.js +116 -0
- package/itest/CancelPaymentLinkITestSpec.ts +93 -0
- package/itest/CaptureSignatureITestSpec.js +101 -0
- package/itest/CaptureSignatureITestSpec.ts +73 -0
- package/itest/DeactivateTerminalITestSpec.js +82 -0
- package/itest/DeactivateTerminalITestSpec.ts +52 -0
- package/itest/DeleteBrandingAssetITestSpec.js +96 -0
- package/itest/DeleteBrandingAssetITestSpec.ts +69 -0
- package/itest/DeleteCustomerITestSpec.js +102 -0
- package/itest/DeleteCustomerITestSpec.ts +75 -0
- package/itest/DeleteMediaAssetITestSpec.js +100 -0
- package/itest/DeleteMediaAssetITestSpec.ts +71 -0
- package/itest/DeleteQueuedTransactionITestSpec.js +117 -0
- package/itest/DeleteQueuedTransactionITestSpec.ts +89 -0
- package/itest/DeleteSlideShowITestSpec.js +96 -0
- package/itest/DeleteSlideShowITestSpec.ts +69 -0
- package/itest/DeleteSurveyQuestionITestSpec.js +97 -0
- package/itest/DeleteSurveyQuestionITestSpec.ts +70 -0
- package/itest/DeleteTestMerchantITestSpec.js +96 -0
- package/itest/DeleteTestMerchantITestSpec.ts +69 -0
- package/itest/DeleteTokenITestSpec.js +102 -0
- package/itest/DeleteTokenITestSpec.ts +75 -0
- package/itest/EmptyBrandingAssetITestSpec.js +85 -0
- package/itest/EmptyBrandingAssetITestSpec.ts +57 -0
- package/itest/EmptySlideShowITestSpec.js +87 -0
- package/itest/EmptySlideShowITestSpec.ts +58 -0
- package/itest/GatewayTimeoutITestSpec.js +103 -0
- package/itest/GatewayTimeoutITestSpec.ts +73 -0
- package/itest/GetCustomerITestSpec.js +102 -0
- package/itest/GetCustomerITestSpec.ts +75 -0
- package/itest/GetMerchantsITestSpec.js +84 -0
- package/itest/GetMerchantsITestSpec.ts +56 -0
- package/itest/InviteMerchantUserITestSpec.js +86 -0
- package/itest/InviteMerchantUserITestSpec.ts +58 -0
- package/itest/LinkTokenITestSpec.js +103 -0
- package/itest/LinkTokenITestSpec.ts +76 -0
- package/itest/ListQueuedTransactionsITestSpec.js +116 -0
- package/itest/ListQueuedTransactionsITestSpec.ts +88 -0
- package/itest/ListTerminalsITestSpec.js +83 -0
- package/itest/ListTerminalsITestSpec.ts +56 -0
- package/itest/MediaAssetITestSpec.js +105 -0
- package/itest/MediaAssetITestSpec.ts +75 -0
- package/itest/MediaITestSpec.js +83 -0
- package/itest/MediaITestSpec.ts +56 -0
- package/itest/MediaUploadITestSpec.js +94 -0
- package/itest/MediaUploadITestSpec.ts +63 -0
- package/itest/MerchantCredentialGenerationITestSpec.js +85 -0
- package/itest/MerchantCredentialGenerationITestSpec.ts +57 -0
- package/itest/MerchantInvoiceDetailITestSpec.js +84 -0
- package/itest/MerchantInvoiceDetailITestSpec.ts +56 -0
- package/itest/MerchantInvoicesITestSpec.js +84 -0
- package/itest/MerchantInvoicesITestSpec.ts +56 -0
- package/itest/MerchantPlatformsITestSpec.js +96 -0
- package/itest/MerchantPlatformsITestSpec.ts +69 -0
- package/itest/MerchantProfileITestSpec.js +84 -0
- package/itest/MerchantProfileITestSpec.ts +56 -0
- package/itest/MerchantUsersITestSpec.js +83 -0
- package/itest/MerchantUsersITestSpec.ts +56 -0
- package/itest/NewTransactionDisplayITestSpec.js +115 -0
- package/itest/NewTransactionDisplayITestSpec.ts +92 -0
- package/itest/PANChargeITestSpec.js +118 -0
- package/itest/PANChargeITestSpec.ts +88 -0
- package/itest/PANEnrollITestSpec.js +118 -0
- package/itest/PANEnrollITestSpec.ts +90 -0
- package/itest/PANPreauthITestSpec.js +116 -0
- package/itest/PANPreauthITestSpec.ts +87 -0
- package/itest/PartialRefundITestSpec.js +119 -0
- package/itest/PartialRefundITestSpec.ts +91 -0
- package/itest/PartnerCommissionBreakdownITestSpec.js +84 -0
- package/itest/PartnerCommissionBreakdownITestSpec.ts +56 -0
- package/itest/PartnerStatementDetailITestSpec.js +84 -0
- package/itest/PartnerStatementDetailITestSpec.ts +56 -0
- package/itest/PartnerStatementsITestSpec.js +84 -0
- package/itest/PartnerStatementsITestSpec.ts +56 -0
- package/itest/PaymentLinkStatusITestSpec.js +116 -0
- package/itest/PaymentLinkStatusITestSpec.ts +93 -0
- package/itest/PricingPolicyITestSpec.js +85 -0
- package/itest/PricingPolicyITestSpec.ts +57 -0
- package/itest/ResendPaymentLinkITestSpec.js +116 -0
- package/itest/ResendPaymentLinkITestSpec.ts +93 -0
- package/itest/SearchCustomerITestSpec.js +101 -0
- package/itest/SearchCustomerITestSpec.ts +75 -0
- package/itest/SendPaymentLinkITestSpec.js +107 -0
- package/itest/SendPaymentLinkITestSpec.ts +82 -0
- package/itest/SimpleBatchCloseITestSpec.js +101 -0
- package/itest/SimpleBatchCloseITestSpec.ts +73 -0
- package/itest/SimpleCaptureITestSpec.js +101 -0
- package/itest/SimpleCaptureITestSpec.ts +74 -0
- package/itest/SimpleGiftActivateITestSpec.js +104 -0
- package/itest/SimpleGiftActivateITestSpec.ts +75 -0
- package/itest/SimpleLocateITestSpec.js +85 -0
- package/itest/SimpleLocateITestSpec.ts +57 -0
- package/itest/SimpleMessageITestSpec.js +101 -0
- package/itest/SimpleMessageITestSpec.ts +73 -0
- package/itest/SimplePingITestSpec.js +100 -0
- package/itest/SimplePingITestSpec.ts +72 -0
- package/itest/SimpleRefundITestSpec.js +118 -0
- package/itest/SimpleRefundITestSpec.ts +90 -0
- package/itest/SimpleReversalITestSpec.js +103 -0
- package/itest/SimpleReversalITestSpec.ts +75 -0
- package/itest/SimpleVoidITestSpec.js +103 -0
- package/itest/SimpleVoidITestSpec.ts +75 -0
- package/itest/SlideShowITestSpec.js +98 -0
- package/itest/SlideShowITestSpec.ts +70 -0
- package/itest/SlideShowsITestSpec.js +95 -0
- package/itest/SlideShowsITestSpec.ts +69 -0
- package/itest/SurveyQuestionITestSpec.js +95 -0
- package/itest/SurveyQuestionITestSpec.ts +68 -0
- package/itest/SurveyQuestionsITestSpec.js +96 -0
- package/itest/SurveyQuestionsITestSpec.ts +70 -0
- package/itest/SurveyResultsITestSpec.js +95 -0
- package/itest/SurveyResultsITestSpec.ts +68 -0
- package/itest/TCDeleteTemplateITestSpec.js +98 -0
- package/itest/TCDeleteTemplateITestSpec.ts +70 -0
- package/itest/TCEntryITestSpec.js +103 -0
- package/itest/TCEntryITestSpec.ts +76 -0
- package/itest/TCLogITestSpec.js +83 -0
- package/itest/TCLogITestSpec.ts +56 -0
- package/itest/TCTemplateITestSpec.js +101 -0
- package/itest/TCTemplateITestSpec.ts +72 -0
- package/itest/TCTemplateUpdateITestSpec.js +91 -0
- package/itest/TCTemplateUpdateITestSpec.ts +61 -0
- package/itest/TCTemplatesITestSpec.js +83 -0
- package/itest/TCTemplatesITestSpec.ts +56 -0
- package/itest/TerminalBrandingITestSpec.js +83 -0
- package/itest/TerminalBrandingITestSpec.ts +56 -0
- package/itest/TerminalChargeITestSpec.js +113 -0
- package/itest/TerminalChargeITestSpec.ts +84 -0
- package/itest/TerminalClearITestSpec.js +100 -0
- package/itest/TerminalClearITestSpec.ts +72 -0
- package/itest/TerminalEBTBalanceITestSpec.js +103 -0
- package/itest/TerminalEBTBalanceITestSpec.ts +74 -0
- package/itest/TerminalEBTChargeITestSpec.js +115 -0
- package/itest/TerminalEBTChargeITestSpec.ts +86 -0
- package/itest/TerminalEnrollITestSpec.js +112 -0
- package/itest/TerminalEnrollITestSpec.ts +83 -0
- package/itest/TerminalGiftCardBalanceITestSpec.js +102 -0
- package/itest/TerminalGiftCardBalanceITestSpec.ts +73 -0
- package/itest/TerminalKeyedChargeITestSpec.js +114 -0
- package/itest/TerminalKeyedChargeITestSpec.ts +85 -0
- package/itest/TerminalManualEBTChargeITestSpec.js +116 -0
- package/itest/TerminalManualEBTChargeITestSpec.ts +87 -0
- package/itest/TerminalPreauthITestSpec.js +113 -0
- package/itest/TerminalPreauthITestSpec.ts +84 -0
- package/itest/TerminalQueuedTransactionITestSpec.js +108 -0
- package/itest/TerminalQueuedTransactionITestSpec.ts +78 -0
- package/itest/TerminalStatusITestSpec.js +100 -0
- package/itest/TerminalStatusITestSpec.ts +72 -0
- package/itest/TerminalTimeoutITestSpec.js +99 -0
- package/itest/TerminalTimeoutITestSpec.ts +70 -0
- package/itest/TermsAndConditionsITestSpec.js +105 -0
- package/itest/TermsAndConditionsITestSpec.ts +77 -0
- package/itest/TextPromptITestSpec.js +103 -0
- package/itest/TextPromptITestSpec.ts +74 -0
- package/itest/TokenMetadataITestSpec.js +102 -0
- package/itest/TokenMetadataITestSpec.ts +75 -0
- package/itest/TransactionHistoryITestSpec.js +101 -0
- package/itest/TransactionHistoryITestSpec.ts +73 -0
- package/itest/UnlinkTokenITestSpec.js +103 -0
- package/itest/UnlinkTokenITestSpec.ts +76 -0
- package/itest/UpdateBrandingAssetITestSpec.js +109 -0
- package/itest/UpdateBrandingAssetITestSpec.ts +80 -0
- package/itest/UpdateCustomerITestSpec.js +90 -0
- package/itest/UpdateCustomerITestSpec.ts +63 -0
- package/itest/UpdateMerchantITestSpec.js +92 -0
- package/itest/UpdateMerchantITestSpec.ts +65 -0
- package/itest/UpdateMerchantPlatformsITestSpec.js +98 -0
- package/itest/UpdateMerchantPlatformsITestSpec.ts +71 -0
- package/itest/UpdateSlideShowITestSpec.js +106 -0
- package/itest/UpdateSlideShowITestSpec.ts +78 -0
- package/itest/UpdateSurveyQuestionITestSpec.js +89 -0
- package/itest/UpdateSurveyQuestionITestSpec.ts +60 -0
- package/itest/UpdateTransactionDisplayITestSpec.js +115 -0
- package/itest/UpdateTransactionDisplayITestSpec.ts +92 -0
- package/itest/UploadStatusITestSpec.js +100 -0
- package/itest/UploadStatusITestSpec.ts +71 -0
- package/itest/support/aviato.png +0 -0
- package/itest/support/config.js +67 -0
- package/itest/support/config.ts +106 -0
- package/itest/support/jasmine.json +11 -0
- package/package.json +73 -0
- package/spec/CryptoSpec.js +35 -0
- package/spec/CryptoSpec.ts +35 -0
- package/spec/SanitySpec.js +26 -0
- package/spec/SanitySpec.ts +23 -0
- package/spec/support/jasmine.json +11 -0
- package/src/client.js +941 -0
- package/src/client.ts +1012 -0
- package/src/cryptoutils.js +89 -0
- package/src/cryptoutils.ts +80 -0
- package/src/global.js +9 -0
- package/src/global.ts +5 -0
- package/src/models.js +9382 -0
- package/src/models.ts +16509 -0
|
@@ -0,0 +1,75 @@
|
|
|
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('SimpleVoid', 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 void a tranaction in the current batch', 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 simpleVoid...');
|
|
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.VoidRequest();
|
|
58
|
+
request.transactionId = setupResponse.transactionId;
|
|
59
|
+
request.test = true;
|
|
60
|
+
|
|
61
|
+
const httpResponse = await client.void(request)
|
|
62
|
+
const response: BlockChyp.VoidResponse = httpResponse.data;
|
|
63
|
+
// response assertions
|
|
64
|
+
expect(response.success).toBe(true);
|
|
65
|
+
expect(response.approved).toBe(true);
|
|
66
|
+
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.log('Error:', error);
|
|
69
|
+
fail(error);
|
|
70
|
+
} finally {
|
|
71
|
+
done();
|
|
72
|
+
}
|
|
73
|
+
}, testDelayInt * 1000);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
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('SlideShow', 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('returns a single slide show.', 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 slideShow...');
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
var _a;
|
|
66
|
+
try {
|
|
67
|
+
// setup request object
|
|
68
|
+
const setupRequest = new BlockChyp.SlideShow();
|
|
69
|
+
setupRequest.name = 'Test Slide Show';
|
|
70
|
+
setupRequest.delay = 5;
|
|
71
|
+
let setupResponse = new BlockChyp.SlideShow();
|
|
72
|
+
const setupHttpResponse = yield client.updateSlideShow(setupRequest);
|
|
73
|
+
if (setupHttpResponse.status !== 200) {
|
|
74
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
75
|
+
fail(setupHttpResponse.statusText);
|
|
76
|
+
done();
|
|
77
|
+
}
|
|
78
|
+
setupResponse = setupHttpResponse.data;
|
|
79
|
+
// setup request object
|
|
80
|
+
const request = new BlockChyp.SlideShowRequest();
|
|
81
|
+
request.slideShowId = setupResponse.id;
|
|
82
|
+
const httpResponse = yield client.slideShow(request);
|
|
83
|
+
const response = httpResponse.data;
|
|
84
|
+
// response assertions
|
|
85
|
+
expect(response.success).toBe(true);
|
|
86
|
+
(_a = expect(response.name)) === null || _a === void 0 ? void 0 : _a.toEqual('Test Slide Show');
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.log('Error:', error);
|
|
90
|
+
fail(error);
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
done();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}, testDelayInt * 1000);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
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('SlideShow', 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('returns a single slide show.', 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 slideShow...');
|
|
36
|
+
|
|
37
|
+
setTimeout(async function () {
|
|
38
|
+
try {
|
|
39
|
+
// setup request object
|
|
40
|
+
const setupRequest = new BlockChyp.SlideShow();
|
|
41
|
+
setupRequest.name = 'Test Slide Show';
|
|
42
|
+
setupRequest.delay = 5;
|
|
43
|
+
let setupResponse: BlockChyp.SlideShow = new BlockChyp.SlideShow();
|
|
44
|
+
const setupHttpResponse = await client.updateSlideShow(setupRequest);
|
|
45
|
+
if (setupHttpResponse.status !== 200) {
|
|
46
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
47
|
+
fail(setupHttpResponse.statusText);
|
|
48
|
+
done();
|
|
49
|
+
}
|
|
50
|
+
setupResponse = setupHttpResponse.data
|
|
51
|
+
|
|
52
|
+
// setup request object
|
|
53
|
+
const request = new BlockChyp.SlideShowRequest();
|
|
54
|
+
request.slideShowId = setupResponse.id;
|
|
55
|
+
|
|
56
|
+
const httpResponse = await client.slideShow(request)
|
|
57
|
+
const response: BlockChyp.SlideShow = httpResponse.data;
|
|
58
|
+
// response assertions
|
|
59
|
+
expect(response.success).toBe(true);
|
|
60
|
+
expect(response.name)?.toEqual('Test Slide Show');
|
|
61
|
+
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.log('Error:', error);
|
|
64
|
+
fail(error);
|
|
65
|
+
} finally {
|
|
66
|
+
done();
|
|
67
|
+
}
|
|
68
|
+
}, testDelayInt * 1000);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
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('SlideShows', 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('returns a collection of slide shows.', 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 slideShows...');
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
// setup request object
|
|
67
|
+
const setupRequest = new BlockChyp.SlideShow();
|
|
68
|
+
setupRequest.name = 'Test Slide Show';
|
|
69
|
+
setupRequest.delay = 5;
|
|
70
|
+
let setupResponse = new BlockChyp.SlideShow();
|
|
71
|
+
const setupHttpResponse = yield client.updateSlideShow(setupRequest);
|
|
72
|
+
if (setupHttpResponse.status !== 200) {
|
|
73
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
74
|
+
fail(setupHttpResponse.statusText);
|
|
75
|
+
done();
|
|
76
|
+
}
|
|
77
|
+
setupResponse = setupHttpResponse.data;
|
|
78
|
+
// setup request object
|
|
79
|
+
const request = new BlockChyp.SlideShowRequest();
|
|
80
|
+
const httpResponse = yield client.slideShows(request);
|
|
81
|
+
const response = httpResponse.data;
|
|
82
|
+
// response assertions
|
|
83
|
+
expect(response.success).toBe(true);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.log('Error:', error);
|
|
87
|
+
fail(error);
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
done();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, testDelayInt * 1000);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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('SlideShows', 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('returns a collection of slide shows.', 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 slideShows...');
|
|
36
|
+
|
|
37
|
+
setTimeout(async function () {
|
|
38
|
+
try {
|
|
39
|
+
// setup request object
|
|
40
|
+
const setupRequest = new BlockChyp.SlideShow();
|
|
41
|
+
setupRequest.name = 'Test Slide Show';
|
|
42
|
+
setupRequest.delay = 5;
|
|
43
|
+
let setupResponse: BlockChyp.SlideShow = new BlockChyp.SlideShow();
|
|
44
|
+
const setupHttpResponse = await client.updateSlideShow(setupRequest);
|
|
45
|
+
if (setupHttpResponse.status !== 200) {
|
|
46
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
47
|
+
fail(setupHttpResponse.statusText);
|
|
48
|
+
done();
|
|
49
|
+
}
|
|
50
|
+
setupResponse = setupHttpResponse.data
|
|
51
|
+
|
|
52
|
+
// setup request object
|
|
53
|
+
const request = new BlockChyp.SlideShowRequest();
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
const httpResponse = await client.slideShows(request)
|
|
57
|
+
const response: BlockChyp.SlideShowResponse = httpResponse.data;
|
|
58
|
+
// response assertions
|
|
59
|
+
expect(response.success).toBe(true);
|
|
60
|
+
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.log('Error:', error);
|
|
63
|
+
fail(error);
|
|
64
|
+
} finally {
|
|
65
|
+
done();
|
|
66
|
+
}
|
|
67
|
+
}, testDelayInt * 1000);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
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('SurveyQuestion', 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('returns a single survey question.', 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 surveyQuestion...');
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
var _a;
|
|
66
|
+
try {
|
|
67
|
+
// setup request object
|
|
68
|
+
const setupRequest = new BlockChyp.SurveyQuestionRequest();
|
|
69
|
+
let setupResponse = new BlockChyp.SurveyQuestionResponse();
|
|
70
|
+
const setupHttpResponse = yield client.surveyQuestions(setupRequest);
|
|
71
|
+
if (setupHttpResponse.status !== 200) {
|
|
72
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
73
|
+
fail(setupHttpResponse.statusText);
|
|
74
|
+
done();
|
|
75
|
+
}
|
|
76
|
+
setupResponse = setupHttpResponse.data;
|
|
77
|
+
// setup request object
|
|
78
|
+
const request = new BlockChyp.SurveyQuestionRequest();
|
|
79
|
+
request.questionId = (setupResponse === null || setupResponse === void 0 ? void 0 : setupResponse.results) && ((_a = setupResponse.results[0]) === null || _a === void 0 ? void 0 : _a.id);
|
|
80
|
+
const httpResponse = yield client.surveyQuestion(request);
|
|
81
|
+
const response = httpResponse.data;
|
|
82
|
+
// response assertions
|
|
83
|
+
expect(response.success).toBe(true);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.log('Error:', error);
|
|
87
|
+
fail(error);
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
done();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, testDelayInt * 1000);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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('SurveyQuestion', 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('returns a single survey question.', 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 surveyQuestion...');
|
|
36
|
+
|
|
37
|
+
setTimeout(async function () {
|
|
38
|
+
try {
|
|
39
|
+
// setup request object
|
|
40
|
+
const setupRequest = new BlockChyp.SurveyQuestionRequest();
|
|
41
|
+
|
|
42
|
+
let setupResponse: BlockChyp.SurveyQuestionResponse = new BlockChyp.SurveyQuestionResponse();
|
|
43
|
+
const setupHttpResponse = await client.surveyQuestions(setupRequest);
|
|
44
|
+
if (setupHttpResponse.status !== 200) {
|
|
45
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
46
|
+
fail(setupHttpResponse.statusText);
|
|
47
|
+
done();
|
|
48
|
+
}
|
|
49
|
+
setupResponse = setupHttpResponse.data
|
|
50
|
+
|
|
51
|
+
// setup request object
|
|
52
|
+
const request = new BlockChyp.SurveyQuestionRequest();
|
|
53
|
+
request.questionId = setupResponse?.results && setupResponse.results[0]?.id;
|
|
54
|
+
|
|
55
|
+
const httpResponse = await client.surveyQuestion(request)
|
|
56
|
+
const response: BlockChyp.SurveyQuestion = httpResponse.data;
|
|
57
|
+
// response assertions
|
|
58
|
+
expect(response.success).toBe(true);
|
|
59
|
+
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.log('Error:', error);
|
|
62
|
+
fail(error);
|
|
63
|
+
} finally {
|
|
64
|
+
done();
|
|
65
|
+
}
|
|
66
|
+
}, testDelayInt * 1000);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
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('SurveyQuestions', 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('returns survey questions for a given merchant.', 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 surveyQuestions...');
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
// setup request object
|
|
67
|
+
const setupRequest = new BlockChyp.SurveyQuestion();
|
|
68
|
+
setupRequest.ordinal = 1;
|
|
69
|
+
setupRequest.questionText = 'Would you shop here again?';
|
|
70
|
+
setupRequest.questionType = 'yes_no';
|
|
71
|
+
let setupResponse = new BlockChyp.SurveyQuestion();
|
|
72
|
+
const setupHttpResponse = yield client.updateSurveyQuestion(setupRequest);
|
|
73
|
+
if (setupHttpResponse.status !== 200) {
|
|
74
|
+
console.log('Error:', setupHttpResponse.statusText);
|
|
75
|
+
fail(setupHttpResponse.statusText);
|
|
76
|
+
done();
|
|
77
|
+
}
|
|
78
|
+
setupResponse = setupHttpResponse.data;
|
|
79
|
+
// setup request object
|
|
80
|
+
const request = new BlockChyp.SurveyQuestionRequest();
|
|
81
|
+
const httpResponse = yield client.surveyQuestions(request);
|
|
82
|
+
const response = httpResponse.data;
|
|
83
|
+
// response assertions
|
|
84
|
+
expect(response.success).toBe(true);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.log('Error:', error);
|
|
88
|
+
fail(error);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
done();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}, testDelayInt * 1000);
|
|
95
|
+
});
|
|
96
|
+
});
|