{"id":22546745,"url":"https://github.com/fonini/go-boleto-utils","last_synced_at":"2025-10-18T06:18:39.081Z","repository":{"id":264696377,"uuid":"612185161","full_name":"fonini/go-boleto-utils","owner":"fonini","description":"go-boleto-utils is a Go library for parsing and validation Brazilian boletos. 🧾 💰","archived":false,"fork":false,"pushed_at":"2025-02-24T08:20:26.000Z","size":48,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T18:54:13.022Z","etag":null,"topics":["boleto","brazil","go","go-modules","golang","hacktoberfest","library","money"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fonini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-10T11:36:09.000Z","updated_at":"2024-12-12T15:03:09.000Z","dependencies_parsed_at":"2024-11-25T20:38:11.175Z","dependency_job_id":"1da82425-a47e-4234-93b8-9cdfbb4d7d0c","html_url":"https://github.com/fonini/go-boleto-utils","commit_stats":null,"previous_names":["fonini/go-boleto-utils"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fonini%2Fgo-boleto-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fonini%2Fgo-boleto-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fonini%2Fgo-boleto-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fonini%2Fgo-boleto-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fonini","download_url":"https://codeload.github.com/fonini/go-boleto-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248069563,"owners_count":21042665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boleto","brazil","go","go-modules","golang","hacktoberfest","library","money"],"created_at":"2024-12-07T15:08:46.915Z","updated_at":"2025-10-18T06:18:34.032Z","avatar_url":"https://github.com/fonini.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-boleto-utils\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/fonini/go-boleto-utils)](https://pkg.go.dev/github.com/fonini/go-boleto-utils)\n[![Test Status](https://github.com/fonini/go-boleto-utils/workflows/tests/badge.svg)](https://github.com/fonini/go-boleto-utils/actions?query=workflow%3Atests)\n[![codecov](https://codecov.io/github/fonini/go-boleto-utils/graph/badge.svg?token=L8ZSJUCHFJ)](https://codecov.io/github/fonini/go-boleto-utils)\n[![Go Report Card](https://goreportcard.com/badge/github.com/fonini/go-boleto-utils?force=true)](https://goreportcard.com/report/github.com/fonini/go-boleto-utils)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## 📖 Overview\n\n`go-boleto-utils` is a comprehensive Go library designed to simplify working with Brazilian bank slips (boletos). This utility package provides robust parsing and validation functionalities for digitable lines and barcodes, making it easier for developers to integrate boleto-related operations into their Go applications.\n\n## 🛠 Features\n\n- 🔍 Parse digitable lines and barcodes\n- ✅ Validate boleto integrity\n- 🏦 Identify bank and boleto types\n- 🔢 Extract key financial details\n\n## 📋 Prerequisites\n\n- Go 1.16 or higher\n- Basic understanding of Brazilian banking document structures\n\n## 🚀 Installation\n\nInstall the library using Go modules with the following commands:\n\n```sh\ngo get -u github.com/fonini/go-boleto-utils/parser\ngo get -u github.com/fonini/go-boleto-utils/validator\n```\n\n## 🧰 Usage Examples\n\n### 1. Parsing a Digitable Line\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/fonini/go-boleto-utils/parser\"\n)\n\nfunc main() {\n    digitableLine := \"34191.75124 34567.871230 41234.560005 8 92850000026035\"\n    result, err := parser.Parse(digitableLine)\n    if err != nil {\n        fmt.Println(\"Error parsing the digitable line:\", err)\n        return\n    }\n    \n    fmt.Printf(\"Bank: %s (%s)\\n\", result.IssuerBankName, result.IssuerBankCode)\n    fmt.Printf(\"Amount: R$ %.2f\\n\", result.Amount)\n    fmt.Printf(\"Due Date: %s\\n\", result.DueDate.Format(\"2006-01-02\"))\n    fmt.Printf(\"Code Type: %s\\n\", result.CodeType) // DIGITABLE_LINE\n}\n```\n\n### 2. Using barcode\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/fonini/go-boleto-utils/parser\"\n)\n\nfunc main() {\n    barCode := \"74898992100000845361121577703702280000282105\"\n    result, err := parser.Parse(barCode)\n    if err != nil {\n        fmt.Println(\"Error parsing the barcode:\", err)\n        return\n    }\n\n    fmt.Printf(\"Bank: %s (%s)\\n\", result.IssuerBankName, result.IssuerBankCode)\n    fmt.Printf(\"Amount: R$ %.2f\\n\", result.Amount)\n    fmt.Printf(\"Due Date: %s\\n\", result.DueDate.Format(\"2006-01-02\"))\n    fmt.Printf(\"Code Type: %s\\n\", result.CodeType) // BARCODE\n}\n```\n\n### Parser Output Fields\n\n- `IssuerBankCode`: Numeric code of the issuing bank\n- `IssuerBankName`: Name of the issuing bank\n- `Currency`: Monetary representation code\n- `DueDate`: Expiration date of the bank slip\n- `Amount`: Total amount of the bank slip\n- `CodeType`: Type of the input code (DIGITABLE_LINE, BARCODE or UNKNOWN)\n\n### 3. Validating a Boleto\n\nQuickly validate the integrity of a boleto's digitable line:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/fonini/go-boleto-utils/validator\"\n)\n\nfunc main() {\n\tdigitableLine := \"34191.75124 34567.871230 41234.560005 8 92850000026035\"\n\n\tif validator.Validate(digitableLine) {\n\t\tfmt.Println(\"✅ The boleto is valid\")\n\t} else {\n\t\tfmt.Println(\"❌ The boleto is not valid\")\n\t}\n}\n```\n\n## 🔬 Helper methods\n\n### `GetBoletoType`\n\nDetermines boleto type.\n\n```go\nfunc GetBoletoType(code string) utils.BoletoType\n```\n\n#### Returns\n- `CREDIT_CARD`\n- `CITY_HALLS`\n- `SANITATION`\n- `ELECTRICITY_AND_GAS`\n- `GOVERNMENT_AGENCIES`\n- `TELECOMMUNICATIONS`\n- `PAYMENT_BOOKLETS`\n- `TRAFFIC_FINES`\n- `BANK`\n\n```go\ncode := \"00190500954014481606906809350314337370000000100\"\nboletoType := GetBoletoType(code)\n\nfmt.Println(boletoType) // BANK\n```\n\n\n### `GetCodeType`\n\nIdentifies payment code type (digitable line or barcode).\n\n```go\nfunc GetCodeType(code string) (utils.BoletoCodeType, error)\n```\n\n#### Returns\n- `DIGITABLE_LINE`\n- `BARCODE`\n- `UNKNOWN`\n\n##### Example\n\n```go\ncode := \"00190500954014481606906809350314337370000000100\"\ncodeType, err := GetCodeType(code)\nif err != nil {\n    fmt.Println(\"Error determining code type:\", err)\n} else {\n    fmt.Printf(\"The code type is: %s\\n\", codeType) // DIGITABLE_LINE\n}\n```\n\n## 🧪 Testing\n\nRun comprehensive tests using the following commands:\n\n```sh\n# Run all tests\ngo test ./...\n\n# Run tests for a specific package\ngo test ./validator\n\n# Run tests with verbose output\ngo test -v ./...\n```\n\n## 🏛️ Supported Banks\n\nWhile the library aims to support multiple Brazilian banks, please check the documentation for the most up-to-date list of supported institutions.\n\n## 🚧 Limitations\n\n- Focuses on parsing and validation\n- Does not handle boleto payment or generation\n- Requires well-formed digitable lines\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for complete details.\n\n## 📞 Contact\n\nFor issues, questions, or contributions, please open an issue on the GitHub repository.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffonini%2Fgo-boleto-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffonini%2Fgo-boleto-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffonini%2Fgo-boleto-utils/lists"}