Skip to content

Clients ​

Clientes (/clients).

Cargar un cliente acá es opcional para facturar —los datos del receptor van en el documento— pero sirve para reusarlos y para nominar una factura innominada después.

Extends ​

Constructors ​

Constructor ​

ts
new Clients(transport, config): Clients;

Parameters ​

ParameterType
transportTransport
configIssuerConfig

Returns ​

Clients

Inherited from ​

Resource.constructor

Methods ​

get() ​

ts
get(id): Promise<ClientRecord>;

Un recurso por su id.

Parameters ​

ParameterType
idnumber

Returns ​

Promise<ClientRecord>

Inherited from ​

Resource.get


list() ​

ts
list(params?): Promise<Page<ClientRecord>>;

Una página de resultados.

Para recorrer todo sin escribir el bucle del cursor:

ts
for await (const factura of (await sd.invoices.list()).autoPaging()) { ... }

Parameters ​

ParameterType
paramsListParams

Returns ​

Promise<Page<ClientRecord>>

Inherited from ​

Resource.list


delete() ​

ts
delete(id): Promise<void>;

Borra el recurso.

Parameters ​

ParameterType
idnumber

Returns ​

Promise<void>

Inherited from ​

Resource.delete


create() ​

ts
create(fields): Promise<ClientRecord>;

Crea la ficha de un cliente.

Los campos van tal como los pide la API, sin los valores por omisión que sí pone Recipient. Son obligatorios ruc, socialName, type, isTaxPayer, countryCode, hasAddress y email; con hasAddress: true se suman address, department, district y city.

El campo del tipo de cliente se llama type, no clientType. Si falta email, la API responde 500 en lugar de un error de validación.

ts
const cliente = await sd.clients.create({
  ruc: '80012345-1',
  socialName: 'Cliente S.A.',
  type: ClientType.ENTITY,
  isTaxPayer: true,
  countryCode: 'PRY',
  hasAddress: false,
  email: 'facturas@cliente.com.py',
});

Parameters ​

ParameterType
fields{ [key: string]: unknown; }

Returns ​

Promise<ClientRecord>


update() ​

ts
update(id, fields): Promise<ClientRecord>;

Parameters ​

ParameterType
idnumber
fields{ [key: string]: unknown; }

Returns ​

Promise<ClientRecord>