sc-cobre-facil
Version:
Biblioteca TypeScript para consumir a API da Cobre Fácil
38 lines • 1.26 kB
JavaScript
import dotenv from "dotenv";
dotenv.config();
import { CobreFacil } from "../classes";
const customerData = {
person_type: 2,
taxpayer_id: "",
ein: "53100452000101",
personal_name: "53.100.452 SAULO DE TARSO BASTOS COSTA",
company_name: "53.100.452 SAULO DE TARSO BASTOS COSTA",
telephone: "93992135722",
cellular: "93992135722",
email: "saulotarsobc@gmail.com",
address: {
description: "53.100.452 SAULO DE TARSO BASTOS COSTA",
zipcode: "68045210",
street: "Rua A",
number: "220",
complement: "Villa Bella",
neighborhood: "Jaderlândia",
city: "Santarém",
state: "PA",
},
};
async function main() {
const cobreFacil = new CobreFacil({
baseUrl: process.env.CF_BASE_URL || "https://api.sandbox.cobrefacil.com.br/v1",
app_id: process.env.CF_APP_ID || "app_id",
secret: process.env.CF_SECRET || "secret",
});
// await cobreFacil.auth();
// const customer_1 = await cobreFacil.createCustomer(customerData);
// console.log({ customer_1 });
await cobreFacil.auth();
const customer_2 = await cobreFacil.createOrGetCustomer(customerData);
console.log({ customer_2 });
}
main();
//# sourceMappingURL=index.js.map