@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
220 lines (219 loc) • 12 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PushFundsApi = exports.PushFundsApiFactory = exports.PushFundsApiFp = exports.PushFundsApiAxiosParamCreator = void 0;
/* tslint:disable */
/* eslint-disable */
/**
* CyberSource Merged Spec
* All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
const axios_1 = __importDefault(require("axios"));
const AuthenticationHeader_1 = require("../authentication/core/AuthenticationHeader");
// Some imports not used depending on template conditions
// @ts-ignore
const base_1 = require("../base");
/**
* PushFundsApi - axios parameter creator
* @export
*/
const PushFundsApiAxiosParamCreator = function (configuration) {
return {
/**
* Receive funds using an Original Credit Transaction (OCT).
* @summary Process a Push Funds Transfer
* @param {V1PushfundstransferBody} body
* @param {string} contentType
* @param {string} xRequestid
* @param {string} vCMerchantId
* @param {string} vCPermissions
* @param {string} vCCorrelationId
* @param {string} vCOrganizationId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createPushFundsTransfer: (body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'contentType' is not null or undefined
if (contentType === null || contentType === undefined) {
throw new base_1.RequiredError('contentType', 'Required parameter contentType was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'xRequestid' is not null or undefined
if (xRequestid === null || xRequestid === undefined) {
throw new base_1.RequiredError('xRequestid', 'Required parameter xRequestid was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'vCMerchantId' is not null or undefined
if (vCMerchantId === null || vCMerchantId === undefined) {
throw new base_1.RequiredError('vCMerchantId', 'Required parameter vCMerchantId was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'vCPermissions' is not null or undefined
if (vCPermissions === null || vCPermissions === undefined) {
throw new base_1.RequiredError('vCPermissions', 'Required parameter vCPermissions was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'vCCorrelationId' is not null or undefined
if (vCCorrelationId === null || vCCorrelationId === undefined) {
throw new base_1.RequiredError('vCCorrelationId', 'Required parameter vCCorrelationId was null or undefined when calling createPushFundsTransfer.');
}
// verify required parameter 'vCOrganizationId' is not null or undefined
if (vCOrganizationId === null || vCOrganizationId === undefined) {
throw new base_1.RequiredError('vCOrganizationId', 'Required parameter vCOrganizationId was null or undefined when calling createPushFundsTransfer.');
}
const localVarPath = `/pts/v1/push-funds-transfer`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (contentType !== undefined && contentType !== null) {
localVarHeaderParameter['Content-Type'] = String(contentType);
}
if (xRequestid !== undefined && xRequestid !== null) {
localVarHeaderParameter['x-requestid'] = String(xRequestid);
}
if (vCMerchantId !== undefined && vCMerchantId !== null) {
localVarHeaderParameter['v-c-merchant-id'] = String(vCMerchantId);
}
if (vCPermissions !== undefined && vCPermissions !== null) {
localVarHeaderParameter['v-c-permissions'] = String(vCPermissions);
}
if (vCCorrelationId !== undefined && vCCorrelationId !== null) {
localVarHeaderParameter['v-c-correlation-id'] = String(vCCorrelationId);
}
if (vCOrganizationId !== undefined && vCOrganizationId !== null) {
localVarHeaderParameter['v-c-organization-id'] = String(vCOrganizationId);
}
localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8';
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
};
};
exports.PushFundsApiAxiosParamCreator = PushFundsApiAxiosParamCreator;
/**
* PushFundsApi - functional programming interface
* @export
*/
const PushFundsApiFp = function (configuration) {
return {
/**
* Receive funds using an Original Credit Transaction (OCT).
* @summary Process a Push Funds Transfer
* @param {V1PushfundstransferBody} body
* @param {string} contentType
* @param {string} xRequestid
* @param {string} vCMerchantId
* @param {string} vCPermissions
* @param {string} vCCorrelationId
* @param {string} vCOrganizationId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.PushFundsApiAxiosParamCreator)(configuration).createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
};
};
exports.PushFundsApiFp = PushFundsApiFp;
/**
* PushFundsApi - factory interface
* @export
*/
const PushFundsApiFactory = function (configuration, basePath, axios) {
return {
/**
* Receive funds using an Original Credit Transaction (OCT).
* @summary Process a Push Funds Transfer
* @param {V1PushfundstransferBody} body
* @param {string} contentType
* @param {string} xRequestid
* @param {string} vCMerchantId
* @param {string} vCPermissions
* @param {string} vCCorrelationId
* @param {string} vCOrganizationId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.PushFundsApiFp)(configuration).createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options).then((request) => request(axios, basePath));
});
},
};
};
exports.PushFundsApiFactory = PushFundsApiFactory;
/**
* PushFundsApi - object-oriented interface
* @export
* @class PushFundsApi
* @extends {BaseAPI}
*/
class PushFundsApi extends base_1.BaseAPI {
/**
* Receive funds using an Original Credit Transaction (OCT).
* @summary Process a Push Funds Transfer
* @param {V1PushfundstransferBody} body
* @param {string} contentType
* @param {string} xRequestid
* @param {string} vCMerchantId
* @param {string} vCPermissions
* @param {string} vCCorrelationId
* @param {string} vCOrganizationId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PushFundsApi
*/
createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.PushFundsApiFp)(this.configuration).createPushFundsTransfer(body, contentType, xRequestid, vCMerchantId, vCPermissions, vCCorrelationId, vCOrganizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.PushFundsApi = PushFundsApi;