@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
243 lines (242 loc) • 14.9 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.MerchantBoardingApi = exports.MerchantBoardingApiFactory = exports.MerchantBoardingApiFp = exports.MerchantBoardingApiAxiosParamCreator = 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");
/**
* MerchantBoardingApi - axios parameter creator
* @export
*/
const MerchantBoardingApiAxiosParamCreator = function (configuration) {
return {
/**
* This end point will get all information of a boarding registration
* @summary Gets all the information on a boarding registration
* @param {string} registrationId Identifies the boarding registration to be updated
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRegistration: (registrationId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'registrationId' is not null or undefined
if (registrationId === null || registrationId === undefined) {
throw new base_1.RequiredError('registrationId', 'Required parameter registrationId was null or undefined when calling getRegistration.');
}
const localVarPath = `/boarding/v1/registrations/{registrationId}`
.replace(`{${"registrationId"}}`, encodeURIComponent(String(registrationId)));
// 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: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
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 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,
};
}),
/**
* Create a registration to board merchant If you have Card Processing product enabled in your boarding request, select payment processor from Configuration -> Sample Request. You may unselect attributes from the Request Builder tree which you do not need in the request. For VPC, CUP and EFTPOS processors, replace the processor name from VPC or CUP or EFTPOS to the actual processor name in the sample request. e.g. replace VPC with <your vpc processor>
* @summary Create a boarding registration
* @param {V1RegistrationsBody} body Boarding registration data
* @param {string} [vCIdempotencyId] defines idempotency of the request
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postRegistration: (body, vCIdempotencyId, 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 postRegistration.');
}
const localVarPath = `/boarding/v1/registrations`;
// 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 (vCIdempotencyId !== undefined && vCIdempotencyId !== null) {
localVarHeaderParameter['v-c-idempotency-id'] = String(vCIdempotencyId);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
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.MerchantBoardingApiAxiosParamCreator = MerchantBoardingApiAxiosParamCreator;
/**
* MerchantBoardingApi - functional programming interface
* @export
*/
const MerchantBoardingApiFp = function (configuration) {
return {
/**
* This end point will get all information of a boarding registration
* @summary Gets all the information on a boarding registration
* @param {string} registrationId Identifies the boarding registration to be updated
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRegistration(registrationId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.MerchantBoardingApiAxiosParamCreator)(configuration).getRegistration(registrationId, 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);
};
});
},
/**
* Create a registration to board merchant If you have Card Processing product enabled in your boarding request, select payment processor from Configuration -> Sample Request. You may unselect attributes from the Request Builder tree which you do not need in the request. For VPC, CUP and EFTPOS processors, replace the processor name from VPC or CUP or EFTPOS to the actual processor name in the sample request. e.g. replace VPC with <your vpc processor>
* @summary Create a boarding registration
* @param {V1RegistrationsBody} body Boarding registration data
* @param {string} [vCIdempotencyId] defines idempotency of the request
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postRegistration(body, vCIdempotencyId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.MerchantBoardingApiAxiosParamCreator)(configuration).postRegistration(body, vCIdempotencyId, 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.MerchantBoardingApiFp = MerchantBoardingApiFp;
/**
* MerchantBoardingApi - factory interface
* @export
*/
const MerchantBoardingApiFactory = function (configuration, basePath, axios) {
return {
/**
* This end point will get all information of a boarding registration
* @summary Gets all the information on a boarding registration
* @param {string} registrationId Identifies the boarding registration to be updated
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRegistration(registrationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.MerchantBoardingApiFp)(configuration).getRegistration(registrationId, options).then((request) => request(axios, basePath));
});
},
/**
* Create a registration to board merchant If you have Card Processing product enabled in your boarding request, select payment processor from Configuration -> Sample Request. You may unselect attributes from the Request Builder tree which you do not need in the request. For VPC, CUP and EFTPOS processors, replace the processor name from VPC or CUP or EFTPOS to the actual processor name in the sample request. e.g. replace VPC with <your vpc processor>
* @summary Create a boarding registration
* @param {V1RegistrationsBody} body Boarding registration data
* @param {string} [vCIdempotencyId] defines idempotency of the request
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
postRegistration(body, vCIdempotencyId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.MerchantBoardingApiFp)(configuration).postRegistration(body, vCIdempotencyId, options).then((request) => request(axios, basePath));
});
},
};
};
exports.MerchantBoardingApiFactory = MerchantBoardingApiFactory;
/**
* MerchantBoardingApi - object-oriented interface
* @export
* @class MerchantBoardingApi
* @extends {BaseAPI}
*/
class MerchantBoardingApi extends base_1.BaseAPI {
/**
* This end point will get all information of a boarding registration
* @summary Gets all the information on a boarding registration
* @param {string} registrationId Identifies the boarding registration to be updated
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MerchantBoardingApi
*/
getRegistration(registrationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.MerchantBoardingApiFp)(this.configuration).getRegistration(registrationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* Create a registration to board merchant If you have Card Processing product enabled in your boarding request, select payment processor from Configuration -> Sample Request. You may unselect attributes from the Request Builder tree which you do not need in the request. For VPC, CUP and EFTPOS processors, replace the processor name from VPC or CUP or EFTPOS to the actual processor name in the sample request. e.g. replace VPC with <your vpc processor>
* @summary Create a boarding registration
* @param {V1RegistrationsBody} body Boarding registration data
* @param {string} [vCIdempotencyId] defines idempotency of the request
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MerchantBoardingApi
*/
postRegistration(body, vCIdempotencyId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.MerchantBoardingApiFp)(this.configuration).postRegistration(body, vCIdempotencyId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.MerchantBoardingApi = MerchantBoardingApi;