@blockchyp/blockchyp-ts 1.0.0 → 2.18.5
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/README.md +4 -9
- package/_bundles/blockchyp.js +71402 -0
- package/_bundles/blockchyp.js.map +1 -0
- package/_bundles/blockchyp.min.js +3 -0
- package/_bundles/blockchyp.min.js.LICENSE.txt +16 -0
- package/_bundles/blockchyp.min.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/{index.js → lib/index.js} +1 -0
- package/lib/index.js.map +1 -0
- package/lib/spec/CryptoSpec.d.ts +1 -0
- package/{spec → lib/spec}/CryptoSpec.js +1 -0
- package/lib/spec/CryptoSpec.js.map +1 -0
- package/lib/spec/SanitySpec.d.ts +1 -0
- package/{spec → lib/spec}/SanitySpec.js +2 -1
- package/lib/spec/SanitySpec.js.map +1 -0
- package/lib/src/client.d.ts +463 -0
- package/{src → lib/src}/client.js +2 -1
- package/lib/src/client.js.map +1 -0
- package/lib/src/cryptoutils.d.ts +16 -0
- package/{src → lib/src}/cryptoutils.js +18 -13
- package/lib/src/cryptoutils.js.map +1 -0
- package/lib/src/global.d.ts +1 -0
- package/lib/src/global.js +30 -0
- package/lib/src/global.js.map +1 -0
- package/lib/src/models.d.ts +9587 -0
- package/{src → lib/src}/models.js +1 -0
- package/lib/src/models.js.map +1 -0
- package/package.json +23 -9
- package/spec/SanitySpec.ts +1 -1
- package/src/client.ts +1 -2
- package/src/cryptoutils.ts +7 -6
- package/src/global.ts +1 -1
- package/itest/ActivateTerminalITestSpec.js +0 -87
- package/itest/ActivateTerminalITestSpec.ts +0 -58
- package/itest/AddTestMerchantITestSpec.js +0 -89
- package/itest/AddTestMerchantITestSpec.ts +0 -60
- package/itest/BatchHistoryITestSpec.js +0 -101
- package/itest/BatchHistoryITestSpec.ts +0 -73
- package/itest/BooleanPromptITestSpec.js +0 -104
- package/itest/BooleanPromptITestSpec.ts +0 -76
- package/itest/CancelPaymentLinkITestSpec.js +0 -116
- package/itest/CancelPaymentLinkITestSpec.ts +0 -93
- package/itest/CaptureSignatureITestSpec.js +0 -101
- package/itest/CaptureSignatureITestSpec.ts +0 -73
- package/itest/DeactivateTerminalITestSpec.js +0 -82
- package/itest/DeactivateTerminalITestSpec.ts +0 -52
- package/itest/DeleteBrandingAssetITestSpec.js +0 -96
- package/itest/DeleteBrandingAssetITestSpec.ts +0 -69
- package/itest/DeleteCustomerITestSpec.js +0 -102
- package/itest/DeleteCustomerITestSpec.ts +0 -75
- package/itest/DeleteMediaAssetITestSpec.js +0 -100
- package/itest/DeleteMediaAssetITestSpec.ts +0 -71
- package/itest/DeleteQueuedTransactionITestSpec.js +0 -117
- package/itest/DeleteQueuedTransactionITestSpec.ts +0 -89
- package/itest/DeleteSlideShowITestSpec.js +0 -96
- package/itest/DeleteSlideShowITestSpec.ts +0 -69
- package/itest/DeleteSurveyQuestionITestSpec.js +0 -97
- package/itest/DeleteSurveyQuestionITestSpec.ts +0 -70
- package/itest/DeleteTestMerchantITestSpec.js +0 -96
- package/itest/DeleteTestMerchantITestSpec.ts +0 -69
- package/itest/DeleteTokenITestSpec.js +0 -102
- package/itest/DeleteTokenITestSpec.ts +0 -75
- package/itest/EmptyBrandingAssetITestSpec.js +0 -85
- package/itest/EmptyBrandingAssetITestSpec.ts +0 -57
- package/itest/EmptySlideShowITestSpec.js +0 -87
- package/itest/EmptySlideShowITestSpec.ts +0 -58
- package/itest/GatewayTimeoutITestSpec.js +0 -103
- package/itest/GatewayTimeoutITestSpec.ts +0 -73
- package/itest/GetCustomerITestSpec.js +0 -102
- package/itest/GetCustomerITestSpec.ts +0 -75
- package/itest/GetMerchantsITestSpec.js +0 -84
- package/itest/GetMerchantsITestSpec.ts +0 -56
- package/itest/InviteMerchantUserITestSpec.js +0 -86
- package/itest/InviteMerchantUserITestSpec.ts +0 -58
- package/itest/LinkTokenITestSpec.js +0 -103
- package/itest/LinkTokenITestSpec.ts +0 -76
- package/itest/ListQueuedTransactionsITestSpec.js +0 -116
- package/itest/ListQueuedTransactionsITestSpec.ts +0 -88
- package/itest/ListTerminalsITestSpec.js +0 -83
- package/itest/ListTerminalsITestSpec.ts +0 -56
- package/itest/MediaAssetITestSpec.js +0 -105
- package/itest/MediaAssetITestSpec.ts +0 -75
- package/itest/MediaITestSpec.js +0 -83
- package/itest/MediaITestSpec.ts +0 -56
- package/itest/MediaUploadITestSpec.js +0 -94
- package/itest/MediaUploadITestSpec.ts +0 -63
- package/itest/MerchantCredentialGenerationITestSpec.js +0 -85
- package/itest/MerchantCredentialGenerationITestSpec.ts +0 -57
- package/itest/MerchantInvoiceDetailITestSpec.js +0 -84
- package/itest/MerchantInvoiceDetailITestSpec.ts +0 -56
- package/itest/MerchantInvoicesITestSpec.js +0 -84
- package/itest/MerchantInvoicesITestSpec.ts +0 -56
- package/itest/MerchantPlatformsITestSpec.js +0 -96
- package/itest/MerchantPlatformsITestSpec.ts +0 -69
- package/itest/MerchantProfileITestSpec.js +0 -84
- package/itest/MerchantProfileITestSpec.ts +0 -56
- package/itest/MerchantUsersITestSpec.js +0 -83
- package/itest/MerchantUsersITestSpec.ts +0 -56
- package/itest/NewTransactionDisplayITestSpec.js +0 -115
- package/itest/NewTransactionDisplayITestSpec.ts +0 -92
- package/itest/PANChargeITestSpec.js +0 -118
- package/itest/PANChargeITestSpec.ts +0 -88
- package/itest/PANEnrollITestSpec.js +0 -118
- package/itest/PANEnrollITestSpec.ts +0 -90
- package/itest/PANPreauthITestSpec.js +0 -116
- package/itest/PANPreauthITestSpec.ts +0 -87
- package/itest/PartialRefundITestSpec.js +0 -119
- package/itest/PartialRefundITestSpec.ts +0 -91
- package/itest/PartnerCommissionBreakdownITestSpec.js +0 -84
- package/itest/PartnerCommissionBreakdownITestSpec.ts +0 -56
- package/itest/PartnerStatementDetailITestSpec.js +0 -84
- package/itest/PartnerStatementDetailITestSpec.ts +0 -56
- package/itest/PartnerStatementsITestSpec.js +0 -84
- package/itest/PartnerStatementsITestSpec.ts +0 -56
- package/itest/PaymentLinkStatusITestSpec.js +0 -116
- package/itest/PaymentLinkStatusITestSpec.ts +0 -93
- package/itest/PricingPolicyITestSpec.js +0 -85
- package/itest/PricingPolicyITestSpec.ts +0 -57
- package/itest/ResendPaymentLinkITestSpec.js +0 -116
- package/itest/ResendPaymentLinkITestSpec.ts +0 -93
- package/itest/SearchCustomerITestSpec.js +0 -101
- package/itest/SearchCustomerITestSpec.ts +0 -75
- package/itest/SendPaymentLinkITestSpec.js +0 -107
- package/itest/SendPaymentLinkITestSpec.ts +0 -82
- package/itest/SimpleBatchCloseITestSpec.js +0 -101
- package/itest/SimpleBatchCloseITestSpec.ts +0 -73
- package/itest/SimpleCaptureITestSpec.js +0 -101
- package/itest/SimpleCaptureITestSpec.ts +0 -74
- package/itest/SimpleGiftActivateITestSpec.js +0 -104
- package/itest/SimpleGiftActivateITestSpec.ts +0 -75
- package/itest/SimpleLocateITestSpec.js +0 -85
- package/itest/SimpleLocateITestSpec.ts +0 -57
- package/itest/SimpleMessageITestSpec.js +0 -101
- package/itest/SimpleMessageITestSpec.ts +0 -73
- package/itest/SimplePingITestSpec.js +0 -100
- package/itest/SimplePingITestSpec.ts +0 -72
- package/itest/SimpleRefundITestSpec.js +0 -118
- package/itest/SimpleRefundITestSpec.ts +0 -90
- package/itest/SimpleReversalITestSpec.js +0 -103
- package/itest/SimpleReversalITestSpec.ts +0 -75
- package/itest/SimpleVoidITestSpec.js +0 -103
- package/itest/SimpleVoidITestSpec.ts +0 -75
- package/itest/SlideShowITestSpec.js +0 -98
- package/itest/SlideShowITestSpec.ts +0 -70
- package/itest/SlideShowsITestSpec.js +0 -95
- package/itest/SlideShowsITestSpec.ts +0 -69
- package/itest/SurveyQuestionITestSpec.js +0 -95
- package/itest/SurveyQuestionITestSpec.ts +0 -68
- package/itest/SurveyQuestionsITestSpec.js +0 -96
- package/itest/SurveyQuestionsITestSpec.ts +0 -70
- package/itest/SurveyResultsITestSpec.js +0 -95
- package/itest/SurveyResultsITestSpec.ts +0 -68
- package/itest/TCDeleteTemplateITestSpec.js +0 -98
- package/itest/TCDeleteTemplateITestSpec.ts +0 -70
- package/itest/TCEntryITestSpec.js +0 -103
- package/itest/TCEntryITestSpec.ts +0 -76
- package/itest/TCLogITestSpec.js +0 -83
- package/itest/TCLogITestSpec.ts +0 -56
- package/itest/TCTemplateITestSpec.js +0 -101
- package/itest/TCTemplateITestSpec.ts +0 -72
- package/itest/TCTemplateUpdateITestSpec.js +0 -91
- package/itest/TCTemplateUpdateITestSpec.ts +0 -61
- package/itest/TCTemplatesITestSpec.js +0 -83
- package/itest/TCTemplatesITestSpec.ts +0 -56
- package/itest/TerminalBrandingITestSpec.js +0 -83
- package/itest/TerminalBrandingITestSpec.ts +0 -56
- package/itest/TerminalChargeITestSpec.js +0 -113
- package/itest/TerminalChargeITestSpec.ts +0 -84
- package/itest/TerminalClearITestSpec.js +0 -100
- package/itest/TerminalClearITestSpec.ts +0 -72
- package/itest/TerminalEBTBalanceITestSpec.js +0 -103
- package/itest/TerminalEBTBalanceITestSpec.ts +0 -74
- package/itest/TerminalEBTChargeITestSpec.js +0 -115
- package/itest/TerminalEBTChargeITestSpec.ts +0 -86
- package/itest/TerminalEnrollITestSpec.js +0 -112
- package/itest/TerminalEnrollITestSpec.ts +0 -83
- package/itest/TerminalGiftCardBalanceITestSpec.js +0 -102
- package/itest/TerminalGiftCardBalanceITestSpec.ts +0 -73
- package/itest/TerminalKeyedChargeITestSpec.js +0 -114
- package/itest/TerminalKeyedChargeITestSpec.ts +0 -85
- package/itest/TerminalManualEBTChargeITestSpec.js +0 -116
- package/itest/TerminalManualEBTChargeITestSpec.ts +0 -87
- package/itest/TerminalPreauthITestSpec.js +0 -113
- package/itest/TerminalPreauthITestSpec.ts +0 -84
- package/itest/TerminalQueuedTransactionITestSpec.js +0 -108
- package/itest/TerminalQueuedTransactionITestSpec.ts +0 -78
- package/itest/TerminalStatusITestSpec.js +0 -100
- package/itest/TerminalStatusITestSpec.ts +0 -72
- package/itest/TerminalTimeoutITestSpec.js +0 -99
- package/itest/TerminalTimeoutITestSpec.ts +0 -70
- package/itest/TermsAndConditionsITestSpec.js +0 -105
- package/itest/TermsAndConditionsITestSpec.ts +0 -77
- package/itest/TextPromptITestSpec.js +0 -103
- package/itest/TextPromptITestSpec.ts +0 -74
- package/itest/TokenMetadataITestSpec.js +0 -102
- package/itest/TokenMetadataITestSpec.ts +0 -75
- package/itest/TransactionHistoryITestSpec.js +0 -101
- package/itest/TransactionHistoryITestSpec.ts +0 -73
- package/itest/UnlinkTokenITestSpec.js +0 -103
- package/itest/UnlinkTokenITestSpec.ts +0 -76
- package/itest/UpdateBrandingAssetITestSpec.js +0 -109
- package/itest/UpdateBrandingAssetITestSpec.ts +0 -80
- package/itest/UpdateCustomerITestSpec.js +0 -90
- package/itest/UpdateCustomerITestSpec.ts +0 -63
- package/itest/UpdateMerchantITestSpec.js +0 -92
- package/itest/UpdateMerchantITestSpec.ts +0 -65
- package/itest/UpdateMerchantPlatformsITestSpec.js +0 -98
- package/itest/UpdateMerchantPlatformsITestSpec.ts +0 -71
- package/itest/UpdateSlideShowITestSpec.js +0 -106
- package/itest/UpdateSlideShowITestSpec.ts +0 -78
- package/itest/UpdateSurveyQuestionITestSpec.js +0 -89
- package/itest/UpdateSurveyQuestionITestSpec.ts +0 -60
- package/itest/UpdateTransactionDisplayITestSpec.js +0 -115
- package/itest/UpdateTransactionDisplayITestSpec.ts +0 -92
- package/itest/UploadStatusITestSpec.js +0 -100
- package/itest/UploadStatusITestSpec.ts +0 -71
- package/itest/support/aviato.png +0 -0
- package/itest/support/config.js +0 -67
- package/itest/support/config.ts +0 -106
- package/itest/support/jasmine.json +0 -11
- package/spec/support/jasmine.json +0 -11
- package/src/global.js +0 -9
|
@@ -1,56 +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('ListTerminals', 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('lists all terminals associated with an account.', 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 listTerminals...');
|
|
36
|
-
|
|
37
|
-
setTimeout(async function () {
|
|
38
|
-
try {
|
|
39
|
-
// setup request object
|
|
40
|
-
const request = new BlockChyp.TerminalProfileRequest();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const httpResponse = await client.terminals(request)
|
|
44
|
-
const response: BlockChyp.TerminalProfileResponse = httpResponse.data;
|
|
45
|
-
// response assertions
|
|
46
|
-
expect(response.success).toBe(true);
|
|
47
|
-
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.log('Error:', error);
|
|
50
|
-
fail(error);
|
|
51
|
-
} finally {
|
|
52
|
-
done();
|
|
53
|
-
}
|
|
54
|
-
}, testDelayInt * 1000);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
/**
|
|
36
|
-
* Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
|
|
37
|
-
* by a license that can be found in the LICENSE file.
|
|
38
|
-
*
|
|
39
|
-
* This file was generated automatically by the BlockChyp SDK Generator. Changes to this
|
|
40
|
-
* file will be lost every time the code is regenerated.
|
|
41
|
-
*/
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const uuid_1 = require("uuid");
|
|
44
|
-
const config_1 = require("./support/config");
|
|
45
|
-
const BlockChyp = __importStar(require("../index"));
|
|
46
|
-
describe('MediaAsset', function () {
|
|
47
|
-
let originalTimeout;
|
|
48
|
-
let client;
|
|
49
|
-
config_1.Config.load();
|
|
50
|
-
beforeEach(function () {
|
|
51
|
-
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
52
|
-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
|
|
53
|
-
});
|
|
54
|
-
it('returns a single media asset.', function (done) {
|
|
55
|
-
client = BlockChyp.newClient(config_1.Config.getCreds(""));
|
|
56
|
-
client.setGatewayHost(config_1.Config.getGatewayHost());
|
|
57
|
-
client.setTestGatewayHost(config_1.Config.getTestGatewayHost());
|
|
58
|
-
client.setDashboardHost(config_1.Config.getDashboardHost());
|
|
59
|
-
const testDelay = process.env.BC_TEST_DELAY;
|
|
60
|
-
let testDelayInt = 0;
|
|
61
|
-
if (testDelay) {
|
|
62
|
-
testDelayInt = parseInt(testDelay);
|
|
63
|
-
}
|
|
64
|
-
console.log('Running mediaAsset...');
|
|
65
|
-
setTimeout(function () {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
68
|
-
try {
|
|
69
|
-
// setup request object
|
|
70
|
-
const setupRequest = new BlockChyp.UploadMetadata();
|
|
71
|
-
setupRequest.fileName = 'aviato.png';
|
|
72
|
-
setupRequest.fileSize = 18843;
|
|
73
|
-
setupRequest.uploadId = (0, uuid_1.v4)();
|
|
74
|
-
let setupResponse = new BlockChyp.MediaMetadata();
|
|
75
|
-
const content = fs.readFileSync('support/aviato.png');
|
|
76
|
-
const setupHttpResponse = yield client.uploadMedia(setupRequest, content);
|
|
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.MediaRequest();
|
|
85
|
-
request.mediaId = setupResponse.id;
|
|
86
|
-
const httpResponse = yield client.mediaAsset(request);
|
|
87
|
-
const response = httpResponse.data;
|
|
88
|
-
// response assertions
|
|
89
|
-
expect(response.success).toBe(true);
|
|
90
|
-
expect((_a = response.id) === null || _a === void 0 ? void 0 : _a.trim().length).toBeGreaterThan(0);
|
|
91
|
-
(_b = expect(response.originalFile)) === null || _b === void 0 ? void 0 : _b.toEqual('aviato.png');
|
|
92
|
-
expect((_c = response.fileUrl) === null || _c === void 0 ? void 0 : _c.trim().length).toBeGreaterThan(0);
|
|
93
|
-
expect((_d = response.thumbnailUrl) === null || _d === void 0 ? void 0 : _d.trim().length).toBeGreaterThan(0);
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
console.log('Error:', error);
|
|
97
|
-
fail(error);
|
|
98
|
-
}
|
|
99
|
-
finally {
|
|
100
|
-
done();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}, testDelayInt * 1000);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
@@ -1,75 +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
|
-
import * as fs from 'fs';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { Config } from './support/config';
|
|
11
|
-
import * as BlockChyp from '../index';
|
|
12
|
-
|
|
13
|
-
describe('MediaAsset', 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 media asset.', 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 mediaAsset...');
|
|
36
|
-
|
|
37
|
-
setTimeout(async function () {
|
|
38
|
-
try {
|
|
39
|
-
// setup request object
|
|
40
|
-
const setupRequest = new BlockChyp.UploadMetadata();
|
|
41
|
-
setupRequest.fileName = 'aviato.png';
|
|
42
|
-
setupRequest.fileSize = 18843;
|
|
43
|
-
setupRequest.uploadId = uuidv4();
|
|
44
|
-
let setupResponse: BlockChyp.MediaMetadata = new BlockChyp.MediaMetadata();
|
|
45
|
-
const content = fs.readFileSync('support/aviato.png');
|
|
46
|
-
const setupHttpResponse = await client.uploadMedia(setupRequest, content);
|
|
47
|
-
if (setupHttpResponse.status !== 200) {
|
|
48
|
-
console.log('Error:', setupHttpResponse.statusText);
|
|
49
|
-
fail(setupHttpResponse.statusText);
|
|
50
|
-
done();
|
|
51
|
-
}
|
|
52
|
-
setupResponse = setupHttpResponse.data
|
|
53
|
-
|
|
54
|
-
// setup request object
|
|
55
|
-
const request = new BlockChyp.MediaRequest();
|
|
56
|
-
request.mediaId = setupResponse.id;
|
|
57
|
-
|
|
58
|
-
const httpResponse = await client.mediaAsset(request)
|
|
59
|
-
const response: BlockChyp.MediaMetadata = httpResponse.data;
|
|
60
|
-
// response assertions
|
|
61
|
-
expect(response.success).toBe(true);
|
|
62
|
-
expect(response.id?.trim().length).toBeGreaterThan(0);
|
|
63
|
-
expect(response.originalFile)?.toEqual('aviato.png');
|
|
64
|
-
expect(response.fileUrl?.trim().length).toBeGreaterThan(0);
|
|
65
|
-
expect(response.thumbnailUrl?.trim().length).toBeGreaterThan(0);
|
|
66
|
-
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.log('Error:', error);
|
|
69
|
-
fail(error);
|
|
70
|
-
} finally {
|
|
71
|
-
done();
|
|
72
|
-
}
|
|
73
|
-
}, testDelayInt * 1000);
|
|
74
|
-
});
|
|
75
|
-
});
|
package/itest/MediaITestSpec.js
DELETED
|
@@ -1,83 +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('Media', 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 media for the given tenant.', 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 media...');
|
|
63
|
-
setTimeout(function () {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
try {
|
|
66
|
-
// setup request object
|
|
67
|
-
const request = new BlockChyp.MediaRequest();
|
|
68
|
-
const httpResponse = yield client.media(request);
|
|
69
|
-
const response = httpResponse.data;
|
|
70
|
-
// response assertions
|
|
71
|
-
expect(response.success).toBe(true);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.log('Error:', error);
|
|
75
|
-
fail(error);
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
done();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}, testDelayInt * 1000);
|
|
82
|
-
});
|
|
83
|
-
});
|
package/itest/MediaITestSpec.ts
DELETED
|
@@ -1,56 +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('Media', 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 media for the given tenant.', 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 media...');
|
|
36
|
-
|
|
37
|
-
setTimeout(async function () {
|
|
38
|
-
try {
|
|
39
|
-
// setup request object
|
|
40
|
-
const request = new BlockChyp.MediaRequest();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const httpResponse = await client.media(request)
|
|
44
|
-
const response: BlockChyp.MediaLibraryResponse = httpResponse.data;
|
|
45
|
-
// response assertions
|
|
46
|
-
expect(response.success).toBe(true);
|
|
47
|
-
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.log('Error:', error);
|
|
50
|
-
fail(error);
|
|
51
|
-
} finally {
|
|
52
|
-
done();
|
|
53
|
-
}
|
|
54
|
-
}, testDelayInt * 1000);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
/**
|
|
36
|
-
* Copyright 2019-2024 BlockChyp, Inc. All rights reserved. Use of this code is governed
|
|
37
|
-
* by a license that can be found in the LICENSE file.
|
|
38
|
-
*
|
|
39
|
-
* This file was generated automatically by the BlockChyp SDK Generator. Changes to this
|
|
40
|
-
* file will be lost every time the code is regenerated.
|
|
41
|
-
*/
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const uuid_1 = require("uuid");
|
|
44
|
-
const config_1 = require("./support/config");
|
|
45
|
-
const BlockChyp = __importStar(require("../index"));
|
|
46
|
-
describe('MediaUpload', function () {
|
|
47
|
-
let originalTimeout;
|
|
48
|
-
let client;
|
|
49
|
-
config_1.Config.load();
|
|
50
|
-
beforeEach(function () {
|
|
51
|
-
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
|
52
|
-
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
|
|
53
|
-
});
|
|
54
|
-
it('mediaUpload.', function (done) {
|
|
55
|
-
client = BlockChyp.newClient(config_1.Config.getCreds(""));
|
|
56
|
-
client.setGatewayHost(config_1.Config.getGatewayHost());
|
|
57
|
-
client.setTestGatewayHost(config_1.Config.getTestGatewayHost());
|
|
58
|
-
client.setDashboardHost(config_1.Config.getDashboardHost());
|
|
59
|
-
const testDelay = process.env.BC_TEST_DELAY;
|
|
60
|
-
let testDelayInt = 0;
|
|
61
|
-
if (testDelay) {
|
|
62
|
-
testDelayInt = parseInt(testDelay);
|
|
63
|
-
}
|
|
64
|
-
console.log('Running mediaUpload...');
|
|
65
|
-
setTimeout(function () {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _a, _b, _c, _d;
|
|
68
|
-
try {
|
|
69
|
-
// setup request object
|
|
70
|
-
const request = new BlockChyp.UploadMetadata();
|
|
71
|
-
request.fileName = 'aviato.png';
|
|
72
|
-
request.fileSize = 18843;
|
|
73
|
-
request.uploadId = (0, uuid_1.v4)();
|
|
74
|
-
const content = fs.readFileSync('support/aviato.png');
|
|
75
|
-
const httpResponse = yield client.uploadMedia(request, content);
|
|
76
|
-
const response = httpResponse.data;
|
|
77
|
-
// response assertions
|
|
78
|
-
expect(response.success).toBe(true);
|
|
79
|
-
expect((_a = response.id) === null || _a === void 0 ? void 0 : _a.trim().length).toBeGreaterThan(0);
|
|
80
|
-
(_b = expect(response.originalFile)) === null || _b === void 0 ? void 0 : _b.toEqual('aviato.png');
|
|
81
|
-
expect((_c = response.fileUrl) === null || _c === void 0 ? void 0 : _c.trim().length).toBeGreaterThan(0);
|
|
82
|
-
expect((_d = response.thumbnailUrl) === null || _d === void 0 ? void 0 : _d.trim().length).toBeGreaterThan(0);
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.log('Error:', error);
|
|
86
|
-
fail(error);
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
89
|
-
done();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}, testDelayInt * 1000);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
@@ -1,63 +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
|
-
import * as fs from 'fs';
|
|
9
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
-
import { Config } from './support/config';
|
|
11
|
-
import * as BlockChyp from '../index';
|
|
12
|
-
|
|
13
|
-
describe('MediaUpload', 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('mediaUpload.', 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 mediaUpload...');
|
|
36
|
-
|
|
37
|
-
setTimeout(async function () {
|
|
38
|
-
try {
|
|
39
|
-
// setup request object
|
|
40
|
-
const request = new BlockChyp.UploadMetadata();
|
|
41
|
-
request.fileName = 'aviato.png';
|
|
42
|
-
request.fileSize = 18843;
|
|
43
|
-
request.uploadId = uuidv4();
|
|
44
|
-
|
|
45
|
-
const content = fs.readFileSync('support/aviato.png');
|
|
46
|
-
const httpResponse = await client.uploadMedia(request, content)
|
|
47
|
-
const response: BlockChyp.MediaMetadata = httpResponse.data;
|
|
48
|
-
// response assertions
|
|
49
|
-
expect(response.success).toBe(true);
|
|
50
|
-
expect(response.id?.trim().length).toBeGreaterThan(0);
|
|
51
|
-
expect(response.originalFile)?.toEqual('aviato.png');
|
|
52
|
-
expect(response.fileUrl?.trim().length).toBeGreaterThan(0);
|
|
53
|
-
expect(response.thumbnailUrl?.trim().length).toBeGreaterThan(0);
|
|
54
|
-
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.log('Error:', error);
|
|
57
|
-
fail(error);
|
|
58
|
-
} finally {
|
|
59
|
-
done();
|
|
60
|
-
}
|
|
61
|
-
}, testDelayInt * 1000);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1,85 +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('MerchantCredentialGeneration', 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 generate merchant api credentials', 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 merchantCredentialGeneration...');
|
|
63
|
-
setTimeout(function () {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
try {
|
|
66
|
-
// setup request object
|
|
67
|
-
const request = new BlockChyp.MerchantCredentialGenerationRequest();
|
|
68
|
-
request.test = true;
|
|
69
|
-
request.merchantId = '<MERCHANT ID>';
|
|
70
|
-
const httpResponse = yield client.merchantCredentialGeneration(request);
|
|
71
|
-
const response = httpResponse.data;
|
|
72
|
-
// response assertions
|
|
73
|
-
expect(response.success).toBe(true);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
console.log('Error:', error);
|
|
77
|
-
fail(error);
|
|
78
|
-
}
|
|
79
|
-
finally {
|
|
80
|
-
done();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}, testDelayInt * 1000);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,57 +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('MerchantCredentialGeneration', 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 generate merchant api credentials', 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 merchantCredentialGeneration...');
|
|
36
|
-
|
|
37
|
-
setTimeout(async function () {
|
|
38
|
-
try {
|
|
39
|
-
// setup request object
|
|
40
|
-
const request = new BlockChyp.MerchantCredentialGenerationRequest();
|
|
41
|
-
request.test = true;
|
|
42
|
-
request.merchantId = '<MERCHANT ID>';
|
|
43
|
-
|
|
44
|
-
const httpResponse = await client.merchantCredentialGeneration(request)
|
|
45
|
-
const response: BlockChyp.MerchantCredentialGenerationResponse = httpResponse.data;
|
|
46
|
-
// response assertions
|
|
47
|
-
expect(response.success).toBe(true);
|
|
48
|
-
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.log('Error:', error);
|
|
51
|
-
fail(error);
|
|
52
|
-
} finally {
|
|
53
|
-
done();
|
|
54
|
-
}
|
|
55
|
-
}, testDelayInt * 1000);
|
|
56
|
-
});
|
|
57
|
-
});
|