fakturoid

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fakturoid

type Fakturoid struct {
	APIToken string
	Email    string
	Slug     string
}

Fakturoid represents a Fakturoid service configuration.

func New

func New(
	apiToken string,
	email string,
	slug string,
) *Fakturoid

New creates a new instance of Fakturoid service configuration.

func (*Fakturoid) GenerateInvoice

func (fkt *Fakturoid) GenerateInvoice(invoice *Invoice) ([]byte, error)

GenerateInvoice creates a Fakturoid invoice and returns it as PDF.

func (*Fakturoid) GetBankAccountID

func (fkt *Fakturoid) GetBankAccountID(bankAccountName string) (int, error)

GetBankAccountID returns id of the specified Fakturoid bank account.

func (*Fakturoid) GetClientID

func (fkt *Fakturoid) GetClientID(clientName string) (int, error)

GetClientID returns id of the specified Fakturoid client.

type Invoice

type Invoice struct {
	ID     int    `json:"id,omitempty"`
	PDFURL string `json:"pdf_url,omitempty"`

	BankAccountID int           `json:"bank_account_id"`
	ClientID      int           `json:"subject_id"`
	Currency      string        `json:"currency"`
	DateIssued    string        `json:"issued_on"`
	DaysUntilDue  int           `json:"due"`
	Lines         []InvoiceLine `json:"lines"`
	PaymentMethod string        `json:"payment_method"`
}

Invoice represents a Fakturoid invoice.

func NewInvoice

func NewInvoice(
	bankAccountID int,
	clientID int,
	currency string,
	dateIssued string,
	daysUntilDue int,
	lines []InvoiceLine,
) *Invoice

NewInvoice is a helper function for creating `Invoice` objects.

type InvoiceLine

type InvoiceLine struct {
	Name      string `json:"name"`
	Quantity  string `json:"quantity"`
	UnitName  string `json:"unit_name"`
	UnitPrice string `json:"unit_price"`
	VatRate   int    `json:"vat_rate"`
}

InvoiceLine represents a single line of a Fakturoid invoice.

Jump to

Keyboard shortcuts

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