Documentation
¶
Index ¶
- Constants
- func BoletoErrorConector(e *flow.ExchangeMessage, u flow.URI, params ...interface{}) error
- func HasValidId(g *GetBoletoResult) bool
- func HasValidPublicKey(g *GetBoletoResult) bool
- type Address
- type Agreement
- type ArrayDataError
- type Authentication
- type BadGatewayError
- type BankNumber
- type BoletoRequest
- type BoletoResponse
- type BoletoView
- type Buyer
- type Credentials
- type Document
- type ErrorResponse
- type Errors
- type Fees
- type Fine
- type FormatError
- type GatewayTimeout
- type GetBoletoResult
- type HttpNotFound
- type IErrorResponse
- type Interest
- func (interest *Interest) HasAmountPerDayInCents() bool
- func (interest *Interest) HasDaysAfterExpirationDate() bool
- func (interest *Interest) HasExclusiveRateValues() bool
- func (interest *Interest) HasInterest() bool
- func (interest *Interest) HasPercentagePerMonth() bool
- func (interest *Interest) Validate() error
- type InternalServerError
- type Link
- type PayeeGuarantor
- type Recipient
- type Rule
- type Rules
- type Title
- type Token
- 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 //Real constante do REal Real = 9 // Pefisa constante do Pefisa Pefisa = 174 // Stone constante do Stone Stone = 197 JPMorgan = 376 )
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
func HasValidId ¶
func HasValidId(g *GetBoletoResult) bool
func HasValidPublicKey ¶
func HasValidPublicKey(g *GetBoletoResult) bool
HasValidPublicKey Verifica se a chave pública para buscar um boleto está presente e se é um hexadecimal
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 ArrayDataError ¶
type ArrayDataError struct {
Error []ErrorResponse `json:"error"`
}
DataError objeto de erro
type Authentication ¶
type Authentication struct { Username string `json:"Username,omitempty"` Password string `json:"Password,omitempty"` AuthorizationToken string `json:"AuthorizationToken,omitempty"` AccessKey string `json:"AccessKey,omitempty"` }
Authentication autenticação para entrada na API do banco
type BadGatewayError ¶
type BadGatewayError ErrorResponse
BadGatewayError interface para implementar Error
func NewBadGatewayError ¶
func NewBadGatewayError(e string) BadGatewayError
NewBadGatewayError cria um novo objeto de BadGatewayError com descrição do erro
func (BadGatewayError) ErrorCode ¶
func (e BadGatewayError) ErrorCode() string
ErrorCode Retorna um erro code
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"` PayeeGuarantor *PayeeGuarantor `json:"payeeGuarantor,omitempty"` Buyer Buyer `json:"buyer"` BankNumber BankNumber `json:"bankNumber"` RequestKey string `json:"requestKey,omitempty"` }
BoletoRequest entidade de entrada para o boleto
func (BoletoRequest) HasPayeeGuarantor ¶
func (b BoletoRequest) HasPayeeGuarantor() bool
HasPayeeGuarantor verify if PayeeGuarantor is not nil
func (BoletoRequest) MaskBoletoRequest ¶
func (b BoletoRequest) MaskBoletoRequest() BoletoRequest
MaskBoletoRequest Retorna um BoletoRequest com os campos sensiveis mascarados
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
func ErrorResponseToClient ¶
func ErrorResponseToClient() BoletoResponse
func GetBoletoResponseError ¶
func GetBoletoResponseError(code, message string) BoletoResponse
GetBoletoResponseError Retorna um BoletoResponse com um erro específico
func (*BoletoResponse) HasErrors ¶
func (b *BoletoResponse) HasErrors() bool
HasErrors verify if Response has any error
type BoletoView ¶
type BoletoView struct { ID primitive.ObjectID `bson:"_id,omitempty"` UID string `json:"uid,omitempty"` SecretKey string `json:"secretkey,omitempty"` PublicKey string `json:"publickey,omitempty"` Format string `json:"format,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"` }
BoletoView contem as informações que serão preenchidas no boleto
func NewBoletoView ¶
func NewBoletoView(boleto BoletoRequest, response BoletoResponse, bankName string) 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) GeneratePublicKey ¶
func (b *BoletoView) GeneratePublicKey()
GeneratePublicKey Gera a chave pública criptografada para geração da URL do boleto
func (BoletoView) ToJSON ¶
func (b BoletoView) ToJSON() string
ToJSON tranforma o boleto view em json
func (BoletoView) ToMinifyJSON ¶
func (b BoletoView) ToMinifyJSON() string
ToMinifyJSON converte um model BoletoView para um JSON/STRING
type Buyer ¶
type Buyer struct { Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` Document Document `json:"document,omitempty"` Address Address `json:"address,omitempty"` }
Buyer informações de entrada do comprador
type Credentials ¶
type Credentials struct { ID primitive.ObjectID `bson:"_id,omitempty"` UserKey string Username string `bson:"username,omitempty"` Password string `bson:"password,omitempty"` }
Credentials Credenciais para requisição de Registro de Boleto
func NewCredentials ¶
func NewCredentials(k, p string) *Credentials
NewCredentials Cria uma instância de Credential
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 Fees ¶
type Fees struct { Fine *Fine `json:"fine,omitempty"` Interest *Interest `json:"interest,omitempty"` }
func (*Fees) HasInterest ¶
HasInterest Verifica se o nó de interest está preenchido
type Fine ¶
type Fine struct { DaysAfterExpirationDate uint `json:"daysAfterExpirationDate,omitempty"` AmountInCents uint64 `json:"amountInCents,omitempty"` PercentageOnTotal float64 `json:"percentageOnTotal,omitempty"` }
Fine Representa as informações sobre Multa
func (*Fine) HasAmountInCents ¶
HasAmountInCents Verifica se há AmountInCents
func (*Fine) HasDaysAfterExpirationDate ¶
HasDaysAfterExpirationDate Verifica se há DaysAfterExpirationDate
func (*Fine) HasExclusiveRateValues ¶
HasExclusiveRateValues Verifica se foram informados os valores reverente a multa de forma exclusiva
func (*Fine) HasPercentageOnTotal ¶
HasPercentageOnTotal Verifica se há PercentageOnTotal
type FormatError ¶
type FormatError ErrorResponse
FormatError interface para implementar Error
func NewFormatError ¶
func NewFormatError(e string) FormatError
NewFormatError cria um novo objeto de FormatError com descrição do erro
func (FormatError) ErrorCode ¶
func (e FormatError) ErrorCode() string
ErrorCode Retorna um erro code
type GatewayTimeout ¶
type GatewayTimeout ErrorResponse
GatewayTimeout objeto para erros 404 da aplicação: ex boleto não encontrado
func NewGatewayTimeout ¶
func NewGatewayTimeout(code, msg string) GatewayTimeout
NewGatewayTimeout cria um novo objeto NewGatewayTimeout a partir de uma mensagem original e final
type GetBoletoResult ¶
type GetBoletoResult struct { Id string Format string PublicKey string URI string BoletoSource string TotalElapsedTimeInMilliseconds int64 CacheElapsedTimeInMilliseconds int64 DatabaseElapsedTimeInMilliseconds int64 ErrorResponse BoletoResponse LogSeverity string }
GetBoletoResult Centraliza as informações da operação GetBoleto
func NewGetBoletoResult ¶
func NewGetBoletoResult(c *gin.Context) *GetBoletoResult
func (*GetBoletoResult) HasValidParameters ¶
func (g *GetBoletoResult) HasValidParameters() bool
func (*GetBoletoResult) SetErrorResponse ¶
func (g *GetBoletoResult) SetErrorResponse(c *gin.Context, err ErrorResponse, statusCode int)
SetErrorResponse Insere as informações de erro para resposta
type HttpNotFound ¶
type HttpNotFound ErrorResponse
HttpNotFound interface para implementar Error
func NewHTTPNotFound ¶
func NewHTTPNotFound(code, msg string) HttpNotFound
NewHTTPNotFound cria um novo objeto NewHttpNotFound a partir de uma mensagem original e final
func (HttpNotFound) ErrorCode ¶
func (e HttpNotFound) ErrorCode() string
ErrorCode Message retorna a mensagem final para o usuário
type IErrorResponse ¶
IErrorResponse interface para implementar Error
type Interest ¶
type Interest struct { DaysAfterExpirationDate uint `json:"daysAfterExpirationDate,omitempty"` AmountPerDayInCents uint64 `json:"amountPerDayInCents,omitempty"` PercentagePerMonth float64 `json:"percentagePerMonth,omitempty"` }
Interest Representa as informações sobre juros
func (*Interest) HasAmountPerDayInCents ¶
HasAmountPerDayInCents Verifica se há AmountPerDayInCents
func (*Interest) HasDaysAfterExpirationDate ¶
HasDaysAfterExpirationDate Verifica se há DaysAfterExpirationDate
func (*Interest) HasExclusiveRateValues ¶
HasExclusiveRateValues Verifica se foi informados os valores reverente aos juros de forma exclusiva
func (*Interest) HasInterest ¶
HasInterest Verifica se algum dado de juros está preenchido
func (*Interest) HasPercentagePerMonth ¶
HasPercentagePerMonth Verifica se há PercentagePerMonth
type InternalServerError ¶
type InternalServerError ErrorResponse
InternalServerError IServerError interface para implementar Error
func NewInternalServerError ¶
func NewInternalServerError(code, 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) ErrorCode ¶
func (e InternalServerError) ErrorCode() string
ErrorCode 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 PayeeGuarantor ¶
type PayeeGuarantor struct { Name string `json:"name,omitempty"` Document Document `json:"document,omitempty"` }
PayeeGuarantor informações de entrada do lojista(sacador avalista)
func (PayeeGuarantor) HasName ¶
func (p PayeeGuarantor) HasName() bool
HasName diz se o Name está preenchido com algum valor
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 Rules ¶
type Rules struct { AcceptDivergentAmount bool `json:"acceptDivergentAmount"` MaxDaysToPayPastDue uint `json:"maxDaysToPayPastDue"` }
Rules Define regras de pagamento e baixa do título
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"` BoletoType string `json:"boletoType,omitempty"` Rules *Rules `json:"rules,omitempty"` Fees *Fees `json:"fees,omitempty"` BoletoTypeCode string }
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
type Token ¶
type Token struct { ClientID string `json:"clientid,omitempty"` IssuerBank string `json:"issuerbank,omitempty"` AccessToken string `json:"accesstoken,omitempty"` CreatedAt time.Time `json:"createdat"` }
Token represents a token used to access external resources The field CreatedAt is used by Mongo to control token TTL