Skip to content

MadeByTokens/videntedeboleto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image

Vidente de Boleto

🔮 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).

Features

  • 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.

Project Structure

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.

Getting Started

Prerequisites

  • Node.js installed.

Installation

  1. Clone the repository.
  2. Install dependencies:
    npm install

Running Locally

Start the development server:

npm run dev

Access the application at http://localhost:5173 (or the port shown in the terminal).

Running Tests

To verify the calculation logic:

npm test

Technical Details

Boleto Bancário (47 digits)

  • 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.

Boleto de Arrecadação (48 digits)

  • 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).

Deployment

The project is configured for deployment on GitHub Pages.

npm run deploy