api/customers-api.ts
/* tslint:disable */
/* eslint-disable */
/**
* Conekta API
* Conekta sdk
*
* The version of the OpenAPI document: 2.1.0
* Contact: engineering@conekta.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import { CreateCustomerFiscalEntitiesResponse } from '../model';
// @ts-ignore
import { Customer } from '../model';
// @ts-ignore
import { CustomerFiscalEntitiesRequest } from '../model';
// @ts-ignore
import { CustomerResponse } from '../model';
// @ts-ignore
import { CustomerUpdateFiscalEntitiesRequest } from '../model';
// @ts-ignore
import { CustomersResponse } from '../model';
// @ts-ignore
import { ModelError } from '../model';
// @ts-ignore
import { UpdateCustomer } from '../model';
// @ts-ignore
import { UpdateCustomerFiscalEntitiesResponse } from '../model';
/**
* CustomersApi - axios parameter creator
* @export
*/
export const CustomersApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer)
* @summary Create customer
* @param {Customer} customer requested field for customer
* @param {CreateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomer: async (customer: Customer, acceptLanguage?: CreateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'customer' is not null or undefined
assertParamExists('createCustomer', 'customer', customer)
const localVarPath = `/customers`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customer, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Create Fiscal entity resource that corresponds to a customer ID.
* @summary Create Fiscal Entity
* @param {string} id Identifier of the resource
* @param {CustomerFiscalEntitiesRequest} customerFiscalEntitiesRequest requested field for customer fiscal entities
* @param {CreateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomerFiscalEntities: async (id: string, customerFiscalEntitiesRequest: CustomerFiscalEntitiesRequest, acceptLanguage?: CreateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('createCustomerFiscalEntities', 'id', id)
// verify required parameter 'customerFiscalEntitiesRequest' is not null or undefined
assertParamExists('createCustomerFiscalEntities', 'customerFiscalEntitiesRequest', customerFiscalEntitiesRequest)
const localVarPath = `/customers/{id}/fiscal_entities`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customerFiscalEntitiesRequest, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Deleted a customer resource that corresponds to a customer ID.
* @summary Delete Customer
* @param {string} id Identifier of the resource
* @param {DeleteCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteCustomerById: async (id: string, acceptLanguage?: DeleteCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('deleteCustomerById', 'id', id)
const localVarPath = `/customers/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Gets a customer resource that corresponds to a customer ID.
* @summary Get Customer
* @param {string} id Identifier of the resource
* @param {GetCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerById: async (id: string, acceptLanguage?: GetCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('getCustomerById', 'id', id)
const localVarPath = `/customers/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged.
* @summary Get a list of customers
* @param {GetCustomersAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {number} [limit] The numbers of items to return, the maximum value is 250
* @param {string} [search] General order search, e.g. by mail, reference etc.
* @param {string} [next] next page
* @param {string} [previous] previous page
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomers: async (acceptLanguage?: GetCustomersAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/customers`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (search !== undefined) {
localVarQueryParameter['search'] = search;
}
if (next !== undefined) {
localVarQueryParameter['next'] = next;
}
if (previous !== undefined) {
localVarQueryParameter['previous'] = previous;
}
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* You can update customer-related data
* @summary Update customer
* @param {string} id Identifier of the resource
* @param {UpdateCustomer} updateCustomer requested field for customer
* @param {UpdateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomer: async (id: string, updateCustomer: UpdateCustomer, acceptLanguage?: UpdateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('updateCustomer', 'id', id)
// verify required parameter 'updateCustomer' is not null or undefined
assertParamExists('updateCustomer', 'updateCustomer', updateCustomer)
const localVarPath = `/customers/{id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(updateCustomer, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Update Fiscal Entity resource that corresponds to a customer ID.
* @summary Update Fiscal Entity
* @param {string} id Identifier of the resource
* @param {string} fiscalEntitiesId identifier
* @param {CustomerUpdateFiscalEntitiesRequest} customerUpdateFiscalEntitiesRequest requested field for customer update fiscal entities
* @param {UpdateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomerFiscalEntities: async (id: string, fiscalEntitiesId: string, customerUpdateFiscalEntitiesRequest: CustomerUpdateFiscalEntitiesRequest, acceptLanguage?: UpdateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('updateCustomerFiscalEntities', 'id', id)
// verify required parameter 'fiscalEntitiesId' is not null or undefined
assertParamExists('updateCustomerFiscalEntities', 'fiscalEntitiesId', fiscalEntitiesId)
// verify required parameter 'customerUpdateFiscalEntitiesRequest' is not null or undefined
assertParamExists('updateCustomerFiscalEntities', 'customerUpdateFiscalEntitiesRequest', customerUpdateFiscalEntitiesRequest)
const localVarPath = `/customers/{id}/fiscal_entities/{fiscal_entities_id}`
.replace(`{${"id"}}`, encodeURIComponent(String(id)))
.replace(`{${"fiscal_entities_id"}}`, encodeURIComponent(String(fiscalEntitiesId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)
if (acceptLanguage != null) {
localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
}
if (xChildCompanyId != null) {
localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customerUpdateFiscalEntitiesRequest, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* CustomersApi - functional programming interface
* @export
*/
export const CustomersApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = CustomersApiAxiosParamCreator(configuration)
return {
/**
* The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer)
* @summary Create customer
* @param {Customer} customer requested field for customer
* @param {CreateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCustomer(customer: Customer, acceptLanguage?: CreateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomer(customer, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.createCustomer']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Create Fiscal entity resource that corresponds to a customer ID.
* @summary Create Fiscal Entity
* @param {string} id Identifier of the resource
* @param {CustomerFiscalEntitiesRequest} customerFiscalEntitiesRequest requested field for customer fiscal entities
* @param {CreateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCustomerFiscalEntities(id: string, customerFiscalEntitiesRequest: CustomerFiscalEntitiesRequest, acceptLanguage?: CreateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCustomerFiscalEntitiesResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomerFiscalEntities(id, customerFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.createCustomerFiscalEntities']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Deleted a customer resource that corresponds to a customer ID.
* @summary Delete Customer
* @param {string} id Identifier of the resource
* @param {DeleteCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async deleteCustomerById(id: string, acceptLanguage?: DeleteCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCustomerById(id, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.deleteCustomerById']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Gets a customer resource that corresponds to a customer ID.
* @summary Get Customer
* @param {string} id Identifier of the resource
* @param {GetCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCustomerById(id: string, acceptLanguage?: GetCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCustomerById(id, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.getCustomerById']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged.
* @summary Get a list of customers
* @param {GetCustomersAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {number} [limit] The numbers of items to return, the maximum value is 250
* @param {string} [search] General order search, e.g. by mail, reference etc.
* @param {string} [next] next page
* @param {string} [previous] previous page
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getCustomers(acceptLanguage?: GetCustomersAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomersResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getCustomers(acceptLanguage, xChildCompanyId, limit, search, next, previous, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.getCustomers']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* You can update customer-related data
* @summary Update customer
* @param {string} id Identifier of the resource
* @param {UpdateCustomer} updateCustomer requested field for customer
* @param {UpdateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateCustomer(id: string, updateCustomer: UpdateCustomer, acceptLanguage?: UpdateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCustomer(id, updateCustomer, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.updateCustomer']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
/**
* Update Fiscal Entity resource that corresponds to a customer ID.
* @summary Update Fiscal Entity
* @param {string} id Identifier of the resource
* @param {string} fiscalEntitiesId identifier
* @param {CustomerUpdateFiscalEntitiesRequest} customerUpdateFiscalEntitiesRequest requested field for customer update fiscal entities
* @param {UpdateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateCustomerFiscalEntities(id: string, fiscalEntitiesId: string, customerUpdateFiscalEntitiesRequest: CustomerUpdateFiscalEntitiesRequest, acceptLanguage?: UpdateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<UpdateCustomerFiscalEntitiesResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCustomerFiscalEntities(id, fiscalEntitiesId, customerUpdateFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CustomersApi.updateCustomerFiscalEntities']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
}
};
/**
* CustomersApi - factory interface
* @export
*/
export const CustomersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = CustomersApiFp(configuration)
return {
/**
* The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer)
* @summary Create customer
* @param {Customer} customer requested field for customer
* @param {CreateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomer(customer: Customer, acceptLanguage?: CreateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerResponse> {
return localVarFp.createCustomer(customer, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
* Create Fiscal entity resource that corresponds to a customer ID.
* @summary Create Fiscal Entity
* @param {string} id Identifier of the resource
* @param {CustomerFiscalEntitiesRequest} customerFiscalEntitiesRequest requested field for customer fiscal entities
* @param {CreateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomerFiscalEntities(id: string, customerFiscalEntitiesRequest: CustomerFiscalEntitiesRequest, acceptLanguage?: CreateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CreateCustomerFiscalEntitiesResponse> {
return localVarFp.createCustomerFiscalEntities(id, customerFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
* Deleted a customer resource that corresponds to a customer ID.
* @summary Delete Customer
* @param {string} id Identifier of the resource
* @param {DeleteCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteCustomerById(id: string, acceptLanguage?: DeleteCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerResponse> {
return localVarFp.deleteCustomerById(id, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
* Gets a customer resource that corresponds to a customer ID.
* @summary Get Customer
* @param {string} id Identifier of the resource
* @param {GetCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomerById(id: string, acceptLanguage?: GetCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerResponse> {
return localVarFp.getCustomerById(id, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
* The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged.
* @summary Get a list of customers
* @param {GetCustomersAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {number} [limit] The numbers of items to return, the maximum value is 250
* @param {string} [search] General order search, e.g. by mail, reference etc.
* @param {string} [next] next page
* @param {string} [previous] previous page
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getCustomers(acceptLanguage?: GetCustomersAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: any): AxiosPromise<CustomersResponse> {
return localVarFp.getCustomers(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(axios, basePath));
},
/**
* You can update customer-related data
* @summary Update customer
* @param {string} id Identifier of the resource
* @param {UpdateCustomer} updateCustomer requested field for customer
* @param {UpdateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomer(id: string, updateCustomer: UpdateCustomer, acceptLanguage?: UpdateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerResponse> {
return localVarFp.updateCustomer(id, updateCustomer, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
* Update Fiscal Entity resource that corresponds to a customer ID.
* @summary Update Fiscal Entity
* @param {string} id Identifier of the resource
* @param {string} fiscalEntitiesId identifier
* @param {CustomerUpdateFiscalEntitiesRequest} customerUpdateFiscalEntitiesRequest requested field for customer update fiscal entities
* @param {UpdateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomerFiscalEntities(id: string, fiscalEntitiesId: string, customerUpdateFiscalEntitiesRequest: CustomerUpdateFiscalEntitiesRequest, acceptLanguage?: UpdateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<UpdateCustomerFiscalEntitiesResponse> {
return localVarFp.updateCustomerFiscalEntities(id, fiscalEntitiesId, customerUpdateFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
};
};
/**
* CustomersApi - interface
* @export
* @interface CustomersApi
*/
export interface CustomersApiInterface {
/**
* The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer)
* @summary Create customer
* @param {Customer} customer requested field for customer
* @param {CreateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
createCustomer(customer: Customer, acceptLanguage?: CreateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerResponse>;
/**
* Create Fiscal entity resource that corresponds to a customer ID.
* @summary Create Fiscal Entity
* @param {string} id Identifier of the resource
* @param {CustomerFiscalEntitiesRequest} customerFiscalEntitiesRequest requested field for customer fiscal entities
* @param {CreateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
createCustomerFiscalEntities(id: string, customerFiscalEntitiesRequest: CustomerFiscalEntitiesRequest, acceptLanguage?: CreateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CreateCustomerFiscalEntitiesResponse>;
/**
* Deleted a customer resource that corresponds to a customer ID.
* @summary Delete Customer
* @param {string} id Identifier of the resource
* @param {DeleteCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
deleteCustomerById(id: string, acceptLanguage?: DeleteCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerResponse>;
/**
* Gets a customer resource that corresponds to a customer ID.
* @summary Get Customer
* @param {string} id Identifier of the resource
* @param {GetCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
getCustomerById(id: string, acceptLanguage?: GetCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerResponse>;
/**
* The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged.
* @summary Get a list of customers
* @param {GetCustomersAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {number} [limit] The numbers of items to return, the maximum value is 250
* @param {string} [search] General order search, e.g. by mail, reference etc.
* @param {string} [next] next page
* @param {string} [previous] previous page
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
getCustomers(acceptLanguage?: GetCustomersAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomersResponse>;
/**
* You can update customer-related data
* @summary Update customer
* @param {string} id Identifier of the resource
* @param {UpdateCustomer} updateCustomer requested field for customer
* @param {UpdateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
updateCustomer(id: string, updateCustomer: UpdateCustomer, acceptLanguage?: UpdateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerResponse>;
/**
* Update Fiscal Entity resource that corresponds to a customer ID.
* @summary Update Fiscal Entity
* @param {string} id Identifier of the resource
* @param {string} fiscalEntitiesId identifier
* @param {CustomerUpdateFiscalEntitiesRequest} customerUpdateFiscalEntitiesRequest requested field for customer update fiscal entities
* @param {UpdateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApiInterface
*/
updateCustomerFiscalEntities(id: string, fiscalEntitiesId: string, customerUpdateFiscalEntitiesRequest: CustomerUpdateFiscalEntitiesRequest, acceptLanguage?: UpdateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<UpdateCustomerFiscalEntitiesResponse>;
}
/**
* CustomersApi - object-oriented interface
* @export
* @class CustomersApi
* @extends {BaseAPI}
*/
export class CustomersApi extends BaseAPI implements CustomersApiInterface {
/**
* The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer)
* @summary Create customer
* @param {Customer} customer requested field for customer
* @param {CreateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public createCustomer(customer: Customer, acceptLanguage?: CreateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).createCustomer(customer, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Create Fiscal entity resource that corresponds to a customer ID.
* @summary Create Fiscal Entity
* @param {string} id Identifier of the resource
* @param {CustomerFiscalEntitiesRequest} customerFiscalEntitiesRequest requested field for customer fiscal entities
* @param {CreateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public createCustomerFiscalEntities(id: string, customerFiscalEntitiesRequest: CustomerFiscalEntitiesRequest, acceptLanguage?: CreateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).createCustomerFiscalEntities(id, customerFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Deleted a customer resource that corresponds to a customer ID.
* @summary Delete Customer
* @param {string} id Identifier of the resource
* @param {DeleteCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public deleteCustomerById(id: string, acceptLanguage?: DeleteCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).deleteCustomerById(id, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Gets a customer resource that corresponds to a customer ID.
* @summary Get Customer
* @param {string} id Identifier of the resource
* @param {GetCustomerByIdAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public getCustomerById(id: string, acceptLanguage?: GetCustomerByIdAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).getCustomerById(id, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* The purpose of business is to create and maintain a client, you will learn what elements you need to obtain a list of clients, which can be paged.
* @summary Get a list of customers
* @param {GetCustomersAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {number} [limit] The numbers of items to return, the maximum value is 250
* @param {string} [search] General order search, e.g. by mail, reference etc.
* @param {string} [next] next page
* @param {string} [previous] previous page
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public getCustomers(acceptLanguage?: GetCustomersAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).getCustomers(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(this.axios, this.basePath));
}
/**
* You can update customer-related data
* @summary Update customer
* @param {string} id Identifier of the resource
* @param {UpdateCustomer} updateCustomer requested field for customer
* @param {UpdateCustomerAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public updateCustomer(id: string, updateCustomer: UpdateCustomer, acceptLanguage?: UpdateCustomerAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).updateCustomer(id, updateCustomer, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Update Fiscal Entity resource that corresponds to a customer ID.
* @summary Update Fiscal Entity
* @param {string} id Identifier of the resource
* @param {string} fiscalEntitiesId identifier
* @param {CustomerUpdateFiscalEntitiesRequest} customerUpdateFiscalEntitiesRequest requested field for customer update fiscal entities
* @param {UpdateCustomerFiscalEntitiesAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
* @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CustomersApi
*/
public updateCustomerFiscalEntities(id: string, fiscalEntitiesId: string, customerUpdateFiscalEntitiesRequest: CustomerUpdateFiscalEntitiesRequest, acceptLanguage?: UpdateCustomerFiscalEntitiesAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
return CustomersApiFp(this.configuration).updateCustomerFiscalEntities(id, fiscalEntitiesId, customerUpdateFiscalEntitiesRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
}
/**
* @export
*/
export const CreateCustomerAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type CreateCustomerAcceptLanguageEnum = typeof CreateCustomerAcceptLanguageEnum[keyof typeof CreateCustomerAcceptLanguageEnum];
/**
* @export
*/
export const CreateCustomerFiscalEntitiesAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type CreateCustomerFiscalEntitiesAcceptLanguageEnum = typeof CreateCustomerFiscalEntitiesAcceptLanguageEnum[keyof typeof CreateCustomerFiscalEntitiesAcceptLanguageEnum];
/**
* @export
*/
export const DeleteCustomerByIdAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type DeleteCustomerByIdAcceptLanguageEnum = typeof DeleteCustomerByIdAcceptLanguageEnum[keyof typeof DeleteCustomerByIdAcceptLanguageEnum];
/**
* @export
*/
export const GetCustomerByIdAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type GetCustomerByIdAcceptLanguageEnum = typeof GetCustomerByIdAcceptLanguageEnum[keyof typeof GetCustomerByIdAcceptLanguageEnum];
/**
* @export
*/
export const GetCustomersAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type GetCustomersAcceptLanguageEnum = typeof GetCustomersAcceptLanguageEnum[keyof typeof GetCustomersAcceptLanguageEnum];
/**
* @export
*/
export const UpdateCustomerAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type UpdateCustomerAcceptLanguageEnum = typeof UpdateCustomerAcceptLanguageEnum[keyof typeof UpdateCustomerAcceptLanguageEnum];
/**
* @export
*/
export const UpdateCustomerFiscalEntitiesAcceptLanguageEnum = {
es: 'es',
en: 'en'
} as const;
export type UpdateCustomerFiscalEntitiesAcceptLanguageEnum = typeof UpdateCustomerFiscalEntitiesAcceptLanguageEnum[keyof typeof UpdateCustomerFiscalEntitiesAcceptLanguageEnum];