invoice

package
v6.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discount

type Discount struct {
	// Discounted amount (in cents)
	Amount int `json:"amount"`
	// Applied discount description
	Description string `json:"description"`
}

Discount struct for a Discount

type Invoice

type Invoice struct {
	// Invoice creation date
	CreationDate rest.Date `json:"creationDate"`
	// Currency used for this invoice
	Currency string `json:"currency"`
	// Invoice deadline
	DueDate rest.Date `json:"dueDate"`
	// Invoice number
	InvoiceNumber string `json:"invoiceNumber"`
	// Invoice status
	InvoiceStatus Status `json:"invoiceStatus"`
	// Invoice paid date
	PayDate rest.Date `json:"payDate"`
	// Invoice total (displayed in cents)
	TotalAmount int `json:"totalAmount"`
	// Invoice total including VAT (displayed in cents)
	TotalAmountInclVat int `json:"totalAmountInclVat"`
}

Invoice struct for an invoice

type Item

type Item struct {
	// Date when the order line item was up for invoicing
	Date rest.Date `json:"date"`
	// Product description
	Description string `json:"description"`
	// Applied discounts
	Discounts []Discount `json:"discounts"`
	// Payment is recurring
	IsRecurring bool `json:"isRecurring"`
	// Price excluding VAT (displayed in cents)
	Price int `json:"price"`
	// Price including VAT (displayed in cents)
	PriceInclVat int `json:"priceInclVat"`
	// Product name
	Product string `json:"product"`
	// Quantity
	Quantity int `json:"quantity"`
	// Amount of VAT charged
	Vat int `json:"vat"`
	// Percentage used to calculate the VAT
	VatPercentage int `json:"vatPercentage"`
}

Item struct is one item line on a invoice, see Description and Product for more information

type Pdf

type Pdf struct {
	// Content contains a base64 encoded string containing the pdf content
	// We provide a io.Reader on this struct called GetReader
	Content string `json:"pdf"`
}

Pdf struct for a invoice as Pdf

func (*Pdf) GetReader

func (p *Pdf) GetReader() io.Reader

GetReader will return a io.Reader containing the decoded base64 contents of the invoice PDF

type Repository

type Repository repository.RestRepository

Repository can be used to get a list of your invoices, invoice subitems (a specific product) or an invoice as pdf

func (*Repository) GetAll

func (r *Repository) GetAll() ([]Invoice, error)

GetAll returns a list of all invoices attached to your TransIP account

func (*Repository) GetByInvoiceNumber

func (r *Repository) GetByInvoiceNumber(invoiceNumber string) (Invoice, error)

GetByInvoiceNumber returns an Invoice object for the given invoice number.

invoiceNumber corresponds to the InvoiceNumber property on a Invoice struct

func (*Repository) GetInvoiceItems

func (r *Repository) GetInvoiceItems(invoiceNumber string) ([]Item, error)

GetInvoiceItems returns a list of InvoiceItems, detailing what specific products or services are on this invoice.

invoiceNumber corresponds to the InvoiceNumber property on a Invoice struct.

func (*Repository) GetInvoicePdf

func (r *Repository) GetInvoicePdf(invoiceNumber string) (Pdf, error)

GetInvoicePdf returns a pdf struct containing the contents of the pdf encoded in base64 there are specific Pdf struct functions that help you decode the contents of the pdf to a file.

invoiceNumber corresponds to the InvoiceNumber property on a Invoice struct.

func (*Repository) GetSelection

func (r *Repository) GetSelection(page int, itemsPerPage int) ([]Invoice, error)

GetSelection returns a limited list of invoices, specify how many and which page/chunk of invoices you want to retrieve

type Status

type Status string

Status is one of the following strings 'opened', 'closed', 'waitsforpayment', 'overdue', 'problem' , 'paid', 'paymentpending'

const (
	// InvoiceStatusOpened is the invoice status field for a opened invoice
	InvoiceStatusOpened Status = "opened"
	// InvoiceStatusClosed is the invoice status field for a closed invoice
	InvoiceStatusClosed Status = "closed"
	// InvoiceStatusWaitsforpayment is the invoice status field for when the invoice needs to be paid
	InvoiceStatusWaitsforpayment Status = "waitsforpayment"
	// InvoiceStatusOverdue is the invoice status field for when a payment is overdue
	InvoiceStatusOverdue Status = "overdue"
	// InvoiceStatusProblem is the invoice status field for when a problem occurred during invoicing
	InvoiceStatusProblem Status = "problem"
	// InvoiceStatusPaid is the invoice status field for a paid invoice
	InvoiceStatusPaid Status = "paid"
	// InvoiceStatusPaymentpending is the invoice status field for when a payment is pending
	InvoiceStatusPaymentpending Status = "paymentpending"
)

Jump to

Keyboard shortcuts

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