This is the unofficial Node.js wrapper for CT Online API
npm install --save ctonline-wrapper
import CTOnlineWrapper from "ctonline-wrapper";
const apiCredentials = {
account: "HMO0001",
rfc: "TEST860123FM3",
email: "test@test.com",
};
const ftpCredentials = {
host: "127.0.0.1",
user: "HMO0001",
password: "testT3st",
};
const ctOnlineWrapper = new CTOnlineWrapper(apiCredentials, ftpCredentials);
const getCatalog = await ctOnlineWrapper.products.getCatalog();
const getCatalogByCode = await ctOnlineWrapper.products.getCatalogByCode();
const getStock = await ctOnlineWrapper.products.getStock("COMCPQ2020");
const getStock = await ctOnlineWrapper.products.getStockByWarehouse(
"COMCPQ2020",
"01A"
);
const getOrders = await ctOnlineWrapper.orders.get();
const getOrderStatus = await ctOnlineWrapper.orders.getStatus("W99-0116391");
const newOrder = await ctOnlineWrapper.orders.create({
idPedido: 506398,
tipoPago: "04",
envio: [],
producto: [
{
cantidad: 1,
clave: "CPUASS020",
precio: 414.75,
moneda: "MXN",
},
{
cantidad: 1,
clave: "NBKBIT010",
precio: 676.5,
moneda: "USD",
},
],
});
const confirmMyOrder = await ctOnlineWrapper.orders.confirm("W99-0116391");