• Stars
    star
    298
  • Rank 139,663 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Boleto generator in Node.js

node-boleto

Standard - JavaScript Style Guide Quality Gate Status Coverage Maintainability Rating Reliability Rating Security Rating

Geração de boleto bancário em Node.js. Os algoritmos de geração da linha digitável e do código de barras foram inspirados no boletophp.

Bancos suportados

Instalação

npm install node-boleto

Exemplo de uso

Emitindo um boleto:

var Boleto = require('node-boleto').Boleto;

var boleto = new Boleto({
  'banco': "santander", // nome do banco dentro da pasta 'banks'
  'data_emissao': new Date(),
  'data_vencimento': new Date(new Date().getTime() + 5 * 24 * 3600 * 1000), // 5 dias futuramente
  'valor': 1500, // R$ 15,00 (valor em centavos)
  'nosso_numero': "1234567",
  'numero_documento': "123123",
  'cedente': "Pagar.me Pagamentos S/A",
  'cedente_cnpj': "18727053000174", // sem pontos e traços
  'agencia': "3978",
  'codigo_cedente': "6404154", // PSK (código da carteira)
  'carteira': "102"
});

console.log("Linha digitável: " + boleto['linha_digitavel'])

boleto.renderHTML(function(html){
  console.log(html);
});

Parseando o arquivo-retorno EDI do banco:

var ediParser = require('node-boleto').EdiParser,
	fs = require('fs');

var ediFileContent = fs.readFileSync("arquivo.txt").toString();

var parsedFile = ediParser.parse("santander", ediFileContent);

console.log("Boletos pagos: ");
console.log(parsedFile.boletos);

Adicionando novos bancos

Renderização do código de barras

Atualmente, há duas maneiras de renderizar o código de barras: img e bmp.

A engine img utiliza imagens brancas e pretas intercaladas para gerar o código de barras. Dessa forma, todos os browsers desde o IE6 são suportados. Esse modo de renderização, porém, é um pouco mais pesado, já que muitas divs são inseridas no HTML para a renderização.

A engine bmp aproveita da característica monodimensional dos códigos de barra e gera apenas a primeira linha de pixels do boleto, repetindo as outras linhas por CSS. É mais leve e funciona na maioria dos browser - IE apenas a partir da versão 8.

Para alterar a engine de renderização padrão:

Boleto.barcodeRenderEngine = 'bmp';

Licença

(The MIT License)

Copyright (c) 2013-2017 Pagar.me Pagamentos S/A

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

superbowleto

🏈 A microservice to issue, register and manage boletos
JavaScript
595
star
2

cafe-com-testes

O Café com Testes é uma iniciativa interna da Pagar.me para compartilhar conhecimento sobre testes e boas práticas de desenvolvimento. Essa iniciativa foi inspirada no Testing on the Toilet do Google
479
star
3

pagarme-php

💙 Pagar.me's PHP API
PHP
343
star
4

lambda

🔮 Estudos obscuros de programação funcional
JavaScript
317
star
5

vagas

🤝 Venha fazer parte do nosso time
316
star
6

react-event-components

🛰 A set of React components designed to handle global events (interval, keyboard, touch, mouse, etc)
JavaScript
274
star
7

teleport

🍆 Trigger-based Postgres replicator in Go that works without superuser permissions
Go
233
star
8

react-style-guide

Our React Style Guide
JavaScript
156
star
9

git-style-guide

Git styleguide followed by us here at Pagar.me
136
star
10

tldr

📜 A microservice to store and display sales receipts
JavaScript
133
star
11

react-scripts-former-kit-dashboard

📊 A custom react-scripts for building highly-customizable dashboards using former-kit components
JavaScript
130
star
12

react-payment-card-component

💳 A modern credit card component for React
JavaScript
99
star
13

the-office

Escritório virtual da Pagar.me
Svelte
94
star
14

pagarme-ruby

Pagar.me's Ruby API
Ruby
80
star
15

pagarme-python

🐍 Pagar.me's Python library
Python
76
star
16

former-kit

✈️ Primitive and unstyled React components ready for receiving your own visual identity.
JavaScript
71
star
17

javascript-style-guide

🎨 Javascript styleguide followed by us here at Pagar.me
JavaScript
50
star
18

deployer

📟 A tool for fetching, building, pushing and deploying applications.
Go
47
star
19

pagarme-magento

🛒 Pagar.me's Magento plugin
PHP
46
star
20

pagarme-java

Pagar.me's Java API
Java
44
star
21

pagarme-net

Pagar.me .NET library
C#
41
star
22

artis

💳 Projeto de Checkout desenvolvido em parceria entre MundiPagg e Pagar.me.
JavaScript
40
star
23

escriba

📜 Logging on steroids
JavaScript
38
star
24

talks

🎬 Recursos e material de estudo para criar boas talks
38
star
25

business-calendar

Holiday and financial operation calendar database
CSS
31
star
26

former-kit-skin-pagarme

✈️ A skin for former-kit based on Pagar.me's brand.
CSS
25
star
27

pagarme-core-api-php

PHP
23
star
28

pagarme-opencart

Modulo Pagar.me para OpenCart
PHP
22
star
29

robrowser

🤖 Automated frontend tests in different browser stacks
JavaScript
22
star
30

edipsy

Decent EDI file parsing in Node.js
JavaScript
22
star
31

sqs-quooler

A complete queue consumer for SQS
JavaScript
21
star
32

pagarme-nodejs-sdk

TypeScript
20
star
33

mr-krabs

🦀 💰 A package to clear Fargate cluster tasks https://www.npmjs.com/package/mr-krabs
JavaScript
20
star
34

satan-pm

