Documentation ¶
Index ¶
- Constants
- func BoletoErrorConector(e *flow.ExchangeMessage, u flow.URI, params ...interface{}) error
- type Address
- type Agreement
- type Authentication
- type BankNumber
- type BoletoRequest
- type BoletoResponse
- type BoletoView
- type Buyer
- type ConfigBank
- type Document
- type ErrorResponse
- type Errors
- type FormatError
- type GatewayTimeout
- type HttpNotFound
- type IErrorResponse
- type IFormatError
- type IGatewayTimeout
- type IHttpNotFound
- type IServerError
- type InternalServerError
- type Link
- type Recipient
- type Rule
- type Title
- type Validator
Constants ¶
const ( // BancoDoBrasil constante do Banco do Brasil BancoDoBrasil = 1 // Santander constante do Santander Santander = 33 // Itau constante do Itau Itau = 341 // Bradesco constante do Bradesco Bradesco = 237 // Caixa constante do Caixa Caixa = 104 // Citibank constante do Citi Citibank = 745 )
const LogoBB = `` /* 20775-byte string literal not displayed */
const LogoCiti = `` /* 5767-byte string literal not displayed */
const LogoSantander = `` /* 6879-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func BoletoErrorConector ¶
func BoletoErrorConector(e *flow.ExchangeMessage, u flow.URI, params ...interface{}) error
BoletoErrorConector é um connector flow para criar um objeto de erro
Types ¶
type Address ¶
type Address struct { Street string `json:"street,omitempty"` Number string `json:"number,omitempty"` Complement string `json:"complement,omitempty"` ZipCode string `json:"zipCode,omitempty"` City string `json:"city,omitempty"` District string `json:"district,omitempty"` StateCode string `json:"stateCode,omitempty"` }
Address informações de entrada do endereço
type Agreement ¶
type Agreement struct { AgreementNumber uint `json:"agreementNumber,omitempty"` Wallet uint16 `json:"wallet,omitempty"` WalletVariation uint16 `json:"walletVariation,omitempty"` Agency string `json:"agency,omitempty"` AgencyDigit string `json:"agencyDigit,omitempty"` Account string `json:"account,omitempty"` AccountDigit string `json:"accountDigit,omitempty"` }
Agreement afiliação do cliente com o bano
func (*Agreement) CalculateAccountDigit ¶
CalculateAccountDigit calcula dígito da conta
func (*Agreement) CalculateAgencyDigit ¶
CalculateAgencyDigit calcula dígito da agência
func (*Agreement) IsAccountValid ¶
IsAccountValid retorna se é uma conta válida
func (*Agreement) IsAgencyValid ¶
IsAgencyValid retorna se é uma agência válida
type Authentication ¶
type Authentication struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` AuthorizationToken string `json:"authenticationToken,omitempty"` }
Authentication autenticação para entrada na API do banco
type BankNumber ¶
type BankNumber int
BankNumber número de identificação do banco
func (BankNumber) GetBoletoBankNumberAndDigit ¶
func (b BankNumber) GetBoletoBankNumberAndDigit() string
GetBoletoBankNumberAndDigit Retorna o numero da conta do banco do boleto
func (BankNumber) IsBankNumberValid ¶
func (b BankNumber) IsBankNumberValid() bool
IsBankNumberValid verifica se o banco enviado existe
type BoletoRequest ¶
type BoletoRequest struct { Authentication Authentication `json:"authentication"` Agreement Agreement `json:"agreement"` Title Title `json:"title"` Recipient Recipient `json:"recipient"` Buyer Buyer `json:"buyer"` BankNumber BankNumber `json:"bankNumber"` RequestKey string `json:"requestKey,omitempty"` }
BoletoRequest entidade de entrada para o boleto
type BoletoResponse ¶
type BoletoResponse struct { StatusCode int `json:"-"` Errors Errors `json:"errors,omitempty"` ID string `json:"id,omitempty"` DigitableLine string `json:"digitableLine,omitempty"` BarCodeNumber string `json:"barCodeNumber,omitempty"` OurNumber string `json:"ourNumber,omitempty"` Links []Link `json:"links,omitempty"` }
BoletoResponse entidade de saída para o boleto
type BoletoView ¶
type BoletoView struct { ID string UID string Format string `json:"format,omitempty"` BankLogo template.HTML `json:"bankLogo,omitempty"` Boleto BoletoRequest `json:"boleto,omitempty"` BankID BankNumber `json:"bankId,omitempty"` CreateDate time.Time `json:"createDate,omitempty"` BankNumber string `json:"bankNumber,omitempty"` DigitableLine string `json:"digitableLine,omitempty"` OurNumber string `json:"ourNumber,omitempty"` Barcode string `json:"barcode,omitempty"` Barcode64 string `json:"barcode64,omitempty"` Links []Link `json:"links,omitempty"` ConfigBank ConfigBank `json:"configBank,omitempty"` }
BoletoView contem as informações que serão preenchidas no boleto
func NewBoletoView ¶
func NewBoletoView(boleto BoletoRequest, response BoletoResponse) BoletoView
NewBoletoView cria um novo objeto view de boleto a partir de um boleto request, codigo de barras e linha digitavel
func (*BoletoView) CreateLinks ¶
func (b *BoletoView) CreateLinks() []Link
CreateLinks cria a lista de links com os formatos suportados
func (*BoletoView) EncodeURL ¶
func (b *BoletoView) EncodeURL(format string) string
EncodeURL tranforma o boleto view na forma que será escrito na url
func (BoletoView) ToJSON ¶
func (b BoletoView) ToJSON() string
ToJSON tranforma o boleto view em json
type Buyer ¶
type Buyer struct { Name string `json:"name,omitempty"` Document Document `json:"document,omitempty"` Address Address `json:"address,omitempty"` }
Buyer informações de entrada do comprador
type ConfigBank ¶
type ConfigBank struct { Logo string EspecieDoc string Aceite string Quantidade string ValorCotacao string }
func GetConfig ¶
func GetConfig(number BankNumber) ConfigBank
type Document ¶
type Document struct { Type string `json:"type,omitempty"` Number string `json:"number,omitempty"` }
Document nó com o tipo de documento e número do documento
func (*Document) ValidateCNPJ ¶
ValidateCNPJ verifica se é um CNPJ válido
func (*Document) ValidateCPF ¶
ValidateCPF verifica se é um CPF válido
type ErrorResponse ¶
type ErrorResponse struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` }
ErrorResponse objeto de erro
func NewErrorResponse ¶
func NewErrorResponse(code, msg string) ErrorResponse
NewErrorResponse cria um novo objeto de ErrorReponse com código e mensagem
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
func (ErrorResponse) ErrorCode ¶
func (e ErrorResponse) ErrorCode() string
ErrorCode retorna código do erro
type Errors ¶
type Errors []ErrorResponse
Errors coleção de erros
func NewErrorCollection ¶
func NewErrorCollection(errorResponse ErrorResponse) Errors
NewErrorCollection cria nova coleção de erros
func NewSingleErrorCollection ¶
NewSingleErrorCollection cria nova coleção de erros com 1 item
type FormatError ¶
type FormatError struct {
Err string
}
FormatError objeto para erros de input no request da API
func NewFormatError ¶
func NewFormatError(e string) FormatError
NewFormatError cria um novo objeto de FormatError com descrição do erro
func (FormatError) Error ¶
func (e FormatError) Error() string
type GatewayTimeout ¶
GatewayTimeout objeto para erros 404 da aplicação: ex boleto não encontrado
func NewGatewayTimeout ¶
func NewGatewayTimeout(err, msg string) GatewayTimeout
NewGatewayTimeout cria um novo objeto NewGatewayTimeout a partir de uma mensagem original e final
func (GatewayTimeout) Message ¶
func (e GatewayTimeout) Message() string
Message retorna a mensagem final para o usuário
type HttpNotFound ¶
HttpNotFound objeto para erros 404 da aplicação: ex boleto não encontrado
func NewHTTPNotFound ¶
func NewHTTPNotFound(err, msg string) HttpNotFound
NewHTTPNotFound cria um novo objeto NewHttpNotFound a partir de uma mensagem original e final
func (HttpNotFound) Message ¶
func (e HttpNotFound) Message() string
Message retorna a mensagem final para o usuário
type IErrorResponse ¶
IErrorResponse interface para implementar Error
type IFormatError ¶
type IFormatError interface {
Error() string
}
IFormatError interface para implementar Error
type IGatewayTimeout ¶
IGatewayTimeout interface para timeout
type IHttpNotFound ¶
IHttpNotFound interface para implementar Error
type IServerError ¶
IServerError interface para implementar Error
type InternalServerError ¶
InternalServerError objeto para erros internos da aplicação: ex banco de dados
func NewInternalServerError ¶
func NewInternalServerError(err, msg string) InternalServerError
NewInternalServerError cria um novo objeto InternalServerError a partir de uma mensagem original e final
func (InternalServerError) Error ¶
func (e InternalServerError) Error() string
Error retorna o erro original
func (InternalServerError) Message ¶
func (e InternalServerError) Message() string
Message retorna a mensagem final para o usuário
type Link ¶
type Link struct { Href string `json:"href,omitempty"` Rel string `json:"rel,omitempty"` Method string `json:"method,omitempty"` }
Link é um tipo padrão no restfull para satisfazer o HATEOAS
type Recipient ¶
type Recipient struct { Name string `json:"name,omitempty"` Document Document `json:"document,omitempty"` Address Address `json:"address,omitempty"` }
Recipient informações de entrada do comprador
type Rule ¶
type Rule func(interface{}) error
Rule é a regra que será adiciona a camada de validação
type Title ¶
type Title struct { CreateDate time.Time `json:"createDate,omitempty"` ExpireDateTime time.Time `json:"expireDateTime,omitempty"` ExpireDate string `json:"expireDate,omitempty"` AmountInCents uint64 `json:"amountInCents,omitempty"` OurNumber uint `json:"ourNumber,omitempty"` Instructions string `json:"instructions,omitempty"` DocumentNumber string `json:"documentNumber,omitempty"` NSU string `json:"nsu,omitempty"` }
Title título de cobrança de entrada
func (*Title) IsAmountInCentsValid ¶
IsAmountInCentsValid retorna um erro se o valor em centavos for inválido
func (*Title) IsExpireDateValid ¶
IsExpireDateValid retorna um erro se a data de expiração for inválida
func (*Title) ValidateDocumentNumber ¶
ValidateDocumentNumber número do documento
func (Title) ValidateInstructionsLength ¶
ValidateInstructionsLength valida se texto das instruções possui quantidade de caracteres corretos