Documentation ¶
Overview ¶
Package gateways contains the different interfaces to send the TicketBAI documents to.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnection = newError("connection") ErrValidation = newError("validation") ErrDuplicate = newError("duplicate") )
Standard gateway error responses. Keys match the ones from main package.
Functions ¶
This section is empty.
Types ¶
type ArabaConn ¶ added in v0.31.0
type ArabaConn struct {
// contains filtered or unexported fields
}
ArabaConn keeps all the connection details together for the Araba region.
type ArabaResponse ¶ added in v0.31.0
type ArabaResponse struct { Output struct { ID string `xml:"IdentificadoTBAI"` Data string `xml:"FechaRecepcion"` Status string `xml:"Estado"` Description string `xml:"Descripcion"` BasqueDescription string `xml:"Azalpena"` // Description, but in Basque Errors []struct { Code string `xml:"Codigo"` Description string `xml:"Descripcion"` BasqueDescription string `xml:"Azalpena"` } `xml:"ResultadosValidacion"` CSV string `xml:"CSV"` // Secure Verification Code } `xml:"Salida"` }
ArabaResponse defines the response fields from the Araba region.
type Connection ¶
type Connection interface { // Post sends the complete TicketBAI document to the remote end-point. We assume // the document has been fully prepared and signed. Post(ctx context.Context, doc *doc.TicketBAI) error Cancel(ctx context.Context, doc *doc.AnulaTicketBAI) error }
Connection defines what is expected from a connection to a gateway.
func New ¶
func New(env Environment, zone l10n.Code, cert *xmldsig.Certificate) (Connection, error)
New instantiates a new connection for the given zone and environment.
type EBizkaiaConn ¶
type EBizkaiaConn struct {
// contains filtered or unexported fields
}
EBizkaiaConn keeps all the connection details together for the Vizcaya region.
func (*EBizkaiaConn) Cancel ¶ added in v0.15.0
func (c *EBizkaiaConn) Cancel(ctx context.Context, doc *doc.AnulaTicketBAI) error
Cancel sends the cancellation request for the TickeBAI invoice to the remote end-point.
func (*EBizkaiaConn) Fetch ¶ added in v0.15.0
func (c *EBizkaiaConn) Fetch(ctx context.Context, nif, name, year string, page int, head *doc.CabeceraFactura) ([]*doc.TicketBAI, error)
Fetch retrieves the TicketBAI from the remote end-point for the given taxpayer and year. This is no longer used as it is only available in this region.
type Environment ¶ added in v0.15.0
type Environment string
Environment defines the environment to use for connections
const ( EnvironmentProduction Environment = "production" EnvironmentSandbox Environment = "sandbox" )
Environment to use for connections
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error allows for structured responses from the gateway to be able to response codes and messages.
func (*Error) Is ¶ added in v0.31.0
Is checks to see if the target error is the same as the current one or forms part of the chain.
type GipuzkoaConn ¶ added in v0.31.0
type GipuzkoaConn struct {
// contains filtered or unexported fields
}
GipuzkoaConn keeps all the connection details together for the Gipuzkoa region.
func (*GipuzkoaConn) Cancel ¶ added in v0.31.0
func (c *GipuzkoaConn) Cancel(ctx context.Context, doc *doc.AnulaTicketBAI) error
Cancel will send a request to the Gipuzkoa API to cancel a previously issued document.
type GipuzkoaResponse ¶ added in v0.31.0
type GipuzkoaResponse struct { Output struct { ID string `xml:"IdentificadoTBAI"` Data string `xml:"FechaRecepcion"` Status string `xml:"Estado"` Description string `xml:"Descripcion"` BasqueDescription string `xml:"Azalpena"` // Description, but in Basque Errors []struct { Code string `xml:"Codigo"` Description string `xml:"Descripcion"` BasqueDescription string `xml:"Azalpena"` } `xml:"ResultadosValidacion"` CSV string `xml:"CSV"` // Secure Verification Code } `xml:"Salida"` }
GipuzkoaResponse defines the response fields from the Gipuzkoa region.