UNPKG

@paciolan/cybersource-sdk

Version:
349 lines (348 loc) 22.4 kB
"use strict"; 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.TransactionBatchesApi = exports.TransactionBatchesApiFactory = exports.TransactionBatchesApiFp = exports.TransactionBatchesApiAxiosParamCreator = 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"); /** * TransactionBatchesApi - axios parameter creator * @export */ const TransactionBatchesApiAxiosParamCreator = function (configuration) { return { /** * Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service. * @summary Get Transaction Details for a given Batch Id * @param {string} id The batch id assigned for the template. * @param {string} [uploadDate] Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd * @param {string} [status] Allows you to filter by rejected response. Valid values: - Rejected * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchDetails: (id, uploadDate, status, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new base_1.RequiredError('id', 'Required parameter id was null or undefined when calling getTransactionBatchDetails.'); } const localVarPath = `/pts/v1/transaction-batch-details/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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 = {}; if (uploadDate !== undefined) { localVarQueryParameter['uploadDate'] = (uploadDate instanceof Date) ? uploadDate.toISOString().substr(0, 10) : uploadDate; } if (status !== undefined) { localVarQueryParameter['status'] = status; } 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, }; }), /** * Provide the search range * @summary Get Individual Batch File * @param {string} id The batch id assigned for the template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchId: (id, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new base_1.RequiredError('id', 'Required parameter id was null or undefined when calling getTransactionBatchId.'); } const localVarPath = `/pts/v1/transaction-batches/{id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // 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, }; }), /** * Provide the search range * @summary Get a List of Batch Files * @param {Date} startTime Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {Date} endTime Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatches: (startTime, endTime, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'startTime' is not null or undefined if (startTime === null || startTime === undefined) { throw new base_1.RequiredError('startTime', 'Required parameter startTime was null or undefined when calling getTransactionBatches.'); } // verify required parameter 'endTime' is not null or undefined if (endTime === null || endTime === undefined) { throw new base_1.RequiredError('endTime', 'Required parameter endTime was null or undefined when calling getTransactionBatches.'); } const localVarPath = `/pts/v1/transaction-batches`; // 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 = {}; if (startTime !== undefined) { localVarQueryParameter['startTime'] = (startTime instanceof Date) ? startTime.toISOString() : startTime; } if (endTime !== undefined) { localVarQueryParameter['endTime'] = (endTime instanceof Date) ? endTime.toISOString() : endTime; } 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, }; }), }; }; exports.TransactionBatchesApiAxiosParamCreator = TransactionBatchesApiAxiosParamCreator; /** * TransactionBatchesApi - functional programming interface * @export */ const TransactionBatchesApiFp = function (configuration) { return { /** * Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service. * @summary Get Transaction Details for a given Batch Id * @param {string} id The batch id assigned for the template. * @param {string} [uploadDate] Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd * @param {string} [status] Allows you to filter by rejected response. Valid values: - Rejected * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchDetails(id, uploadDate, status, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.TransactionBatchesApiAxiosParamCreator)(configuration).getTransactionBatchDetails(id, uploadDate, status, 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); }; }); }, /** * Provide the search range * @summary Get Individual Batch File * @param {string} id The batch id assigned for the template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchId(id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.TransactionBatchesApiAxiosParamCreator)(configuration).getTransactionBatchId(id, 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); }; }); }, /** * Provide the search range * @summary Get a List of Batch Files * @param {Date} startTime Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {Date} endTime Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatches(startTime, endTime, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.TransactionBatchesApiAxiosParamCreator)(configuration).getTransactionBatches(startTime, endTime, 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.TransactionBatchesApiFp = TransactionBatchesApiFp; /** * TransactionBatchesApi - factory interface * @export */ const TransactionBatchesApiFactory = function (configuration, basePath, axios) { return { /** * Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service. * @summary Get Transaction Details for a given Batch Id * @param {string} id The batch id assigned for the template. * @param {string} [uploadDate] Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd * @param {string} [status] Allows you to filter by rejected response. Valid values: - Rejected * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchDetails(id, uploadDate, status, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(configuration).getTransactionBatchDetails(id, uploadDate, status, options).then((request) => request(axios, basePath)); }); }, /** * Provide the search range * @summary Get Individual Batch File * @param {string} id The batch id assigned for the template. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatchId(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(configuration).getTransactionBatchId(id, options).then((request) => request(axios, basePath)); }); }, /** * Provide the search range * @summary Get a List of Batch Files * @param {Date} startTime Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {Date} endTime Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionBatches(startTime, endTime, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(configuration).getTransactionBatches(startTime, endTime, options).then((request) => request(axios, basePath)); }); }, }; }; exports.TransactionBatchesApiFactory = TransactionBatchesApiFactory; /** * TransactionBatchesApi - object-oriented interface * @export * @class TransactionBatchesApi * @extends {BaseAPI} */ class TransactionBatchesApi extends base_1.BaseAPI { /** * Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service. * @summary Get Transaction Details for a given Batch Id * @param {string} id The batch id assigned for the template. * @param {string} [uploadDate] Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd * @param {string} [status] Allows you to filter by rejected response. Valid values: - Rejected * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionBatchesApi */ getTransactionBatchDetails(id, uploadDate, status, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(this.configuration).getTransactionBatchDetails(id, uploadDate, status, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Provide the search range * @summary Get Individual Batch File * @param {string} id The batch id assigned for the template. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionBatchesApi */ getTransactionBatchId(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(this.configuration).getTransactionBatchId(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Provide the search range * @summary Get a List of Batch Files * @param {Date} startTime Valid report Start Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {Date} endTime Valid report End Time in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd'T'HH:mm:ss.SSSZZ * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionBatchesApi */ getTransactionBatches(startTime, endTime, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransactionBatchesApiFp)(this.configuration).getTransactionBatches(startTime, endTime, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.TransactionBatchesApi = TransactionBatchesApi;