boleto

package
v0.0.0-...-0d8fb42 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodBarrasLength                 int = 44
	CobrancaLinhaDigitavelLength    int = 47
	ArrecadacaoLinhaDigitavelLength int = 48
)

Variables

View Source
var ErrCodigoMoeda = &Error{"invalid_codigo_moeda"}
View Source
var ErrFatorVencimento = &Error{"invalid_fator_vencimento"}
View Source
var ErrInvalidDAC = &Error{"invalid_dac"}
View Source
var ErrInvalidDV = &Error{"invalid_digito_verificador"}
View Source
var ErrInvalidLength = &Error{"invalid_length"}
View Source
var ErrInvalidSegmento = &Error{"invalid_segmento"}
View Source
var ErrOnlyNumbers = &Error{"only_numbers"}

Functions

func FromBytes

func FromBytes(input []byte) (*Cobranca, *Arrecadacao, []Error)

func New

func New(input string) (*Cobranca, *Arrecadacao, []Error)

Types

type Arrecadacao

type Arrecadacao struct {
	CodigoBarras   CodigoBarras
	LinhaDigitavel LinhaDigitavel
	Segmento       fieldSegmento
}

type Cobranca

type Cobranca struct {
	CodigoBarras   CodigoBarras
	LinhaDigitavel LinhaDigitavel
	Moeda          CodMoeda
	Banco          fieldBanco
	Vencimento     fieldVencimento
	Valor          string
	DAC            string
}

type CodMoeda

type CodMoeda string
const (
	MoedaReal   CodMoeda = "real"
	MoedaOutras CodMoeda = "outras"
)

type CodigoBarras

type CodigoBarras []byte

type CodigoSegmento

type CodigoSegmento byte
const (
	CodSegmentoPrefeituras          CodigoSegmento = CodigoSegmento(b1)
	CodSegmentoSaneamento           CodigoSegmento = CodigoSegmento(b2)
	CodSegmentoEnergiaEGas          CodigoSegmento = CodigoSegmento(b3)
	CodSegmentoTelecom              CodigoSegmento = CodigoSegmento(b4)
	CodSegmentoOrgaosGovernamentais CodigoSegmento = CodigoSegmento(b5)
	CodSegmentoCarne                CodigoSegmento = CodigoSegmento(b6)
	CodSegmentoMultaTransito        CodigoSegmento = CodigoSegmento(b7)
	CodSegmentoExclusivoBanco       CodigoSegmento = CodigoSegmento(b9)
)

type Error

type Error struct {
	Code string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

type LinhaDigitavel

type LinhaDigitavel []byte

type Segmento

type Segmento string
const (
	SegmentoPrefeituras          Segmento = Segmento("Prefeituras")
	SegmentoSaneamento           Segmento = Segmento("Saneamento")
	SegmentoEnergiaEGas          Segmento = Segmento("Energia elétrica e gás")
	SegmentoTelecom              Segmento = Segmento("Telecomunicações")
	SegmentoOrgaosGovernamentais Segmento = Segmento("Órgaos governamentais")
	SegmentoCarne                Segmento = Segmento("Carnês")
	SegmentoMultaTransito        Segmento = Segmento("Multas de trânsito")
	SegmentoExclusivoBanco       Segmento = Segmento("Uso exclusivo do banco")
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL