@plasoft/boletos 1.0.40 → 1.0.41
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/build/index.js +42 -5
- package/build/index.mjs +42 -5
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -258,6 +258,9 @@ function gerarPDF(_0) {
|
|
|
258
258
|
return __async(this, arguments, function* ({ dados }) {
|
|
259
259
|
try {
|
|
260
260
|
const { generatePDF, dadosPDF } = dados;
|
|
261
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
262
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
263
|
+
}
|
|
261
264
|
const codigoBarra2 = yield import_bwip_js.default.toBuffer({
|
|
262
265
|
bcid: "interleaved2of5",
|
|
263
266
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -339,9 +342,15 @@ function gerarPDF(_0) {
|
|
|
339
342
|
};
|
|
340
343
|
} catch (error) {
|
|
341
344
|
console.log(error);
|
|
345
|
+
if (error instanceof Error) {
|
|
346
|
+
return {
|
|
347
|
+
erro: true,
|
|
348
|
+
dados: error.message
|
|
349
|
+
};
|
|
350
|
+
}
|
|
342
351
|
return {
|
|
343
352
|
erro: true,
|
|
344
|
-
dados:
|
|
353
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
345
354
|
};
|
|
346
355
|
}
|
|
347
356
|
});
|
|
@@ -1261,6 +1270,9 @@ function gerarPDF3(_0) {
|
|
|
1261
1270
|
return __async(this, arguments, function* ({ dados }) {
|
|
1262
1271
|
try {
|
|
1263
1272
|
const { generatePDF, dadosPDF } = dados;
|
|
1273
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
1274
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1275
|
+
}
|
|
1264
1276
|
const codigoBarra2 = yield import_bwip_js3.default.toBuffer({
|
|
1265
1277
|
bcid: "interleaved2of5",
|
|
1266
1278
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -1341,9 +1353,15 @@ function gerarPDF3(_0) {
|
|
|
1341
1353
|
};
|
|
1342
1354
|
} catch (error) {
|
|
1343
1355
|
console.log(error);
|
|
1356
|
+
if (error instanceof Error) {
|
|
1357
|
+
return {
|
|
1358
|
+
erro: true,
|
|
1359
|
+
dados: error.message
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1344
1362
|
return {
|
|
1345
1363
|
erro: true,
|
|
1346
|
-
dados:
|
|
1364
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
1347
1365
|
};
|
|
1348
1366
|
}
|
|
1349
1367
|
});
|
|
@@ -1425,7 +1443,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1425
1443
|
arquivo.add("0");
|
|
1426
1444
|
arquivo.add(pagador.cpfCnpj.padStart(14, "0"));
|
|
1427
1445
|
arquivo.add(removerAcentos(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
1428
|
-
arquivo.add(pagador.endereco.logradouro.substring(0, 40).padEnd(40, " "));
|
|
1446
|
+
arquivo.add(removerAcentos(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
1429
1447
|
arquivo.add("0".padEnd(11, "0"));
|
|
1430
1448
|
arquivo.add(" ");
|
|
1431
1449
|
arquivo.add(pagador.endereco.cep.padEnd(8, " "));
|
|
@@ -1853,6 +1871,9 @@ function gerarPDF4(_0) {
|
|
|
1853
1871
|
return __async(this, arguments, function* ({ dados }) {
|
|
1854
1872
|
try {
|
|
1855
1873
|
const { dadosPDF, generatePDF } = dados;
|
|
1874
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
1875
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1876
|
+
}
|
|
1856
1877
|
const codigoBarra2 = yield import_bwip_js4.default.toBuffer({
|
|
1857
1878
|
bcid: "interleaved2of5",
|
|
1858
1879
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -1935,9 +1956,16 @@ function gerarPDF4(_0) {
|
|
|
1935
1956
|
dados: pdfBase64
|
|
1936
1957
|
};
|
|
1937
1958
|
} catch (error) {
|
|
1959
|
+
console.log(error);
|
|
1960
|
+
if (error instanceof Error) {
|
|
1961
|
+
return {
|
|
1962
|
+
erro: true,
|
|
1963
|
+
dados: error.message
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1938
1966
|
return {
|
|
1939
1967
|
erro: true,
|
|
1940
|
-
dados:
|
|
1968
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
1941
1969
|
};
|
|
1942
1970
|
}
|
|
1943
1971
|
});
|
|
@@ -2141,6 +2169,9 @@ function gerarPDF5(_0) {
|
|
|
2141
2169
|
return __async(this, arguments, function* ({ dados }) {
|
|
2142
2170
|
try {
|
|
2143
2171
|
const { dadosPDF } = dados;
|
|
2172
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
2173
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
2174
|
+
}
|
|
2144
2175
|
const codigoBarra2 = yield import_bwip_js5.default.toBuffer({
|
|
2145
2176
|
bcid: "interleaved2of5",
|
|
2146
2177
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -2218,9 +2249,15 @@ function gerarPDF5(_0) {
|
|
|
2218
2249
|
};
|
|
2219
2250
|
} catch (error) {
|
|
2220
2251
|
console.log(error);
|
|
2252
|
+
if (error instanceof Error) {
|
|
2253
|
+
return {
|
|
2254
|
+
erro: true,
|
|
2255
|
+
dados: error.message
|
|
2256
|
+
};
|
|
2257
|
+
}
|
|
2221
2258
|
return {
|
|
2222
2259
|
erro: true,
|
|
2223
|
-
dados:
|
|
2260
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
2224
2261
|
};
|
|
2225
2262
|
}
|
|
2226
2263
|
});
|
package/build/index.mjs
CHANGED
|
@@ -221,6 +221,9 @@ function gerarPDF(_0) {
|
|
|
221
221
|
return __async(this, arguments, function* ({ dados }) {
|
|
222
222
|
try {
|
|
223
223
|
const { generatePDF, dadosPDF } = dados;
|
|
224
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
225
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
226
|
+
}
|
|
224
227
|
const codigoBarra2 = yield BwipJs.toBuffer({
|
|
225
228
|
bcid: "interleaved2of5",
|
|
226
229
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -302,9 +305,15 @@ function gerarPDF(_0) {
|
|
|
302
305
|
};
|
|
303
306
|
} catch (error) {
|
|
304
307
|
console.log(error);
|
|
308
|
+
if (error instanceof Error) {
|
|
309
|
+
return {
|
|
310
|
+
erro: true,
|
|
311
|
+
dados: error.message
|
|
312
|
+
};
|
|
313
|
+
}
|
|
305
314
|
return {
|
|
306
315
|
erro: true,
|
|
307
|
-
dados:
|
|
316
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
308
317
|
};
|
|
309
318
|
}
|
|
310
319
|
});
|
|
@@ -1224,6 +1233,9 @@ function gerarPDF3(_0) {
|
|
|
1224
1233
|
return __async(this, arguments, function* ({ dados }) {
|
|
1225
1234
|
try {
|
|
1226
1235
|
const { generatePDF, dadosPDF } = dados;
|
|
1236
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
1237
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1238
|
+
}
|
|
1227
1239
|
const codigoBarra2 = yield BwipJs3.toBuffer({
|
|
1228
1240
|
bcid: "interleaved2of5",
|
|
1229
1241
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -1304,9 +1316,15 @@ function gerarPDF3(_0) {
|
|
|
1304
1316
|
};
|
|
1305
1317
|
} catch (error) {
|
|
1306
1318
|
console.log(error);
|
|
1319
|
+
if (error instanceof Error) {
|
|
1320
|
+
return {
|
|
1321
|
+
erro: true,
|
|
1322
|
+
dados: error.message
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1307
1325
|
return {
|
|
1308
1326
|
erro: true,
|
|
1309
|
-
dados:
|
|
1327
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
1310
1328
|
};
|
|
1311
1329
|
}
|
|
1312
1330
|
});
|
|
@@ -1388,7 +1406,7 @@ function gerarRemessa3({ dados }) {
|
|
|
1388
1406
|
arquivo.add("0");
|
|
1389
1407
|
arquivo.add(pagador.cpfCnpj.padStart(14, "0"));
|
|
1390
1408
|
arquivo.add(removerAcentos(pagador.nome).substring(0, 40).padEnd(40, " "));
|
|
1391
|
-
arquivo.add(pagador.endereco.logradouro.substring(0, 40).padEnd(40, " "));
|
|
1409
|
+
arquivo.add(removerAcentos(pagador.endereco.logradouro).substring(0, 40).padEnd(40, " "));
|
|
1392
1410
|
arquivo.add("0".padEnd(11, "0"));
|
|
1393
1411
|
arquivo.add(" ");
|
|
1394
1412
|
arquivo.add(pagador.endereco.cep.padEnd(8, " "));
|
|
@@ -1816,6 +1834,9 @@ function gerarPDF4(_0) {
|
|
|
1816
1834
|
return __async(this, arguments, function* ({ dados }) {
|
|
1817
1835
|
try {
|
|
1818
1836
|
const { dadosPDF, generatePDF } = dados;
|
|
1837
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
1838
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
1839
|
+
}
|
|
1819
1840
|
const codigoBarra2 = yield BwipJs4.toBuffer({
|
|
1820
1841
|
bcid: "interleaved2of5",
|
|
1821
1842
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -1898,9 +1919,16 @@ function gerarPDF4(_0) {
|
|
|
1898
1919
|
dados: pdfBase64
|
|
1899
1920
|
};
|
|
1900
1921
|
} catch (error) {
|
|
1922
|
+
console.log(error);
|
|
1923
|
+
if (error instanceof Error) {
|
|
1924
|
+
return {
|
|
1925
|
+
erro: true,
|
|
1926
|
+
dados: error.message
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1901
1929
|
return {
|
|
1902
1930
|
erro: true,
|
|
1903
|
-
dados:
|
|
1931
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
1904
1932
|
};
|
|
1905
1933
|
}
|
|
1906
1934
|
});
|
|
@@ -2104,6 +2132,9 @@ function gerarPDF5(_0) {
|
|
|
2104
2132
|
return __async(this, arguments, function* ({ dados }) {
|
|
2105
2133
|
try {
|
|
2106
2134
|
const { dadosPDF } = dados;
|
|
2135
|
+
if (!dadosPDF.pagador.cnpj) {
|
|
2136
|
+
throw new Error("CPF/CNPJ do pagador na\u0303o informado!");
|
|
2137
|
+
}
|
|
2107
2138
|
const codigoBarra2 = yield BwipJs5.toBuffer({
|
|
2108
2139
|
bcid: "interleaved2of5",
|
|
2109
2140
|
text: dadosPDF.boleto.codigoBarra,
|
|
@@ -2181,9 +2212,15 @@ function gerarPDF5(_0) {
|
|
|
2181
2212
|
};
|
|
2182
2213
|
} catch (error) {
|
|
2183
2214
|
console.log(error);
|
|
2215
|
+
if (error instanceof Error) {
|
|
2216
|
+
return {
|
|
2217
|
+
erro: true,
|
|
2218
|
+
dados: error.message
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2184
2221
|
return {
|
|
2185
2222
|
erro: true,
|
|
2186
|
-
dados:
|
|
2223
|
+
dados: "Falha ao gerar impress\xE3o do boleto"
|
|
2187
2224
|
};
|
|
2188
2225
|
}
|
|
2189
2226
|
});
|