qqlib-node-boleto 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +11 -0
- package/.eslintignore +1 -0
- package/.eslintrc +10 -0
- package/.idea/encodings.xml +4 -0
- package/.idea/modules.xml +8 -0
- package/.idea/node-boleto.git_master.iml +8 -0
- package/.idea/vcs.xml +7 -0
- package/LICENSE +20 -0
- package/README.md +92 -0
- package/assets/layout.ejs +433 -0
- package/banks/banco do brasil/index.js +172 -0
- package/banks/bradesco/index.js +154 -0
- package/banks/caixa/index.js +66 -0
- package/banks/santander/helper.js +3 -0
- package/banks/santander/index.js +145 -0
- package/examples/bradesco-edi.js +6 -0
- package/examples/bradesco-emission.js +35 -0
- package/examples/retorno.txt +8 -0
- package/examples/santander-edi.js +6 -0
- package/examples/santander-emission.js +32 -0
- package/index.js +12 -0
- package/lib/barcode.js +93 -0
- package/lib/boleto.js +105 -0
- package/lib/edi-helper.js +13 -0
- package/lib/edi-parser.js +7 -0
- package/lib/formatters.js +109 -0
- package/package.json +30 -0
- package/public/images/b.png +0 -0
- package/public/images/bb.png +0 -0
- package/public/images/bradesco.jpg +0 -0
- package/public/images/santander.png +0 -0
- package/public/images/w.png +0 -0
- package/readme.will.md +11 -0
- package/sonar-project.properties +9 -0
- package/test/e2e/boleto-output.js +420 -0
- package/test/e2e/boleto-render.spec.js +104 -0
- package/test/integration/bradesco/boleto.spec.js +216 -0
- package/test/integration/bradesco/edi.spec.js +113 -0
- package/test/integration/caixa/edi.spec.js +99 -0
- package/test/integration/santander/boleto.spec.js +45 -0
- package/test/integration/santander/edi.spec.js +73 -0
- package/test/mocks/banks.js +13 -0
- package/test/mocks/boleto-2018-10-31.js +25 -0
- package/test/mocks/boleto-2018-11-09.js +25 -0
- package/test/unit/boleto-object.spec.js +134 -0
- package/test/unit/boleto-render.spec.js +34 -0
- package/test/unit/formatters.spec.js +62 -0
package/.editorconfig
ADDED
package/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules/*
|
package/.eslintrc
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/node-boleto.git_master.iml" filepath="$PROJECT_DIR$/.idea/node-boleto.git_master.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 pagarme
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
node-boleto
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
[](http://standardjs.com/)
|
|
5
|
+
[](https://sonarcloud.io/dashboard?id=node-boleto)
|
|
6
|
+
[](https://sonarcloud.io/dashboard?id=node-boleto)
|
|
7
|
+
[](https://sonarcloud.io/dashboard?id=node-boleto)
|
|
8
|
+
[](https://sonarcloud.io/dashboard?id=node-boleto)
|
|
9
|
+
[](https://sonarcloud.io/dashboard?id=node-boleto)
|
|
10
|
+
|
|
11
|
+
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](https://github.com/BielSystems/boletophp).
|
|
12
|
+
|
|
13
|
+
## Bancos suportados
|
|
14
|
+
|
|
15
|
+
- Santander - by [pedrofranceschi](https://github.com/pedrofranceschi) - homologado
|
|
16
|
+
- Bradesco - by [pedrofranceschi](https://github.com/pedrofranceschi)
|
|
17
|
+
|
|
18
|
+
## Instalação
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm install node-boleto
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Exemplo de uso
|
|
25
|
+
|
|
26
|
+
Emitindo um boleto:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
var Boleto = require('node-boleto').Boleto;
|
|
30
|
+
|
|
31
|
+
var boleto = new Boleto({
|
|
32
|
+
'banco': "santander", // nome do banco dentro da pasta 'banks'
|
|
33
|
+
'data_emissao': new Date(),
|
|
34
|
+
'data_vencimento': new Date(new Date().getTime() + 5 * 24 * 3600 * 1000), // 5 dias futuramente
|
|
35
|
+
'valor': 1500, // R$ 15,00 (valor em centavos)
|
|
36
|
+
'nosso_numero': "1234567",
|
|
37
|
+
'numero_documento': "123123",
|
|
38
|
+
'cedente': "Pagar.me Pagamentos S/A",
|
|
39
|
+
'cedente_cnpj': "18727053000174", // sem pontos e traços
|
|
40
|
+
'agencia': "3978",
|
|
41
|
+
'codigo_cedente': "6404154", // PSK (código da carteira)
|
|
42
|
+
'carteira': "102"
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log("Linha digitável: " + boleto['linha_digitavel'])
|
|
46
|
+
|
|
47
|
+
boleto.renderHTML(function(html){
|
|
48
|
+
console.log(html);
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Parseando o arquivo-retorno EDI do banco:
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
var ediParser = require('node-boleto').EdiParser,
|
|
56
|
+
fs = require('fs');
|
|
57
|
+
|
|
58
|
+
var ediFileContent = fs.readFileSync("arquivo.txt").toString();
|
|
59
|
+
|
|
60
|
+
var parsedFile = ediParser.parse("santander", ediFileContent);
|
|
61
|
+
|
|
62
|
+
console.log("Boletos pagos: ");
|
|
63
|
+
console.log(parsedFile.boletos);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Adicionando novos bancos
|
|
67
|
+
|
|
68
|
+
## Renderização do código de barras
|
|
69
|
+
|
|
70
|
+
Atualmente, há duas maneiras de renderizar o código de barras: `img` e `bmp`.
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
Para alterar a engine de renderização padrão:
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
Boleto.barcodeRenderEngine = 'bmp';
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Licença
|
|
83
|
+
|
|
84
|
+
(The MIT License)
|
|
85
|
+
|
|
86
|
+
Copyright (c) 2013-2017 Pagar.me Pagamentos S/A
|
|
87
|
+
|
|
88
|
+
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:
|
|
89
|
+
|
|
90
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
91
|
+
|
|
92
|
+
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.
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Visualização de boleto</title>
|
|
5
|
+
<meta name="robots" content="noindex">
|
|
6
|
+
<meta name="format-detection" content="telephone=no"/>
|
|
7
|
+
<style media="screen, print" type="text/css">
|
|
8
|
+
body
|
|
9
|
+
{
|
|
10
|
+
color:#000000;
|
|
11
|
+
background-color:#ffffff;
|
|
12
|
+
margin-top:0;
|
|
13
|
+
margin-right:0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
*{margin:0px;padding:0px}
|
|
17
|
+
table{border:0;border-collapse:collapse;padding:0}
|
|
18
|
+
|
|
19
|
+
img{border:0}
|
|
20
|
+
|
|
21
|
+
.cp
|
|
22
|
+
{
|
|
23
|
+
font: bold 10px arial;
|
|
24
|
+
color: black
|
|
25
|
+
}
|
|
26
|
+
.ti
|
|
27
|
+
{
|
|
28
|
+
font: 9px arial, helvetica, sans-serif
|
|
29
|
+
}
|
|
30
|
+
.ld
|
|
31
|
+
{
|
|
32
|
+
font: bold 15px arial;
|
|
33
|
+
color: #000000
|
|
34
|
+
}
|
|
35
|
+
.ct
|
|
36
|
+
{
|
|
37
|
+
font: 9px "arial narrow";
|
|
38
|
+
color: #000033
|
|
39
|
+
}
|
|
40
|
+
.cn
|
|
41
|
+
{
|
|
42
|
+
font: 9px arial;
|
|
43
|
+
color: black
|
|
44
|
+
}
|
|
45
|
+
.bc
|
|
46
|
+
{
|
|
47
|
+
font: bold 22px arial;
|
|
48
|
+
color: #000000
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.cut{width:665px;height:1px;border-top:dashed 1px #000}
|
|
52
|
+
.Ac{text-align:center}
|
|
53
|
+
.Ar{text-align:right}
|
|
54
|
+
.Al{text-align:left}
|
|
55
|
+
.At{vertical-align:top}
|
|
56
|
+
.Ab{vertical-align:bottom}
|
|
57
|
+
.ct td, .cp td{padding-left:6px;border-left:solid 1px #000}
|
|
58
|
+
.cpN{font:bold 10px arial;color:black}
|
|
59
|
+
.ctN{font:9px "arial narrow";color:#000033}
|
|
60
|
+
.pL0{padding-left:0px}
|
|
61
|
+
.pL6{padding-left:6px}
|
|
62
|
+
.pL10{padding-left:10px}
|
|
63
|
+
.imgLogo{width:150px}
|
|
64
|
+
.imgLogo img{width:150px;height:40px}
|
|
65
|
+
.barra{width:2px;height:15px;;background-color:#000;}
|
|
66
|
+
.rBb td{border-bottom:solid 1px #000}
|
|
67
|
+
.BB{border-bottom:solid 1px #000}
|
|
68
|
+
.BL{border-left:solid 1px #000}
|
|
69
|
+
.BR{border-right:solid 1px #000}
|
|
70
|
+
.BT1{border-top:dashed 1px #000}
|
|
71
|
+
.BT2{border-top:solid 2px #000}
|
|
72
|
+
.h1{height:1px}
|
|
73
|
+
.h13{height:13px}
|
|
74
|
+
.h12{height:12px}
|
|
75
|
+
.h13 td{vertical-align:top}
|
|
76
|
+
.h12 td{vertical-align:top}
|
|
77
|
+
.w6{width:6px}
|
|
78
|
+
.w7{width:7px;}
|
|
79
|
+
.w34{width:34px}
|
|
80
|
+
.w45{width:45px}
|
|
81
|
+
.w53{width:53px}
|
|
82
|
+
.w62{width:62px}
|
|
83
|
+
.w65{width:65px}
|
|
84
|
+
.w72{width:72px}
|
|
85
|
+
.w83{width:83px}
|
|
86
|
+
.w88{width:88px}
|
|
87
|
+
.w104{width:104px}
|
|
88
|
+
.w105{width:105px}
|
|
89
|
+
.w106{width:106px}
|
|
90
|
+
.w113{width:113px}
|
|
91
|
+
.w112{width:112px}
|
|
92
|
+
.w123{width:123px}
|
|
93
|
+
.w126{width:126px}
|
|
94
|
+
.w128{width:128px}
|
|
95
|
+
.w132{width:132px}
|
|
96
|
+
.w134{width:134px}
|
|
97
|
+
.w150{width:150px}
|
|
98
|
+
.w163{width:163px}
|
|
99
|
+
.w164{width:164px}
|
|
100
|
+
.w180{width:180px}
|
|
101
|
+
.w182{width:182px}
|
|
102
|
+
.w186{width:186px}
|
|
103
|
+
.w192{width:192px}
|
|
104
|
+
.w250{width:250px}
|
|
105
|
+
.w298{width:298px}
|
|
106
|
+
.w409{width:409px}
|
|
107
|
+
.w472{width:472px}
|
|
108
|
+
.w478{width:478px}
|
|
109
|
+
.w500{width:500px}
|
|
110
|
+
.w544{width:544px}
|
|
111
|
+
.w564{width:564px}
|
|
112
|
+
.w659{width:659px}
|
|
113
|
+
.w666{width:666px}
|
|
114
|
+
.w667{width:667px}
|
|
115
|
+
.BHead td{border-bottom:solid 2px #000}
|
|
116
|
+
.EcdBar{height:50px;vertical-align:bottom}
|
|
117
|
+
.rc6 td{vertical-align:top;border-bottom:solid 1px #000;border-left:solid 1px #000}
|
|
118
|
+
.rc6 div{padding-left:6px}
|
|
119
|
+
.rc6 .t{font:9px "arial narrow";color:#000033;height:13px}
|
|
120
|
+
.rc6 .c{font:bold 10px arial;color:black;height:12px}
|
|
121
|
+
.mt23{margin-top:23px;}
|
|
122
|
+
.pb4{padding-bottom:14px;}
|
|
123
|
+
.ebc{width:4px;height:440px;border-right:dotted 1px #000000;margin-right:4px;}
|
|
124
|
+
<% if (barcode_render_engine == 'bmp') { %>
|
|
125
|
+
.barcode {
|
|
126
|
+
background-image: url(data:image/bmp;base64,<%= barcode_data %>);
|
|
127
|
+
background-repeat: repeat-y;
|
|
128
|
+
height: <%= barcode_height %>px;
|
|
129
|
+
}
|
|
130
|
+
<% } else if (barcode_render_engine == 'img') { %>
|
|
131
|
+
.barcode {
|
|
132
|
+
height: <%= barcode_height %>px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.barcode-line {
|
|
136
|
+
height: inherit;
|
|
137
|
+
display: inline-block;
|
|
138
|
+
float: left;
|
|
139
|
+
}
|
|
140
|
+
<% } %>
|
|
141
|
+
@media print
|
|
142
|
+
{
|
|
143
|
+
* {-webkit-print-color-adjust:exact;}
|
|
144
|
+
.no-print, .no-print *
|
|
145
|
+
{
|
|
146
|
+
display: none !important;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</style>
|
|
150
|
+
</head>
|
|
151
|
+
<body>
|
|
152
|
+
<div>
|
|
153
|
+
<table class="w666">
|
|
154
|
+
<tr class="cpN">
|
|
155
|
+
<td class="At Ac">Instruções de Impressão</td>
|
|
156
|
+
</tr>
|
|
157
|
+
<tr class="ti">
|
|
158
|
+
<td class="At Ac">Imprimir em impressora jato de tinta (ink jet) ou laser em qualidade normal. (Não use modo econômico).<br>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) - Corte na linha indicada<br></td>
|
|
159
|
+
</tr>
|
|
160
|
+
<tr class="ti">
|
|
161
|
+
<td class="At Ac">
|
|
162
|
+
<br/>
|
|
163
|
+
<form>
|
|
164
|
+
<input class="no-print" type="button" value="Clique aqui para imprimir" onclick="window.print();return false;" />
|
|
165
|
+
</form>
|
|
166
|
+
</td>
|
|
167
|
+
</tr>
|
|
168
|
+
</table><br /><table class="w666">
|
|
169
|
+
<tr>
|
|
170
|
+
<td class="ctN cut" />
|
|
171
|
+
</tr>
|
|
172
|
+
<tr>
|
|
173
|
+
<td class="cpN Ar">Recibo do Pagador</td>
|
|
174
|
+
</tr>
|
|
175
|
+
</table><br /><table class="w666">
|
|
176
|
+
<tr class="BHead">
|
|
177
|
+
<td class="imgLogo Al"><img src="<%= logoURL %>" /></td>
|
|
178
|
+
<td class="barra"></td>
|
|
179
|
+
<td class="w72 Ab bc Ac"><%= boleto['codigo_banco'] %></td>
|
|
180
|
+
<td class="barra"></td>
|
|
181
|
+
<td class="w500 Ar Ab ld" id="linha-digitavel-1"><%= boleto['linha_digitavel'] %></td>
|
|
182
|
+
</tr>
|
|
183
|
+
</table><table class="w666">
|
|
184
|
+
<tr class="ct h13 At">
|
|
185
|
+
<td class="w298">Beneficiário</td>
|
|
186
|
+
<td class="w126">Agência / Código do Beneficiário</td>
|
|
187
|
+
<td class="w34">Espécie</td>
|
|
188
|
+
<td class="w45">Quantidade</td>
|
|
189
|
+
<td class="w128">Carteira / Nosso número</td>
|
|
190
|
+
</tr>
|
|
191
|
+
<tr class="cp h12 At rBb">
|
|
192
|
+
<td><%= boleto['cedente'] %></td>
|
|
193
|
+
<td><%= boleto['agencia'] %>/<%= boleto['codigo_cedente'] %></td>
|
|
194
|
+
<td>R$</td>
|
|
195
|
+
<td></td>
|
|
196
|
+
<td class="Ar"><%= addTrailingZeros(boleto['nosso_numero'], 12) %>-<%= boleto['nosso_numero_dv'] %></td>
|
|
197
|
+
</tr>
|
|
198
|
+
</table><table class="w666">
|
|
199
|
+
<tr class="ct h13">
|
|
200
|
+
<td class="w192">Número do documento</td>
|
|
201
|
+
<td class="w132">CPF/CNPJ</td>
|
|
202
|
+
<td class="w134">Vencimento</td>
|
|
203
|
+
<td class="w180">Valor documento</td>
|
|
204
|
+
</tr>
|
|
205
|
+
<tr class="cp h12 rBb">
|
|
206
|
+
<td><%= addTrailingZeros(boleto['numero_documento'], 9) %></td>
|
|
207
|
+
<td><%= boleto['cedente_cnpj'] %></td>
|
|
208
|
+
<td><%= formatDate(boleto['data_vencimento']) %></td>
|
|
209
|
+
<td class="Ar"><%= formatAmount(boleto['valor']) %></td>
|
|
210
|
+
</tr>
|
|
211
|
+
</table><table class="w666">
|
|
212
|
+
<tr class="ct h13">
|
|
213
|
+
<td class="w113">(-) Desconto / Abatimentos</td>
|
|
214
|
+
<td class="w112">(-) Outras deduções</td>
|
|
215
|
+
<td class="w113">(+) Mora / Multa</td>
|
|
216
|
+
<td class="w113">(+) Outros acréscimos</td>
|
|
217
|
+
<td class="w180">(=) Valor cobrado</td>
|
|
218
|
+
</tr>
|
|
219
|
+
<tr class="cp h12 rBb Ab">
|
|
220
|
+
<td></td>
|
|
221
|
+
<td></td>
|
|
222
|
+
<td></td>
|
|
223
|
+
<td></td>
|
|
224
|
+
<td class="Ar"> </td>
|
|
225
|
+
</tr>
|
|
226
|
+
</table><table class="w666">
|
|
227
|
+
<tr class="ct h13">
|
|
228
|
+
<td class="w659">Pagador</td>
|
|
229
|
+
</tr>
|
|
230
|
+
<tr class="cp h12">
|
|
231
|
+
<td><%- boleto['pagador'] || '' %></td>
|
|
232
|
+
</tr>
|
|
233
|
+
<tr class="cp h12 rBb">
|
|
234
|
+
<td></td>
|
|
235
|
+
</tr>
|
|
236
|
+
</table><table class="w666">
|
|
237
|
+
<tr class="ctN h13">
|
|
238
|
+
<td class="pL6">Instruções</td>
|
|
239
|
+
<td class="w180 Ar">Autenticação mecânica</td>
|
|
240
|
+
</tr>
|
|
241
|
+
<tr class="cpN h12">
|
|
242
|
+
<td class="pL6"><%- boleto['instrucoes'] || '' %></td>
|
|
243
|
+
<td class="pL6 Ar"></td>
|
|
244
|
+
</tr>
|
|
245
|
+
</table><table class="ctN w666">
|
|
246
|
+
<tr class="h13"><td /></tr>
|
|
247
|
+
<tr class="h13"><td /></tr>
|
|
248
|
+
<tr><td class="Ar">Corte na linha pontilhada</td></tr>
|
|
249
|
+
<tr><td class="cut" /></tr>
|
|
250
|
+
<tr class="h13"><td /></tr>
|
|
251
|
+
<tr class="h13"><td /></tr>
|
|
252
|
+
</table><table class="w666">
|
|
253
|
+
<tr class="BHead">
|
|
254
|
+
<td class="imgLogo Al"><img src="<%= logoURL %>" /></td>
|
|
255
|
+
<td class="barra"></td>
|
|
256
|
+
<td class="w72 Ab bc Ac"><%= boleto['codigo_banco'] %></td>
|
|
257
|
+
<td class="barra"></td>
|
|
258
|
+
<td class="w500 Ar Ab ld" id="linha-digitavel-2"><%= boleto['linha_digitavel'] %></td>
|
|
259
|
+
</tr>
|
|
260
|
+
</table><table class="w666">
|
|
261
|
+
<tr class="ct h13">
|
|
262
|
+
<td class="w472">Local de pagamento</td>
|
|
263
|
+
<td class="w180">Vencimento</td>
|
|
264
|
+
</tr>
|
|
265
|
+
<tr class="cp h12 rBb">
|
|
266
|
+
<td><%= boleto['local_de_pagamento'] %></td>
|
|
267
|
+
<td class="Ar"><%= formatDate(boleto['data_vencimento']) %></td>
|
|
268
|
+
</tr>
|
|
269
|
+
</table><table class="w666">
|
|
270
|
+
<tr class="ct h13">
|
|
271
|
+
<td class="w472">Beneficiário</td>
|
|
272
|
+
<td class="w180">Agência / Código beneficiário</td>
|
|
273
|
+
</tr>
|
|
274
|
+
<tr class="cp h12 rBb">
|
|
275
|
+
<td><%= boleto['cedente'] %></td>
|
|
276
|
+
<td class="Ar"><%= boleto['agencia'] %>/<%= boleto['codigo_cedente'] %></td>
|
|
277
|
+
</tr>
|
|
278
|
+
</table><table class="w666">
|
|
279
|
+
<tr class="ct h13">
|
|
280
|
+
<td class="w113">Data do documento</td>
|
|
281
|
+
<td class="w163">N<u>o</u> documento</td>
|
|
282
|
+
<td class="w62">Espécie doc.</td>
|
|
283
|
+
<td class="w34">Aceite</td>
|
|
284
|
+
<td class="w72">Data processamento</td>
|
|
285
|
+
<td class="w180">Carteira / Nosso número</td>
|
|
286
|
+
</tr>
|
|
287
|
+
<tr class="cp h12 rBb">
|
|
288
|
+
<td><%= formatDate(boleto['data_emissao']) %></td>
|
|
289
|
+
<td><%= addTrailingZeros(boleto['numero_documento'], 9) %></td>
|
|
290
|
+
<td>DM</td>
|
|
291
|
+
<td>N</td>
|
|
292
|
+
<td><%= formatDate(boleto['data_emissao']) %></td>
|
|
293
|
+
<td class="Ar"><%= addTrailingZeros(boleto['nosso_numero'], 12) %>-<%= boleto['nosso_numero_dv'] %></td>
|
|
294
|
+
</tr>
|
|
295
|
+
</table><table class="w666">
|
|
296
|
+
<tr class="ct h13">
|
|
297
|
+
<td class="w113">Uso do banco</td>
|
|
298
|
+
<td class="w83">Carteira</td>
|
|
299
|
+
<td class="w53">Espécie</td>
|
|
300
|
+
<td class="w123">Quantidade</td>
|
|
301
|
+
<td class="w72">(x) Valor</td>
|
|
302
|
+
<td class="w180">(=) Valor documento</td>
|
|
303
|
+
</tr>
|
|
304
|
+
<tr class="cp h12 rBb">
|
|
305
|
+
<td> </td>
|
|
306
|
+
<td class="Al"><%= boleto['carteira'] %></td>
|
|
307
|
+
<td class="Al">R$</td>
|
|
308
|
+
<td></td>
|
|
309
|
+
<td></td>
|
|
310
|
+
<td class="Ar"><%= formatAmount(boleto['valor']) %></td>
|
|
311
|
+
</tr>
|
|
312
|
+
</table><table class="w666">
|
|
313
|
+
<tr class="rc6">
|
|
314
|
+
<td class="w478">
|
|
315
|
+
<div class="ctN pL10">Instruções (Texto de responsabilidade do beneficiário)</div>
|
|
316
|
+
<div class="cpN pL10"><%- boleto['instrucoes'] || '' %></div>
|
|
317
|
+
</td>
|
|
318
|
+
<td class="w186">
|
|
319
|
+
<div class="t">(-) Desconto / Abatimentos</div>
|
|
320
|
+
<div class="c BB"></div>
|
|
321
|
+
<div class="t">(-) Outras deduções</div>
|
|
322
|
+
<div class="c BB"></div>
|
|
323
|
+
<div class="t">(+) Mora / Multa</div>
|
|
324
|
+
<div class="c BB"></div>
|
|
325
|
+
<div class="t">(+) Outros acréscimos</div>
|
|
326
|
+
<div class="c BB"></div>
|
|
327
|
+
<div class="t">(=) Valor cobrado</div>
|
|
328
|
+
<div class="c"></div>
|
|
329
|
+
</td>
|
|
330
|
+
</tr>
|
|
331
|
+
</table><table class="w666">
|
|
332
|
+
<tr class="ct h13">
|
|
333
|
+
<td class="w659">Pagador</td>
|
|
334
|
+
</tr>
|
|
335
|
+
<tr class="cp h12">
|
|
336
|
+
<td class="At"><%- boleto['pagador'] || '' %></td>
|
|
337
|
+
</tr>
|
|
338
|
+
</table><table class="w666">
|
|
339
|
+
<tr class="rBb">
|
|
340
|
+
<td class="w478 BL">
|
|
341
|
+
<div class="cpN pL6"></div>
|
|
342
|
+
</td>
|
|
343
|
+
<td class="Ab BL">
|
|
344
|
+
<div class="ctN pL6">Cód. baixa</div>
|
|
345
|
+
</td>
|
|
346
|
+
</tr>
|
|
347
|
+
</table><table class="w666 ctN">
|
|
348
|
+
<tr>
|
|
349
|
+
<td class="pL6 w409">Sacador / Avalista</td>
|
|
350
|
+
<td class="w250 Ar">Autenticação mecânica - <b class="cpN">Ficha de Compensação</b></td>
|
|
351
|
+
</tr>
|
|
352
|
+
<tr class="h13"><td colspan="3" /></tr>
|
|
353
|
+
</table><table class="w666">
|
|
354
|
+
<tr>
|
|
355
|
+
<td class="EcdBar Al pL10">
|
|
356
|
+
<% if (barcode_render_engine == 'bmp') { %>
|
|
357
|
+
<div class="barcode"/>
|
|
358
|
+
<% } else if (barcode_render_engine == 'img') { %>
|
|
359
|
+
<div class="barcode">
|
|
360
|
+
<% var black = true; %>
|
|
361
|
+
|
|
362
|
+
<% for(var i = 0; i < barcode_data.length; i++) { %>
|
|
363
|
+
<% var pixelsToDraw = (barcode_data[i] == "0") ? 1 : 3; %>
|
|
364
|
+
<img class="barcode-line" src="https://assets.pagar.me/boleto/images/<%= black ? 'b' : 'w' %>.png" height="<%= barcode_height %>px" width="<%= pixelsToDraw %>px;" border=0/>
|
|
365
|
+
<% black = !black; %>
|
|
366
|
+
<% } %>
|
|
367
|
+
</div>
|
|
368
|
+
<% } %>
|
|
369
|
+
</td>
|
|
370
|
+
</tr>
|
|
371
|
+
</table><table class="ctN w666">
|
|
372
|
+
<tr class="h13"><td /></tr>
|
|
373
|
+
<tr><td class="Ar">Corte na linha pontilhada</td></tr>
|
|
374
|
+
<tr><td class="cut" /></tr>
|
|
375
|
+
</table>
|
|
376
|
+
</div>
|
|
377
|
+
<script>
|
|
378
|
+
(function () {
|
|
379
|
+
var onLoadDocumentElement
|
|
380
|
+
var onLoadDocumentCopy
|
|
381
|
+
|
|
382
|
+
onDOMReady(function () {
|
|
383
|
+
onLoadDocumentCopy = document.body.children[0].outerHTML
|
|
384
|
+
onLoadDocumentElement = hashString(onLoadDocumentCopy);
|
|
385
|
+
|
|
386
|
+
onDOMChange(function () {
|
|
387
|
+
document.body.innerHTML = onLoadDocumentCopy;
|
|
388
|
+
})
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
function onDOMReady(callback) {
|
|
392
|
+
if (document.readyState === 'complete') return callback();
|
|
393
|
+
|
|
394
|
+
setTimeout(function () {
|
|
395
|
+
onDOMReady(callback);
|
|
396
|
+
}, 5);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function onDOMChange (callback) {
|
|
400
|
+
var childContent = document.body.children[0];
|
|
401
|
+
|
|
402
|
+
if (childContent) {
|
|
403
|
+
var currentDocumentElement = hashString(childContent.outerHTML);
|
|
404
|
+
|
|
405
|
+
if (onLoadDocumentElement !== currentDocumentElement) {
|
|
406
|
+
callback();
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
callback();
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
setTimeout(function () {
|
|
413
|
+
onDOMChange(callback);
|
|
414
|
+
}, 150);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function hashString (value) {
|
|
418
|
+
var hash = 0;
|
|
419
|
+
|
|
420
|
+
if (value.length === 0) return hash;
|
|
421
|
+
|
|
422
|
+
for (i = 0; i < value.length; i++) {
|
|
423
|
+
char = value.charCodeAt(i);
|
|
424
|
+
hash = ((hash<<5)-hash)+char;
|
|
425
|
+
hash = hash & hash // Convert to 32bit integer
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return hash;
|
|
429
|
+
}
|
|
430
|
+
})()
|
|
431
|
+
</script>
|
|
432
|
+
</body>
|
|
433
|
+
</html>
|