UNPKG

@paciolan/cybersource-sdk

Version:
402 lines (401 loc) 27.2 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.ReportsApi = exports.ReportsApiFactory = exports.ReportsApiFp = exports.ReportsApiAxiosParamCreator = 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"); /** * ReportsApi - axios parameter creator * @export */ const ReportsApiAxiosParamCreator = function (configuration) { return { /** * Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation) * @summary Create Adhoc Report * @param {V3ReportsBody} body Report subscription request payload * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ createReport: (body, organizationId, 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 createReport.'); } const localVarPath = `/reporting/v3/reports`; // 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 (organizationId !== undefined) { localVarQueryParameter['organizationId'] = organizationId; } 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, }; }), /** * Download a report using the reportId value. If you don't already know this value, you can obtain it using the Retrieve available reports call. * @summary Get Report Based on Report Id * @param {string} reportId Valid Report Id * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getReportByReportId: (reportId, organizationId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'reportId' is not null or undefined if (reportId === null || reportId === undefined) { throw new base_1.RequiredError('reportId', 'Required parameter reportId was null or undefined when calling getReportByReportId.'); } const localVarPath = `/reporting/v3/reports/{reportId}` .replace(`{${"reportId"}}`, encodeURIComponent(String(reportId))); // 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 (organizationId !== undefined) { localVarQueryParameter['organizationId'] = organizationId; } 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, }; }), /** * Retrieve a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report. * @summary Retrieve Available Reports * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @param {string} timeQueryType Specify time you would like to search Valid values: - reportTimeFrame - executedTime * @param {string} [organizationId] Valid Organization Id * @param {string} [reportMimeType] Valid Report Format Valid values: - application/xml - text/csv * @param {string} [reportFrequency] Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC * @param {string} [reportName] Valid Report Name * @param {number} [reportDefinitionId] Valid Report Definition Id * @param {string} [reportStatus] Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchReports: (startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, 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 searchReports.'); } // 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 searchReports.'); } // verify required parameter 'timeQueryType' is not null or undefined if (timeQueryType === null || timeQueryType === undefined) { throw new base_1.RequiredError('timeQueryType', 'Required parameter timeQueryType was null or undefined when calling searchReports.'); } const localVarPath = `/reporting/v3/reports`; // 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 (organizationId !== undefined) { localVarQueryParameter['organizationId'] = organizationId; } if (startTime !== undefined) { localVarQueryParameter['startTime'] = (startTime instanceof Date) ? startTime.toISOString() : startTime; } if (endTime !== undefined) { localVarQueryParameter['endTime'] = (endTime instanceof Date) ? endTime.toISOString() : endTime; } if (timeQueryType !== undefined) { localVarQueryParameter['timeQueryType'] = timeQueryType; } if (reportMimeType !== undefined) { localVarQueryParameter['reportMimeType'] = reportMimeType; } if (reportFrequency !== undefined) { localVarQueryParameter['reportFrequency'] = reportFrequency; } if (reportName !== undefined) { localVarQueryParameter['reportName'] = reportName; } if (reportDefinitionId !== undefined) { localVarQueryParameter['reportDefinitionId'] = reportDefinitionId; } if (reportStatus !== undefined) { localVarQueryParameter['reportStatus'] = reportStatus; } 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.ReportsApiAxiosParamCreator = ReportsApiAxiosParamCreator; /** * ReportsApi - functional programming interface * @export */ const ReportsApiFp = function (configuration) { return { /** * Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation) * @summary Create Adhoc Report * @param {V3ReportsBody} body Report subscription request payload * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ createReport(body, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.ReportsApiAxiosParamCreator)(configuration).createReport(body, organizationId, 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); }; }); }, /** * Download a report using the reportId value. If you don't already know this value, you can obtain it using the Retrieve available reports call. * @summary Get Report Based on Report Id * @param {string} reportId Valid Report Id * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getReportByReportId(reportId, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.ReportsApiAxiosParamCreator)(configuration).getReportByReportId(reportId, organizationId, 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); }; }); }, /** * Retrieve a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report. * @summary Retrieve Available Reports * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @param {string} timeQueryType Specify time you would like to search Valid values: - reportTimeFrame - executedTime * @param {string} [organizationId] Valid Organization Id * @param {string} [reportMimeType] Valid Report Format Valid values: - application/xml - text/csv * @param {string} [reportFrequency] Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC * @param {string} [reportName] Valid Report Name * @param {number} [reportDefinitionId] Valid Report Definition Id * @param {string} [reportStatus] Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.ReportsApiAxiosParamCreator)(configuration).searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, 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.ReportsApiFp = ReportsApiFp; /** * ReportsApi - factory interface * @export */ const ReportsApiFactory = function (configuration, basePath, axios) { return { /** * Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation) * @summary Create Adhoc Report * @param {V3ReportsBody} body Report subscription request payload * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ createReport(body, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(configuration).createReport(body, organizationId, options).then((request) => request(axios, basePath)); }); }, /** * Download a report using the reportId value. If you don't already know this value, you can obtain it using the Retrieve available reports call. * @summary Get Report Based on Report Id * @param {string} reportId Valid Report Id * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getReportByReportId(reportId, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(configuration).getReportByReportId(reportId, organizationId, options).then((request) => request(axios, basePath)); }); }, /** * Retrieve a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report. * @summary Retrieve Available Reports * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @param {string} timeQueryType Specify time you would like to search Valid values: - reportTimeFrame - executedTime * @param {string} [organizationId] Valid Organization Id * @param {string} [reportMimeType] Valid Report Format Valid values: - application/xml - text/csv * @param {string} [reportFrequency] Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC * @param {string} [reportName] Valid Report Name * @param {number} [reportDefinitionId] Valid Report Definition Id * @param {string} [reportStatus] Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA * @param {*} [options] Override http request option. * @throws {RequiredError} */ searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(configuration).searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, options).then((request) => request(axios, basePath)); }); }, }; }; exports.ReportsApiFactory = ReportsApiFactory; /** * ReportsApi - object-oriented interface * @export * @class ReportsApi * @extends {BaseAPI} */ class ReportsApi extends base_1.BaseAPI { /** * Create a one-time report. You must specify the type of report in reportDefinitionName. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation) * @summary Create Adhoc Report * @param {V3ReportsBody} body Report subscription request payload * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApi */ createReport(body, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(this.configuration).createReport(body, organizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Download a report using the reportId value. If you don't already know this value, you can obtain it using the Retrieve available reports call. * @summary Get Report Based on Report Id * @param {string} reportId Valid Report Id * @param {string} [organizationId] Valid Organization Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApi */ getReportByReportId(reportId, organizationId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(this.configuration).getReportByReportId(reportId, organizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Retrieve a list of the available reports to which you are subscribed. This will also give you the reportId value, which you can also use to download a report. * @summary Retrieve Available Reports * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @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.SSSZ (e.g. 2018-01-01T00:00:00.000Z) * @param {string} timeQueryType Specify time you would like to search Valid values: - reportTimeFrame - executedTime * @param {string} [organizationId] Valid Organization Id * @param {string} [reportMimeType] Valid Report Format Valid values: - application/xml - text/csv * @param {string} [reportFrequency] Valid Report Frequency Valid values: - DAILY - WEEKLY - MONTHLY - USER_DEFINED - ADHOC * @param {string} [reportName] Valid Report Name * @param {number} [reportDefinitionId] Valid Report Definition Id * @param {string} [reportStatus] Valid Report Status Valid values: - COMPLETED - PENDING - QUEUED - RUNNING - ERROR - NO_DATA * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApi */ searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.ReportsApiFp)(this.configuration).searchReports(startTime, endTime, timeQueryType, organizationId, reportMimeType, reportFrequency, reportName, reportDefinitionId, reportStatus, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.ReportsApi = ReportsApi;