node cluster process manager, upstart friendly
JavaScript
18
star
35

biblioteca-virtual

Repositório com links para artigos, vídeos, cursos levantados pelos times
18
star
36

caesar-challenge

17
star
37

magento2

Magento2 Module for Pagar.me 2.0
PHP
16
star
38

pagarme-ng-checkout

Angular service to provide checkout functionality to your Angularjs application.
JavaScript
16
star
39

pagarme-php-sdk

PHP
16
star
40

woocommerce

Woocommerce module for Pagar.me
PHP
16
star
41

pagarme-pocs

Um repositório para armazenarmos todas as pocs e exemplos de códigos que fazemos.
JavaScript
15
star
42

opensource

This is a guide for sharing best practices in furtherance of our open source projects
15
star
43

pagarme-ios

Pagar.me's iOS API
Objective-C
15
star
44

cryptokit

Golang crypto wrapper with pluggable providers
Go
15
star
45

node-rsa-keygen

Native RSA keypair generator for Node
C++
14
star
46

emblematic-icons

Pagar.me's iconography
JavaScript
14
star
47

hermes

Angular.js $http wrapper for RESTful applications
JavaScript
14
star
48

bifrost

🌈 Bifrost: Pagarme's bridge between browser and MPOS
C#
13
star
49

business-moment

Helpers for dealing with business days. Uses business-calendar as source.
JavaScript
13
star
50

pagarme-ng-dropdown

Pagar.me directive to provide a simple and quick dropdown from a provided array of options
JavaScript
13
star
51

cards-style-sheet

💳 A sheet of cards in CSS
CSS
13
star
52

p4g4rm3

Validador de senha de nossos serviços! ⛔
JavaScript
13
star
53

mpos-net-sdk

Pagar.me's mPOS SDK
C#
13
star
54

papeis

Os papéis que temos no Pagar.me
11
star
55

pagarme-core-api-nodejs

JavaScript
10
star
56

dojo

Repositório para as práticas de Dojo do time de Tecnologia da Pagar.me
JavaScript
10
star
57

pagarme-ng-range

Pagar.me directive to provide a custom range element
JavaScript
9
star
58

pagarme-express-exemplo

Esse projeto é um guia do fluxo de uso das funções mais utilizadas da API do Pagar.me
JavaScript
9
star
59

pagarme-python-sdk

Python
8
star
60

pagarme-sass-styleguide

The awesome angular.js styleguide that we follow at Pagar.me
8
star
61

warp-pipe

Golang tools to handle postgres logical replication slots
Go
8
star
62

pagarme-core-api-python

Python
8
star
63

dust

⚙️ 🏜️ Grupo de estudos da linguagem Rust 🏜️ ⚙️
Rust
8
star
64

pagarme-core-api-java

Java
8
star
65

pagarme-ng-tooltip

Pagar.me directive to provide simple a tooltip
JavaScript
8
star
66

pagarme-angular-styleguide

The awesome angular.js styleguide that we follow at Pagar.me
8
star
67

deplorator

extreme secure deploy manager
JavaScript
7
star
68

brand

Pagar.me logos in optimized SVG
7
star
69

terraform-ecs-application

ECS + CODEDEPLOY integrated with canary capabilities
HCL
6
star
70

pagarme-core-api-dotnet-framework

C#
6
star
71

pagarme-developers

Pagar.me's Developer Blog
CSS
6
star
72

pinpadRNExample

Example para integração com Pinpad em React Native
JavaScript
6
star
73

livepatch

Patch JSON streams on the fly
JavaScript
6
star
74

css

✨ Estudos sobre toda a magia do CSS
5
star
75

monkeyflash

Awesome library for animation and web page automation
JavaScript
5
star
76

react-material-design-icon-components

React components for all material design icons.
JavaScript
5
star
77

bundler

Node.js private package manager
JavaScript
5
star
78

pagarme-net-standard-sdk

C#
5
star
79

pagarme-core-api-go

Go
5
star
80

pagarme-golang-sdk

Go
4
star
81

ecommerce-module-core

PHP Module Core for our modules
PHP
4
star
82

cluster-requiem

Enhacements for the cluster module in order to handle graceful shutdowns with jobs that aren't associated with a socket.
JavaScript
4
star
83

bluebird-ff

Bluebird functional/flow extensions
JavaScript
4
star
84

scripts-to-rule-them-all

Pagar.me's scripts to rule them all, Docker version
Shell
4
star
85

tabajara-replicator

MySQL to PostgreSQL replicator
Ruby
4
star
86

cadu-js

💚 CADU Javascript API
JavaScript
4
star
87

pagarme-java-sdk

Java
4
star
88

arcaneshield

Python
4
star
89

ecs-task-def-replacements

JavaScript
4
star
90

mpos-android

Exemplo de aplicação do SDK Android MPOS Pagar.me
Java
4
star
91

pagarme-prestashop

Pagar.me - Prestashop Module
Smarty
4
star
92

aws-challenges

Desafios para candidados a vagas do time infraestrutura AWS
4
star
93

barcode-backup

Please, do not use this repository for production it is for reference only! Thank you!
JavaScript
3
star
94

gulp-ngspec

Hard file management for gulp projects
JavaScript
3
star
95

elasticrecord

ElasticSearch trait for ORMs, batteries included.
JavaScript
3
star
96

post-mortem-reports

Outage post mortem reports
3
star
97

lambda-simple-deploy

💿 Package and update your existent AWS Lambda functions
JavaScript
3
star
98

pagarme-core-api-dotnet-standard

C#
3
star
99

moment

Moment proxy usando a TZ de America/Sao_Paulo
JavaScript
3
star
100

mpos-bridge-js

JavaScript
2
star