mydata

package module
v0.0.0-...-4ed90be Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

README

AADE myDATA API

Documentation

Documentation

Index

Constants

View Source
const (
	URLSendInvoices               = "/SendInvoices"
	URLRequestMyIncome            = "/RequestMyIncome"
	URLRequestMyExpenses          = "/RequestMyExpenses"
	URLRequestDocs                = "/RequestDocs"
	URLRequestTransmittedDocs     = "/RequestTransmittedDocs"
	URLSendIncomeClassification   = "/SendIncomeClassification"
	URLSendExpensesClassification = "/SendExpensesClassification"
	URLCancelInvoice              = "/CancelInvoice"
	URLSendPaymentsMethod         = "/SendPaymentsMethod"

	InternalErrorCode = -500
)

Variables

View Source
var (
	ErrorRequestCreation    = Error("error creating request")
	ErrorGettingResponse    = Error("error getting response")
	ErrorXMLMarshal         = Error("error marshaling xml")
	ErrorXMLParsingResponse = Error("error parsing xml response")
	ErrorQueryURLCreation   = Error("error creating query url")

	ErrorInvalidInvoices                 = Error("invalid invoices")
	ErrorRequestSendIncomeClassification = Error("error sending income classification")
)

Functions

func ParseXMLResponse

func ParseXMLResponse[T any](r *http.Response) (*T, error)

ParseXMLResponse parses the response body as xml and returns the result

Types

type Client

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

func NewClient

func NewClient(userID, subscriptionKey string, timeoutInSeconds int, prod bool) *Client

NewClient creates a new myDATA client

func (*Client) CancelInvoice

func (*Client) RequestDocWithMark

func (c *Client) RequestDocWithMark(mark uint) (int, *mydataInvoices.RequestedDoc, error)

RequestDocWithMark gets the invoices from myDATA with a specific mark

func (*Client) RequestDocs

RequestDocs gets the requested documents, that others have submitted from myDATA we get back the response status code and the requested documents

func (*Client) RequestDocsPastDays

func (c *Client) RequestDocsPastDays(days int) (int, *mydataInvoices.RequestedDoc, error)

RequestDocsPastDays gets the invoices from myDATA for the past days

func (*Client) RequestMyExpenses

RequestMyExpenses requests the invoices that have expense characterization for the user for the given period

func (*Client) RequestMyExpensesLastDays

func (c *Client) RequestMyExpensesLastDays(days int) (int, *mydataInvoices.RequestedBookInfo, error)

RequestMyExpensesLastDays requests the invoices that have expense characterization for the user for the last days

func (*Client) RequestMyIncome

RequestMyIncome requests the invoices that have income characterization for the user for the given period

func (*Client) RequestMyIncomeLastDays

func (c *Client) RequestMyIncomeLastDays(days int) (int, *mydataInvoices.RequestedBookInfo, error)

RequestMyIncomeLastDays requests the invoices that have income characterization for the user for the last days

func (*Client) RequestTransmittedDocBetweenMarks

func (c *Client) RequestTransmittedDocBetweenMarks(lowMark, higMark uint) (int, *mydataInvoices.RequestedDoc, error)

RequestTransmittedDocBetweenMarks gets the invoices from myDATA between marks

func (*Client) RequestTransmittedDocWithMark

func (c *Client) RequestTransmittedDocWithMark(mark uint) (int, *mydataInvoices.RequestedDoc, error)

RequestTransmittedDocWithMark gets the invoices from myDATA with a specific mark

func (*Client) RequestTransmittedDocs

func (c *Client) RequestTransmittedDocs(params mydataInvoices.RequestDocsParams) (int, *mydataInvoices.RequestedDoc, error)

RequestTransmittedDocs gets the invoices from myDATA that the user has submitted.

func (*Client) RequestTransmittedDocsPastDays

func (c *Client) RequestTransmittedDocsPastDays(days int) (int, *mydataInvoices.RequestedDoc, error)

