Parsing and data extraction functions for boleto digitable lines.
Provides functions to convert between barcode and digitable line formats, and to extract structured information from boletos.
Parsing and data extraction functions for boleto digitable lines. Provides functions to convert between barcode and digitable line formats, and to extract structured information from boletos.
(barcode->linha-digitavel barcode)Converts a 44-digit barcode into a 47-digit digitable line.
Only works for bank boletos (bancário type). Inserts check digits for each of the three fields using modulo 10 algorithm.
Args: barcode - String containing 44-digit barcode (separators allowed)
Returns: 47-digit string with field check digits inserted, or nil if invalid
Examples: (barcode->linha-digitavel "23799123400000012345678901234567890123456789") ;; => "23799123456789012345678901234567890123456789012"
Converts a 44-digit barcode into a 47-digit digitable line. Only works for bank boletos (bancário type). Inserts check digits for each of the three fields using modulo 10 algorithm. Args: barcode - String containing 44-digit barcode (separators allowed) Returns: 47-digit string with field check digits inserted, or nil if invalid Examples: (barcode->linha-digitavel "23799123400000012345678901234567890123456789") ;; => "23799123456789012345678901234567890123456789012"
(parse-boleto digitable-line)Parses a 47-digit bank boleto and returns structured information.
Extracts bank code, currency, due date, value, and converts to barcode format. Only works for bank boletos (bancário type).
Args: digitable-line - String containing digitable line (may include formatting)
Returns: Map with keys:
Returns nil if input is invalid or not a bank boleto
Examples: (parse-boleto "23790.00000 00000.000000 00000.000000 0 12345678901234") ;; => {:bank-code "237" :bank-name "Banco Bradesco" ...}
Parses a 47-digit bank boleto and returns structured information.
Extracts bank code, currency, due date, value, and converts to barcode format.
Only works for bank boletos (bancário type).
Args:
digitable-line - String containing digitable line (may include formatting)
Returns:
Map with keys:
- :bank-code - 3-digit bank code
- :bank-name - Bank name (if known)
- :currency - Currency code (1 digit)
- :due-date-factor - Days since 1997-10-07
- :due-date - ISO date string (YYYY-MM-DD) or nil
- :value - Value in cents
- :barcode - 44-digit barcode
Returns nil if input is invalid or not a bank boleto
Examples:
(parse-boleto "23790.00000 00000.000000 00000.000000 0 12345678901234")
;; => {:bank-code "237" :bank-name "Banco Bradesco" ...}cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |