UNPKG

@paciolan/cybersource-sdk

Version:
756 lines (755 loc) 43.9 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.PlansApi = exports.PlansApiFactory = exports.PlansApiFp = exports.PlansApiAxiosParamCreator = 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"); /** * PlansApi - axios parameter creator * @export */ const PlansApiAxiosParamCreator = function (configuration) { return { /** * Activate a Plan * @summary Activate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ activatePlan: (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 activatePlan.'); } const localVarPath = `/rbs/v1/plans/{id}/activate` .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: 'POST' }, 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, }; }), /** * The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer's payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (*TMS*). The three key elements of *Cybersource* Recurring Billing are: -  **Token**: stores customer billing, shipping, and payment details. -  **Plan**: stores the billing schedule. -  **Subscription**: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) * @summary Create a Plan * @param {V1PlansBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPlan: (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 createPlan.'); } const localVarPath = `/rbs/v1/plans`; // 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, }; }), /** * Deactivate a Plan * @summary Deactivate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deactivatePlan: (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 deactivatePlan.'); } const localVarPath = `/rbs/v1/plans/{id}/deactivate` .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: 'POST' }, 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, }; }), /** * Delete a Plan is only allowed: - plan status is in `DRAFT` - plan status is in `ACTIVE`, and `INACTIVE` only allowed when no subscriptions attached to a plan in the lifetime of a plan * @summary Delete a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePlan: (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 deletePlan.'); } const localVarPath = `/rbs/v1/plans/{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: 'DELETE' }, 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, }; }), /** * Retrieve a Plan details by Plan Id. * @summary Get a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlan: (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 getPlan.'); } const localVarPath = `/rbs/v1/plans/{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, }; }), /** * Get a Unique Plan Code * @summary Get a Plan Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlanCode: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/rbs/v1/plans/code`; // 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, }; }), /** * Retrieve Plans by Plan Code & Plan Status. * @summary Get a List of Plans * @param {number} [offset] Page offset number. * @param {number} [limit] Number of items to be returned. Default - `20`, Max - `100` * @param {string} [code] Filter by Plan Code * @param {string} [status] Filter by Plan Status * @param {string} [name] Filter by Plan Name. (First sub string or full string) **[Not Recommended]** * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlans: (offset, limit, code, status, name, options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/rbs/v1/plans`; // 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 (code !== undefined) { localVarQueryParameter['code'] = code; } if (status !== undefined) { localVarQueryParameter['status'] = status; } if (name !== undefined) { localVarQueryParameter['name'] = name; } 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, }; }), /** * Update a Plan Plan in `DRAFT` status - All updates are allowed on Plan with `DRAFT` status Plan in `ACTIVE` status [Following fields are **Not Updatable**] - `planInformation.billingPeriod` - `planInformation.billingCycles` [Update is only allowed to **increase** billingCycles] - `orderInformation.amountDetails.currency` * @summary Update a Plan * @param {PlansIdBody} body * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePlan: (body, id, 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 updatePlan.'); } // 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 updatePlan.'); } const localVarPath = `/rbs/v1/plans/{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: 'PATCH' }, 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.PlansApiAxiosParamCreator = PlansApiAxiosParamCreator; /** * PlansApi - functional programming interface * @export */ const PlansApiFp = function (configuration) { return { /** * Activate a Plan * @summary Activate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ activatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).activatePlan(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); }; }); }, /** * The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer's payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (*TMS*). The three key elements of *Cybersource* Recurring Billing are: -  **Token**: stores customer billing, shipping, and payment details. -  **Plan**: stores the billing schedule. -  **Subscription**: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) * @summary Create a Plan * @param {V1PlansBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPlan(body, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).createPlan(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); }; }); }, /** * Deactivate a Plan * @summary Deactivate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deactivatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).deactivatePlan(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); }; }); }, /** * Delete a Plan is only allowed: - plan status is in `DRAFT` - plan status is in `ACTIVE`, and `INACTIVE` only allowed when no subscriptions attached to a plan in the lifetime of a plan * @summary Delete a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).deletePlan(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); }; }); }, /** * Retrieve a Plan details by Plan Id. * @summary Get a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlan(id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).getPlan(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); }; }); }, /** * Get a Unique Plan Code * @summary Get a Plan Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlanCode(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).getPlanCode(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 Plans by Plan Code & Plan Status. * @summary Get a List of Plans * @param {number} [offset] Page offset number. * @param {number} [limit] Number of items to be returned. Default - `20`, Max - `100` * @param {string} [code] Filter by Plan Code * @param {string} [status] Filter by Plan Status * @param {string} [name] Filter by Plan Name. (First sub string or full string) **[Not Recommended]** * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlans(offset, limit, code, status, name, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).getPlans(offset, limit, code, status, name, 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); }; }); }, /** * Update a Plan Plan in `DRAFT` status - All updates are allowed on Plan with `DRAFT` status Plan in `ACTIVE` status [Following fields are **Not Updatable**] - `planInformation.billingPeriod` - `planInformation.billingCycles` [Update is only allowed to **increase** billingCycles] - `orderInformation.amountDetails.currency` * @summary Update a Plan * @param {PlansIdBody} body * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePlan(body, id, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.PlansApiAxiosParamCreator)(configuration).updatePlan(body, 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); }; }); }, }; }; exports.PlansApiFp = PlansApiFp; /** * PlansApi - factory interface * @export */ const PlansApiFactory = function (configuration, basePath, axios) { return { /** * Activate a Plan * @summary Activate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ activatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).activatePlan(id, options).then((request) => request(axios, basePath)); }); }, /** * The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer's payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (*TMS*). The three key elements of *Cybersource* Recurring Billing are: -  **Token**: stores customer billing, shipping, and payment details. -  **Plan**: stores the billing schedule. -  **Subscription**: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) * @summary Create a Plan * @param {V1PlansBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPlan(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).createPlan(body, options).then((request) => request(axios, basePath)); }); }, /** * Deactivate a Plan * @summary Deactivate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deactivatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).deactivatePlan(id, options).then((request) => request(axios, basePath)); }); }, /** * Delete a Plan is only allowed: - plan status is in `DRAFT` - plan status is in `ACTIVE`, and `INACTIVE` only allowed when no subscriptions attached to a plan in the lifetime of a plan * @summary Delete a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).deletePlan(id, options).then((request) => request(axios, basePath)); }); }, /** * Retrieve a Plan details by Plan Id. * @summary Get a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).getPlan(id, options).then((request) => request(axios, basePath)); }); }, /** * Get a Unique Plan Code * @summary Get a Plan Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlanCode(options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).getPlanCode(options).then((request) => request(axios, basePath)); }); }, /** * Retrieve Plans by Plan Code & Plan Status. * @summary Get a List of Plans * @param {number} [offset] Page offset number. * @param {number} [limit] Number of items to be returned. Default - `20`, Max - `100` * @param {string} [code] Filter by Plan Code * @param {string} [status] Filter by Plan Status * @param {string} [name] Filter by Plan Name. (First sub string or full string) **[Not Recommended]** * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPlans(offset, limit, code, status, name, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).getPlans(offset, limit, code, status, name, options).then((request) => request(axios, basePath)); }); }, /** * Update a Plan Plan in `DRAFT` status - All updates are allowed on Plan with `DRAFT` status Plan in `ACTIVE` status [Following fields are **Not Updatable**] - `planInformation.billingPeriod` - `planInformation.billingCycles` [Update is only allowed to **increase** billingCycles] - `orderInformation.amountDetails.currency` * @summary Update a Plan * @param {PlansIdBody} body * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePlan(body, id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(configuration).updatePlan(body, id, options).then((request) => request(axios, basePath)); }); }, }; }; exports.PlansApiFactory = PlansApiFactory; /** * PlansApi - object-oriented interface * @export * @class PlansApi * @extends {BaseAPI} */ class PlansApi extends base_1.BaseAPI { /** * Activate a Plan * @summary Activate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ activatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).activatePlan(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * The recurring billing service enables you to manage payment plans and subscriptions for recurring payment schedules. It securely stores your customer's payment information and personal data within secure Visa data centers, reducing storage risks and PCI DSS scope through the use of *Token Management* (*TMS*). The three key elements of *Cybersource* Recurring Billing are: -  **Token**: stores customer billing, shipping, and payment details. -  **Plan**: stores the billing schedule. -  **Subscription**: combines the token and plan, and defines the subscription start date, name, and description. The APIs in this section demonstrate the management of the Plans and Subscriptions. For Tokens please refer to [Token Management](#token-management) * @summary Create a Plan * @param {V1PlansBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ createPlan(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).createPlan(body, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Deactivate a Plan * @summary Deactivate a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ deactivatePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).deactivatePlan(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Delete a Plan is only allowed: - plan status is in `DRAFT` - plan status is in `ACTIVE`, and `INACTIVE` only allowed when no subscriptions attached to a plan in the lifetime of a plan * @summary Delete a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ deletePlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).deletePlan(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Retrieve a Plan details by Plan Id. * @summary Get a Plan * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ getPlan(id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).getPlan(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Get a Unique Plan Code * @summary Get a Plan Code * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ getPlanCode(options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).getPlanCode(options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Retrieve Plans by Plan Code & Plan Status. * @summary Get a List of Plans * @param {number} [offset] Page offset number. * @param {number} [limit] Number of items to be returned. Default - `20`, Max - `100` * @param {string} [code] Filter by Plan Code * @param {string} [status] Filter by Plan Status * @param {string} [name] Filter by Plan Name. (First sub string or full string) **[Not Recommended]** * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ getPlans(offset, limit, code, status, name, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).getPlans(offset, limit, code, status, name, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Update a Plan Plan in `DRAFT` status - All updates are allowed on Plan with `DRAFT` status Plan in `ACTIVE` status [Following fields are **Not Updatable**] - `planInformation.billingPeriod` - `planInformation.billingCycles` [Update is only allowed to **increase** billingCycles] - `orderInformation.amountDetails.currency` * @summary Update a Plan * @param {PlansIdBody} body * @param {string} id Plan Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PlansApi */ updatePlan(body, id, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.PlansApiFp)(this.configuration).updatePlan(body, id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.PlansApi = PlansApi;