gateways

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gateways contains the different interfaces to send the TicketBAI documents to.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnection       = errors.New("connection")
	ErrInvalidRequest   = errors.New("invalid request")
	ErrDuplicatedRecord = errors.New("duplicated record")
)

Standard gateway error responses

Functions

This section is empty.

Types

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, inv *bill.Invoice, doc *doc.TicketBAI) error
	Fetch(ctx context.Context, nif string, name string, year int, page int, head *doc.CabeceraFactura) ([]*doc.TicketBAI, error)
	Cancel(ctx context.Context, inv *bill.Invoice, doc *doc.AnulaTicketBAI) error
}

Connection defines what is expected from a connection to a gateway.

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, inv *bill.Invoice, 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 string, name string, year int, page int, head *doc.CabeceraFactura) ([]*doc.TicketBAI, error)

Fetch retrieves the TicketBAI from the remote end-point for the given taxpayer and year.

func (*EBizkaiaConn) Post

func (c *EBizkaiaConn) Post(ctx context.Context, inv *bill.Invoice, doc *doc.TicketBAI) error

Post sends the complete TicketBAI document to the remote end-point. We assume the document has been signed and prepared.

type Environment added in v0.15.0

type Environment string

Environment defines the environment to use for connections

const (
	EnvironmentProduction Environment = "production"
	EnvironmentTesting    Environment = "testing"
)

Environment to use for connections

type List

type List struct {
	// contains filtered or unexported fields
}

List keeps together the list of connections

func New

func New(env Environment, cert *xmldsig.Certificate) (*List, error)

New instantiates a new set of connections using the provided config.

func (*List) For

func (l *List) For(zone l10n.Code) Connection

For provides the connection needed for the given zone, or nil, if not supported.

func (*List) Register

func (l *List) Register(zone l10n.Code, c Connection)

Register adds a connection to use in a zone

Directories

Path Synopsis
Package ebizkaia provides a gatewy for generating and sending documents to the Bizkaia region.
Package ebizkaia provides a gatewy for generating and sending documents to the Bizkaia region.

Jump to

Keyboard shortcuts

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