boleto

package module
v0.0.0-...-856381d Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: MIT Imports: 8 Imported by: 0

README

boleto

Billet generator for several Brazilian Banks for golang. See in GoDoc

Features
  • Supported banks: Banco do Brasil, Bradesco, Caixa, Itau and Santander;
  • Generates digitable number and barcode image;
  • FEBRABAN rules supported;
TODO
  • Create templates;
  • Create transmissions file;
Dependencies

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BB

type BB struct {
	Agency   int
	Account  int
	Convenio int
	Carteira int
	Company  Company
}

BB - Banco do Brasil Source: (http://www.bb.com.br/docs/pub/emp/mpe/espeboletobb.pdf)

func (BB) Barcode

func (b BB) Barcode(d Document) Barcode

Barcode Get the Barcode, creating a BarcodeNumber

func (BB) Layout

func (b BB) Layout(w http.ResponseWriter, d Document)

Layout return a HTML template using a document

func (BB) Transference

func (b BB) Transference(d Document)

Transference Return the transference file (arquivo de remessa)

type Bank

type Bank interface {
	Barcode(Document) Barcode
	Transference(Document)
	Layout(http.ResponseWriter, Document)
}

Bank is defined as an interface, then we force to implement these functions: @Barcode Get the BarcodeNumber @Transference Return the transference file (arquivo de remessa) @Layout return a HTML template using a document

type Barcode

type Barcode interface {
	Image() image.Image
	Digitable() string
	// contains filtered or unexported methods
}

Barcode is defined as an interface, then we force to implement these functions: @Image Return a image, using a BarcodeNumber @Digitable Get the barcode digitable, it may contain dots and spaces

type BarcodeNumber

type BarcodeNumber struct {
	// Codigo do banco int(3)
	BankId int
	// Codigo da moeda int(1)
	CurrencyId int
	// Fator de vencimento int(4)
	DateDueFactor int
	// Valor formatado int(10)
	Value int
	// Campo livre, numeros do banco com nosso numero string(25)
	BankNumbers string
	// Digito verificador do codigo de barras int(1)
	Dv int
}

Defines a barcode number type, holds numbers of the barcode

func (BarcodeNumber) Digitable

func (n BarcodeNumber) Digitable() string

Digitable mount the barcode digitable number, taking all BarcodeNumber fields together: Field 1: AAABC.CCCCX A = FEBRABAN Bank identifier B = the currency identifier C = 20-24 barcode numbers X = DV, using module10

Field 2: DDDDD.DDDDDX D = 25-34 barcode numbers X = DV, using module10

Field 3: EEEEE.EEEEEX E = 35-44 barcode numbers X = DV, using module10

Field 4: X X = DV, BarcodeNumber.Dv

Field 5: UUUUVVVVVVVVVV U = Due date factor V = Value

return AAABC.CCCCX DDDDD.DDDDDX EEEEE.EEEEEX X UUUUVVVVVVVVVV

func (BarcodeNumber) Image

func (n BarcodeNumber) Image() image.Image

Image return a image.Image, using a BarcodeNumber

type Bradesco

type Bradesco struct {
	Agency   int
	Account  int
	Carteira int
	Company  Company
}

Bradesco Source: (https://banco.bradesco/assets/pessoajuridica/pdf/4008-524-0121-08-layout-cobranca-versao-portuguesSS28785.pdf)

func (Bradesco) Barcode

func (b Bradesco) Barcode(d Document) Barcode

Barcode Get the Barcode, creating a BarcodeNumber

func (Bradesco) Layout

func (b Bradesco) Layout(w http.ResponseWriter, d Document)

Layout return a HTML template using a document

func (Bradesco) Transference

func (b Bradesco) Transference(d Document)

Transference Return the transference file (arquivo de remessa)

type Caixa

type Caixa struct {
	Agency   int
	Account  int
	Carteira string
	Company  Company
}

CEF - Caixa econômica federal - Modelo SIGCB Source: (http://www.caixa.gov.br/Downloads/cobranca-caixa/ESP_COD_BARRAS_SIGCB_COBRANCA_CAIXA.pdf)

func (Caixa) Barcode

func (b Caixa) Barcode(d Document) Barcode

Barcode Get the Barcode, creating a BarcodeNumber

func (Caixa) Layout

func (b Caixa) Layout(w http.ResponseWriter, d Document)

Layout return a HTML template using a document

func (Caixa) Transference

func (b Caixa) Transference(d Document)

Transference Return the transference file (arquivo de remessa)

type Company

type Company struct {
	Name      string
	LegalName string
	Document  string
	Address   string
	Contact   string
}

Defines a company type, holds the data of the emissor @LegalName the 'Razão social' of your company

type Document

type Document struct {
	Id            int
	Date          time.Time
	DateDue       time.Time
	Value         int
	ValueTax      int
	ValueDiscount int
	ValueForfeit  int
	OurNumber     int
	FebrabanType  string
	Instructions  [6]string
	Payer         Payer
}

Defines a document type, holds the data of the billet itself @Id identifier of your program orders/payments @FebrabanType is the document type according FEBRABAN, the default used is "DM" (Duplicata mercantil), Source: (http://www.bb.com.br/docs/pub/emp/empl/dwn/011DescrCampos.pdf) @Value valor do boleto @ValueTax taxa do boleto @ValueDiscount abatimento/desconto @ValueForfeit juros/multa @OurNumber Nosso numero

type Itau

type Itau struct {
	Agency     int
	Account    int
	Carteira   int
	ClientCode int
	Company    Company
}

Itau Source: (http://download.itau.com.br/bankline/cobranca_cnab240.pdf)

func (Itau) Barcode

func (b Itau) Barcode(d Document) Barcode

Barcode Get the Barcode, creating a BarcodeNumber

func (Itau) Layout

func (b Itau) Layout(w http.ResponseWriter, d Document)

Layout return a HTML template using a document

func (Itau) Transference

func (b Itau) Transference(d Document)

Transference Return the transference file (arquivo de remessa)

type Payer

type Payer struct {
	Name    string
	Address string
	Contact string
}

Defines a payer type, holds the data of, the person who carrier the billet

type Santander

type Santander struct {
	Agency   int
	Account  int
	Carteira int
	IOS      int
	Company  Company
}

Santander Source: (https://www.santander.com.br/document/wps/sl-tabela-de-tarifas-cobranca.pdf)

func (Santander) Barcode

func (b Santander) Barcode(d Document) Barcode

Barcode Get the Barcode, creating a BarcodeNumber

func (Santander) Layout

func (b Santander) Layout(w http.ResponseWriter, d Document)

Layout return a HTML template using a document

func (Santander) Transference

func (b Santander) Transference(d Document)

Transference Return the transference file (arquivo de remessa)

Jump to

Keyboard shortcuts

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