UNPKG

@paciolan/cybersource-sdk

Version:
419 lines (418 loc) 29.3 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.BatchesApi = exports.BatchesApiFactory = exports.BatchesApiFp = exports.BatchesApiAxiosParamCreator = 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"); /** * BatchesApi - axios parameter creator * @export */ const BatchesApiAxiosParamCreator = function (configuration) { return { /** * **Get Batch Report**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates & card type. - Response record information including response code, reason, token ids, masked card number, expiration dates & card type. * @summary Retrieve a Batch Report * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchReport: (batchId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'batchId' is not null or undefined if (batchId === null || batchId === undefined) { throw new base_1.RequiredError('batchId', 'Required parameter batchId was null or undefined when calling getBatchReport.'); } const localVarPath = `/accountupdater/v1/batches/{batchId}/report` .replace(`{${"batchId"}}`, encodeURIComponent(String(batchId))); // 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, }; }), /** * **Get Batch Status**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) * @summary Retrieve a Batch Status * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchStatus: (batchId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'batchId' is not null or undefined if (batchId === null || batchId === undefined) { throw new base_1.RequiredError('batchId', 'Required parameter batchId was null or undefined when calling getBatchStatus.'); } const localVarPath = `/accountupdater/v1/batches/{batchId}/status` .replace(`{${"batchId"}}`, encodeURIComponent(String(batchId))); // 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, }; }), /** * **List Batches**<br>This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses. * @summary List Batches * @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. * @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. * @param {string} [fromDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {string} [toDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchesList: (offset, limit, fromDate, toDate, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/accountupdater/v1/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 (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (fromDate !== undefined) { localVarQueryParameter['fromDate'] = fromDate; } if (toDate !== undefined) { localVarQueryParameter['toDate'] = toDate; } 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 Batch**<br>This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier. <br> The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.<br>The following type of batches can be submitted: - **oneOff** batch containing tokens id for Visa or MasterCard card numbers. - **amexRegistration** batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. * @summary Create a Batch * @param {V1BatchesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ postBatch: (body, 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 postBatch.'); } const localVarPath = `/accountupdater/v1/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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; 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.BatchesApiAxiosParamCreator = BatchesApiAxiosParamCreator; /** * BatchesApi - functional programming interface * @export */ const BatchesApiFp = function (configuration) { return { /** * **Get Batch Report**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates & card type. - Response record information including response code, reason, token ids, masked card number, expiration dates & card type. * @summary Retrieve a Batch Report * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchReport(batchId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.BatchesApiAxiosParamCreator)(configuration).getBatchReport(batchId, 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); }; }); }, /** * **Get Batch Status**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) * @summary Retrieve a Batch Status * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchStatus(batchId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.BatchesApiAxiosParamCreator)(configuration).getBatchStatus(batchId, 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); }; }); }, /** * **List Batches**<br>This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses. * @summary List Batches * @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. * @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. * @param {string} [fromDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {string} [toDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchesList(offset, limit, fromDate, toDate, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.BatchesApiAxiosParamCreator)(configuration).getBatchesList(offset, limit, fromDate, toDate, 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 Batch**<br>This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier. <br> The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.<br>The following type of batches can be submitted: - **oneOff** batch containing tokens id for Visa or MasterCard card numbers. - **amexRegistration** batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. * @summary Create a Batch * @param {V1BatchesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ postBatch(body, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.BatchesApiAxiosParamCreator)(configuration).postBatch(body, 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.BatchesApiFp = BatchesApiFp; /** * BatchesApi - factory interface * @export */ const BatchesApiFactory = function (configuration, basePath, axios) { return { /** * **Get Batch Report**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates & card type. - Response record information including response code, reason, token ids, masked card number, expiration dates & card type. * @summary Retrieve a Batch Report * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchReport(batchId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(configuration).getBatchReport(batchId, options).then((request) => request(axios, basePath)); }); }, /** * **Get Batch Status**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) * @summary Retrieve a Batch Status * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchStatus(batchId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(configuration).getBatchStatus(batchId, options).then((request) => request(axios, basePath)); }); }, /** * **List Batches**<br>This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses. * @summary List Batches * @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. * @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. * @param {string} [fromDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {string} [toDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBatchesList(offset, limit, fromDate, toDate, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(configuration).getBatchesList(offset, limit, fromDate, toDate, options).then((request) => request(axios, basePath)); }); }, /** * **Create a Batch**<br>This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier. <br> The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.<br>The following type of batches can be submitted: - **oneOff** batch containing tokens id for Visa or MasterCard card numbers. - **amexRegistration** batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. * @summary Create a Batch * @param {V1BatchesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ postBatch(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(configuration).postBatch(body, options).then((request) => request(axios, basePath)); }); }, }; }; exports.BatchesApiFactory = BatchesApiFactory; /** * BatchesApi - object-oriented interface * @export * @class BatchesApi * @extends {BaseAPI} */ class BatchesApi extends base_1.BaseAPI { /** * **Get Batch Report**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates & card type. - Response record information including response code, reason, token ids, masked card number, expiration dates & card type. * @summary Retrieve a Batch Report * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BatchesApi */ getBatchReport(batchId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(this.configuration).getBatchReport(batchId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * **Get Batch Status**<br>This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) * @summary Retrieve a Batch Status * @param {string} batchId Unique identification number assigned to the submitted request. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BatchesApi */ getBatchStatus(batchId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(this.configuration).getBatchStatus(batchId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * **List Batches**<br>This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses. * @summary List Batches * @param {number} [offset] Starting record in zero-based dataset that should be returned as the first object in the array. * @param {number} [limit] The maximum number that can be returned in the array starting from the offset record in zero-based dataset. * @param {string} [fromDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {string} [toDate] ISO-8601 format: yyyyMMddTHHmmssZ * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BatchesApi */ getBatchesList(offset, limit, fromDate, toDate, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(this.configuration).getBatchesList(offset, limit, fromDate, toDate, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * **Create a Batch**<br>This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier. <br> The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.<br>The following type of batches can be submitted: - **oneOff** batch containing tokens id for Visa or MasterCard card numbers. - **amexRegistration** batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. * @summary Create a Batch * @param {V1BatchesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BatchesApi */ postBatch(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.BatchesApiFp)(this.configuration).postBatch(body, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.BatchesApi = BatchesApi;