Giter Club home page Giter Club logo

boleto-br

npm (scoped) Travis Coveralls Greenkeeper badge

Um conjunto de funções úteis para geração de boleto de cobrança de banco brasileiros.

Motivação

facilitar a geração de boletos de cobrança de bancos brasileiros, ele não gera um html ou mesmo um pdf do boleto, para isso recomendo o uso do boleto-pdf.

Suporte:

Barco Suporte
Bradesco
Caixa Em breve
Santander Help Wanted
Itaú Help Wanted
Outros Help Wanted

Instalação

Este projeto usa node e npm. Verifique em seu sistema se já estão instalados, corretamente.

$ npm install boleto-br --save

Uso

Geração de boleto

const {bill,bradesco} = require('boleto-br')
const bradescoBill = bill(bradesco)
const {generateBillData} = bradescoBill

const boletos =  [
  {
    ...
    expirationDay: Date,
    value: number,
    agency: string,
    card: string,
    ourNumber: string,
    account: number
  }
]
generateBillData(boletos).then( data => {
  // do something with data
}).catch(err => {
  console.log(err)
})

Veja aqui uma descrição mais detalhada de como gerar um pdf.

Geração de arquivo de remessa

const {bill,bradesco} = require('boleto-br')
const bradescoBill = bill(bradesco)
const {generateRemittanceFile} = bradescoBill

const boletos = {
  emitterCompanyCode: '433923',
  agencyNumber: '7506',
  agencyDigit: 1,
  accountNumber: 54291,
  accountDigity: 1,
  emitterCompany: 'ACME. SA',
  card: '09',
  date: new Date(2017, 6, 10),
  seedingSequentialNumber: 1,
  bills: [
    {
      ourNumber: '1',
      documentNumber: '1',
      value: 10000,
      lateFee: true,
      lateFeePercentual: 2,
      lateFeeValuePerDay: 17,
      occurencyCode: '01',
      expirationDay: new Date(2017, 6, 10),
      debtType: '12',
      issueDay: new Date(2017, 6, 10),
      discountDayLimit: 0,
      discountValue: 0,
      iofValue: 0,
      decreaseValue: 0,
      discountPerDay: 0,
      registerType: '01',
      instructionOne: '00',
      instructionTwo: '00',
      registerNumber: '83901298000138',
      payerName: 'JOHN BUYER',
      payerAddress: 'CLOWN SC',
      messageOne: '',
      payerPostalCode: '88703500',
      messageTwo: '083901298000138 ACME SA'
    }
  ]
}

generateRemittanceFile(boletos).then(data =>{
  fs.writeFile("./REMESSATEST.REM", data , function(err) {
    if(err) {
      return console.log(err)
    }
    console.log("The file was saved!")
  })
}).catch(err =>{
  console.log(err)
})

Veja aqui a descrição detalhada dos campos, para geração de remessa Bradesco.

Isto produzira um arquivo de remessa como esse:

01REMESSA01COBRANCA       00000000000000433923ACME. SA                      237BRADESCO       100717        MX0000001                                                                                                                                                                                                                                                                                     000001
1                   00090750600542911                         2372000200000000001100000000002N              01000000000110071700000000100000000000012N100717000000000000000170000000000000000000000000000000000000000000000183901298000138JOHN BUYER                              CLOWN SC                                            88703500083901298000138 ACME SA                                     000002
9                                                                                                                                                                                                                                                                                                                                                                                                         000003

Contribuindo

Veja o contributing file.

Licença

MIT License © Rafael Castro

boleto-br's Projects

boleto-pdf icon boleto-pdf

Um simples gerador de pdf de boletos de bancos brasilero

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.