RequestTransmittedDocsPastDays gets the invoices from myDATA for the past days

func (*Client) SendExpensesClassification

func (c *Client) SendExpensesClassification(changes *mydataInvoices.ExpensesClassificationsDoc, postMethodPerInvoice bool) (int, *mydataInvoices.ResponseDoc, error)

SendExpensesClassification sends the expense classification of invoices submitted to AADE. If postMethod is false, then we change invoice classification per line number. If postMethod is true, then we change invoice classification per invoice mark. One for E3 and one for VAT.

func (*Client) SendIncomeClassification

func (c *Client) SendIncomeClassification(changes *mydataInvoices.IncomeClassificationsDoc) (int, *mydataInvoices.ResponseDoc, error)

SendIncomeClassification sends the income classification of invoices already submitted to AADE

func (*Client) SendInvoices

func (c *Client) SendInvoices(invoices *mydataInvoices.InvoicesDoc) (int, *mydataInvoices.ResponseDoc, error)

SendInvoices sends the given invoices to the myDATA API

func (*Client) SendPaymentsMethod

func (c *Client) SendPaymentsMethod(paymentMethods *mydataInvoices.PaymentMethodsDoc) (int, *mydataInvoices.ResponseDoc, error)

func (*Client) SetOnInvalidAction

func (c *Client) SetOnInvalidAction(action OnInvalidAction)

SetOnInvalidAction sets the action to take when an invalid invoice is encountered

type ConnectionClient

type ConnectionClient interface {
	SetOnInvalidAction(action OnInvalidAction)
	SendInvoices(invoices *mydataInvoices.InvoicesDoc) (int, *mydataInvoices.ResponseDoc, error)
	SendPaymentsMethod(paymentMethods *mydataInvoices.PaymentMethodsDoc) (int, *mydataInvoices.ResponseDoc, error)
	RequestDocs(params mydataInvoices.RequestDocsParams) (int, *mydataInvoices.RequestedDoc, error)
	RequestDocsPastDays(days int) (int, *mydataInvoices.RequestedDoc, error)
	RequestDocWithMark(mark uint) (int, *mydataInvoices.RequestedDoc, error)
	RequestMyIncome(params mydataInvoices.RequestMyIncomeParams) (int, *mydataInvoices.RequestedBookInfo, error)
	RequestMyExpenses(params mydataInvoices.RequestMyExpensesParams) (int, *mydataInvoices.RequestedBookInfo, error)
	RequestMyIncomeLastDays(days int) (int, *mydataInvoices.RequestedBookInfo, error)
	RequestMyExpensesLastDays(days int) (int, *mydataInvoices.RequestedBookInfo, error)
	RequestTransmittedDocs(params mydataInvoices.RequestDocsParams) (int, *mydataInvoices.RequestedDoc, error)
	RequestTransmittedDocsPastDays(days int) (int, *mydataInvoices.RequestedDoc, error)
	RequestTransmittedDocWithMark(mark uint) (int, *mydataInvoices.RequestedDoc, error)
	RequestTransmittedDocBetweenMarks(lowMark, higMark uint) (int, *mydataInvoices.RequestedDoc, error)
	SendIncomeClassification(changes *mydataInvoices.IncomeClassificationsDoc) (int, *mydataInvoices.ResponseDoc, error)
	SendExpensesClassification(changes *mydataInvoices.ExpensesClassificationsDoc, postMethodPerInvoice bool) (int, *mydataInvoices.ResponseDoc, error)
	CancelInvoice(params mydataInvoices.CancelInvoiceParams) (int, *mydataInvoices.ResponseDoc, error)
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type OnInvalidAction

type OnInvalidAction int
const (
	ErrorOnInvalid OnInvalidAction = iota
	PassThroughOnInvalid
	FilterOnInvalid
)

type SendInvoiceParams

type SendInvoiceParams struct {
	AadeUserID string `json:"aade-user-id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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