Git Product home page Git Product logo

pjbank-api-client's Introduction

Instalação

npm install --save pjbank-api-client

Quickstart

'use strict';

const PJBankClient = require('pjbank-api-client');

const endpoint = 'bancos';

PJBankClient.get(endpoint)
    .then((bancos) => {
        console.info(bancos);
    })
    .catch((err) => {
        console.error(err);
    })

Output

{
    "bancos": {
        "001": "Banco do Brasil",
        "033": "Santander",
        "104": "Caixa Econômica Federal",
        "237": "Bradesco",
        "341": "Itaú",
        "399": "HSBC",
        "756": "Sicoob"
    }
}

Customizando o request

'use strict';

const PJBankClient = require('pjbank-api-client');

const body = {
    "vencimento": "12/30/2019",
    "valor": 50.75,
    "juros": 0,
    "multa": 0,
    "desconto": "",
    "nome_cliente": "Matheus Fidelis",
    "cpf_cliente": "62936576000112",
    "endereco_cliente": "Rua Joaquim Vilac",
    "numero_cliente": "501",
    "complemento_cliente": "",
    "bairro_cliente": "Vila Teixeira",
    "cidade_cliente": "Campinas",
    "estado_cliente": "SP",
    "cep_cliente": "13301510",
    "logo_url": "http://wallpapercave.com/wp/xK64fR4.jpg",
    "texto": "Exemplo de emissão de boleto",
    "grupo": "Boletos",
    "pedido_numero": "9977"
  };


const headers = {
    'content-type': 'application/json',
    'X-CHAVE' : 'ef947cf5867488f744b82744dd3a8fc4852e529f'
};

const endpoint = "recebimento/d3418668b85cea70aa28965eafaf927cd34d004c/transacoes";

PJBankClient.post(endpoint, body, null, headers)
.then((boleto) => {

    console.log(boleto);

}).catch((err) => {

    console.log(err);

});

pjbank-api-client's People

Contributors

gitfabio avatar medeirosfalante avatar msfidelis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pjbank-api-client's Issues

Função basepath sempre retorna sandbox independente de PJBANK_DEVELOPER_MODE ser true ou false

A funçao basepath sempre retorna sandbox porque ao não dar erro na função Boolean o resultado sempre vai ser verdadeiro

Boolean('true') === true - verdadeiro (função retorna sucesso)
Boolean('false') === true - verdadeiro (função retorna sucesso)

Acho que a solução seria comparar string mesmo:

basepath: () => {
        if (process.env.PJBANK_DEVELOPER_MODE === 'true') {
            return Sandbox;
        } else {
            return Production;
        }
    }

Como que eu faço pra submeter minha possível solução?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.