@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
595 lines (594 loc) • 37.5 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvoicesApi = exports.InvoicesApiFactory = exports.InvoicesApiFp = exports.InvoicesApiAxiosParamCreator = 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");
/**
* InvoicesApi - axios parameter creator
* @export
*/
const InvoicesApiAxiosParamCreator = function (configuration) {
return {
/**
* The invoicing product enables you to bill any customer with an email address and accept digital payments securely from any connected device. You can either use the system generated email or use the invoice payment link in your own communication. You can add discounts and taxes for the entire invoice or for each line item. To customize the invoice to match your brand see [Invoice Settings](https://developer.cybersource.com/api-reference-assets/index.html#invoicing_invoice-settings_update-invoice-settings). The invoice payment page uses Unified Checkout to process the payments.
* @summary Create a New Invoice
* @param {V2InvoicesBody} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createInvoice: (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 createInvoice.');
}
const localVarPath = `/invoicing/v2/invoices`;
// 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,
};
}),
/**
* Provides a (filtered) list of invoices that have been created in your account. You can filter the list based on Invoice Status by setting the status query parameter to one of DRAFT, CREATED, SENT, PARTIAL, PAID or CANCELED.
* @summary Get a List of Invoices
* @param {number} offset Page offset number.
* @param {number} limit Maximum number of items you would like returned.
* @param {string} [status] The status of the invoice. Possible values: - DRAFT - CREATED - SENT - PARTIAL - PAID - CANCELED
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllInvoices: (offset, limit, status, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'offset' is not null or undefined
if (offset === null || offset === undefined) {
throw new base_1.RequiredError('offset', 'Required parameter offset was null or undefined when calling getAllInvoices.');
}
// verify required parameter 'limit' is not null or undefined
if (limit === null || limit === undefined) {
throw new base_1.RequiredError('limit', 'Required parameter limit was null or undefined when calling getAllInvoices.');
}
const localVarPath = `/invoicing/v2/invoices`;
// 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 (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,
};
}),
/**
* You can retrieve details of a specific invoice. This can be used to check the Invoice status and get a list of invoice payments in the invoice history section of the response. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @summary Get Invoice Details
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInvoice: (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 getInvoice.');
}
const localVarPath = `/invoicing/v2/invoices/{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,
};
}),
/**
* You can cancel an invoice if no payment is made to it. You cannot cancel partially or fully paid invoices.
* @summary Cancel an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performCancelAction: (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 performCancelAction.');
}
const localVarPath = `/invoicing/v2/invoices/{id}/cancelation`
.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,
};
}),
/**
* You can send an invoice in draft or created state or resend a sent or partially paid invoice. Fully paid or canceled invoices cannot be resent.
* @summary Send an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performSendAction: (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 performSendAction.');
}
const localVarPath = `/invoicing/v2/invoices/{id}/delivery`
.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,
};
}),
/**
* You can update all information except the invoice number till any payment is received for an invoice. Invoices that are partially or fully paid or cancelled cannot be updated.
* @summary Update an Invoice
* @param {InvoicesIdBody} body Updating the invoice does not resend the invoice automatically. You must resend the invoice separately.
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateInvoice: (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 updateInvoice.');
}
// 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 updateInvoice.');
}
const localVarPath = `/invoicing/v2/invoices/{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: 'PUT' }, 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.InvoicesApiAxiosParamCreator = InvoicesApiAxiosParamCreator;
/**
* InvoicesApi - functional programming interface
* @export
*/
const InvoicesApiFp = function (configuration) {
return {
/**
* The invoicing product enables you to bill any customer with an email address and accept digital payments securely from any connected device. You can either use the system generated email or use the invoice payment link in your own communication. You can add discounts and taxes for the entire invoice or for each line item. To customize the invoice to match your brand see [Invoice Settings](https://developer.cybersource.com/api-reference-assets/index.html#invoicing_invoice-settings_update-invoice-settings). The invoice payment page uses Unified Checkout to process the payments.
* @summary Create a New Invoice
* @param {V2InvoicesBody} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createInvoice(body, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).createInvoice(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);
};
});
},
/**
* Provides a (filtered) list of invoices that have been created in your account. You can filter the list based on Invoice Status by setting the status query parameter to one of DRAFT, CREATED, SENT, PARTIAL, PAID or CANCELED.
* @summary Get a List of Invoices
* @param {number} offset Page offset number.
* @param {number} limit Maximum number of items you would like returned.
* @param {string} [status] The status of the invoice. Possible values: - DRAFT - CREATED - SENT - PARTIAL - PAID - CANCELED
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllInvoices(offset, limit, status, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).getAllInvoices(offset, limit, 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);
};
});
},
/**
* You can retrieve details of a specific invoice. This can be used to check the Invoice status and get a list of invoice payments in the invoice history section of the response. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @summary Get Invoice Details
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInvoice(id, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).getInvoice(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);
};
});
},
/**
* You can cancel an invoice if no payment is made to it. You cannot cancel partially or fully paid invoices.
* @summary Cancel an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performCancelAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).performCancelAction(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);
};
});
},
/**
* You can send an invoice in draft or created state or resend a sent or partially paid invoice. Fully paid or canceled invoices cannot be resent.
* @summary Send an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performSendAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).performSendAction(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);
};
});
},
/**
* You can update all information except the invoice number till any payment is received for an invoice. Invoices that are partially or fully paid or cancelled cannot be updated.
* @summary Update an Invoice
* @param {InvoicesIdBody} body Updating the invoice does not resend the invoice automatically. You must resend the invoice separately.
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateInvoice(body, id, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.InvoicesApiAxiosParamCreator)(configuration).updateInvoice(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.InvoicesApiFp = InvoicesApiFp;
/**
* InvoicesApi - factory interface
* @export
*/
const InvoicesApiFactory = function (configuration, basePath, axios) {
return {
/**
* The invoicing product enables you to bill any customer with an email address and accept digital payments securely from any connected device. You can either use the system generated email or use the invoice payment link in your own communication. You can add discounts and taxes for the entire invoice or for each line item. To customize the invoice to match your brand see [Invoice Settings](https://developer.cybersource.com/api-reference-assets/index.html#invoicing_invoice-settings_update-invoice-settings). The invoice payment page uses Unified Checkout to process the payments.
* @summary Create a New Invoice
* @param {V2InvoicesBody} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createInvoice(body, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).createInvoice(body, options).then((request) => request(axios, basePath));
});
},
/**
* Provides a (filtered) list of invoices that have been created in your account. You can filter the list based on Invoice Status by setting the status query parameter to one of DRAFT, CREATED, SENT, PARTIAL, PAID or CANCELED.
* @summary Get a List of Invoices
* @param {number} offset Page offset number.
* @param {number} limit Maximum number of items you would like returned.
* @param {string} [status] The status of the invoice. Possible values: - DRAFT - CREATED - SENT - PARTIAL - PAID - CANCELED
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllInvoices(offset, limit, status, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).getAllInvoices(offset, limit, status, options).then((request) => request(axios, basePath));
});
},
/**
* You can retrieve details of a specific invoice. This can be used to check the Invoice status and get a list of invoice payments in the invoice history section of the response. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @summary Get Invoice Details
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getInvoice(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).getInvoice(id, options).then((request) => request(axios, basePath));
});
},
/**
* You can cancel an invoice if no payment is made to it. You cannot cancel partially or fully paid invoices.
* @summary Cancel an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performCancelAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).performCancelAction(id, options).then((request) => request(axios, basePath));
});
},
/**
* You can send an invoice in draft or created state or resend a sent or partially paid invoice. Fully paid or canceled invoices cannot be resent.
* @summary Send an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
performSendAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).performSendAction(id, options).then((request) => request(axios, basePath));
});
},
/**
* You can update all information except the invoice number till any payment is received for an invoice. Invoices that are partially or fully paid or cancelled cannot be updated.
* @summary Update an Invoice
* @param {InvoicesIdBody} body Updating the invoice does not resend the invoice automatically. You must resend the invoice separately.
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateInvoice(body, id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(configuration).updateInvoice(body, id, options).then((request) => request(axios, basePath));
});
},
};
};
exports.InvoicesApiFactory = InvoicesApiFactory;
/**
* InvoicesApi - object-oriented interface
* @export
* @class InvoicesApi
* @extends {BaseAPI}
*/
class InvoicesApi extends base_1.BaseAPI {
/**
* The invoicing product enables you to bill any customer with an email address and accept digital payments securely from any connected device. You can either use the system generated email or use the invoice payment link in your own communication. You can add discounts and taxes for the entire invoice or for each line item. To customize the invoice to match your brand see [Invoice Settings](https://developer.cybersource.com/api-reference-assets/index.html#invoicing_invoice-settings_update-invoice-settings). The invoice payment page uses Unified Checkout to process the payments.
* @summary Create a New Invoice
* @param {V2InvoicesBody} body
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
createInvoice(body, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).createInvoice(body, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* Provides a (filtered) list of invoices that have been created in your account. You can filter the list based on Invoice Status by setting the status query parameter to one of DRAFT, CREATED, SENT, PARTIAL, PAID or CANCELED.
* @summary Get a List of Invoices
* @param {number} offset Page offset number.
* @param {number} limit Maximum number of items you would like returned.
* @param {string} [status] The status of the invoice. Possible values: - DRAFT - CREATED - SENT - PARTIAL - PAID - CANCELED
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
getAllInvoices(offset, limit, status, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).getAllInvoices(offset, limit, status, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* You can retrieve details of a specific invoice. This can be used to check the Invoice status and get a list of invoice payments in the invoice history section of the response. For each payment transaction you can use the Transaction Details API to get more details on the payment transaction.
* @summary Get Invoice Details
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
getInvoice(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).getInvoice(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* You can cancel an invoice if no payment is made to it. You cannot cancel partially or fully paid invoices.
* @summary Cancel an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
performCancelAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).performCancelAction(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* You can send an invoice in draft or created state or resend a sent or partially paid invoice. Fully paid or canceled invoices cannot be resent.
* @summary Send an Invoice
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
performSendAction(id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).performSendAction(id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* You can update all information except the invoice number till any payment is received for an invoice. Invoices that are partially or fully paid or cancelled cannot be updated.
* @summary Update an Invoice
* @param {InvoicesIdBody} body Updating the invoice does not resend the invoice automatically. You must resend the invoice separately.
* @param {string} id The invoice number.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof InvoicesApi
*/
updateInvoice(body, id, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.InvoicesApiFp)(this.configuration).updateInvoice(body, id, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.InvoicesApi = InvoicesApi;