🔮 Vidente de Boleto is a web tool designed to decode, validate, and visualize Brazilian payment slips (Boletos). It supports both standard bank slips (Boletos Bancários) and collection slips (Boletos de Arrecadação/Convênio).
- Decodes Typeable Lines:
- 47 digits: Standard Bank Boletos (with Modulo 10 & 11 validation).
- 48 digits: Utility/Tax Boletos (Water, Light, Phone, etc.) with Modulo 10 or 11 validation based on the reference digit.
- Barcode Scanner: Uses the device camera to scan Interleaved 2 of 5 barcodes directly.
- Validation: Verifies check digits (DVs) for every block of the typeable line to ensure integrity.
- Visualization: Generates a visual barcode from the decoded numbers.
- Reversibility Check: Verifies if the barcode matches the typeable line perfectly.
- Date Calculation: Handles the "Fator de Vencimento" including the rollover logic for dates after February 2025.
The project was recently refactored for better organization:
src/main.js: Handles UI interactions, DOM manipulation, and camera setup.src/boleto.js: Contains the core business logic (parsing, calculation, validation) - Pure JavaScript, easily testable.src/style.css: Project styles.src/boleto.test.js: Unit tests for the business logic.
- Node.js installed.
- Clone the repository.
- Install dependencies:
npm install
Start the development server:
npm run devAccess the application at http://localhost:5173 (or the port shown in the terminal).
To verify the calculation logic:
npm test- Format:
AAABC.CCCCX DDDDD.DDDDDY EEEEE.EEEEEZ K UUUUVVVVVVVVVV - Validation:
- 3 blocks validated by Modulo 10.
- Global DV (K) validated by Modulo 11.
- Date Factor: cycles every 9000 days. This tool assumes factors corresponding to dates < 2024 belong to the new cycle starting Feb 2025.
- Format: 4 blocks of 12 numbers.
- Validation: Each block has its own DV (Modulo 10 or 11, defined by the 3rd digit of the line).
The project is configured for deployment on GitHub Pages.
npm run deploy