invoice

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INVOICE_URL_TEMPLATE          = "https://api.vodafone.de/meinvodafone/v2/customer/urn:vf-de:cable:can:%s/invoice"
	INVOICE_DOCUMENT_URL_TEMPLATE = "https://api.vodafone.de/meinvodafone/v2/customer/%s/invoiceDocument/%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractID

type ContractID string

type ContractIDFetcher

type ContractIDFetcher interface {
	GetAllContractIDs() []string
}

type DocumentData

type DocumentData struct {
	CustomerID string `json:"customerId"`
	DocumentID string `json:"documentId"`
	MimeType   string `json:"mime"`
	Data       string `json:"data"`
}

func (*DocumentData) Bytes

func (documentData *DocumentData) Bytes() ([]byte, error)

func (*DocumentData) Checksum

func (documentData *DocumentData) Checksum() string

Checksum returns an md5checksum the same as paperless would calculate for cross referencing.

type Invoice

type Invoice struct {
	Number     string             `json:"number"`
	Date       string             `json:"date"`
	Amount     float64            `json:"amount"` // Vodafone API has this defined as a float in json. This is a bad idea.
	DueDate    string             `json:"dueDate"`
	From       string             `json:"from"`
	About      string             `json:"about"`
	Documents  []*InvoiceDocument `json:"documents"`
	CustomerID string             `json:"-"`
}

func (*Invoice) GetNumDocuments

func (invoice *Invoice) GetNumDocuments() int

func (*Invoice) SetCustomerID

func (invoice *Invoice) SetCustomerID(customerID string)

type InvoiceDocument

type InvoiceDocument struct {
	DocumentID string `json:"documentId"`
	Category   string `json:"category"`
	Icon       string `json:"icon"`
	SubType    string `json:"subType"`
	CustomerID string `json:"-"`
}

func (*InvoiceDocument) Download

func (invoiceDocument *InvoiceDocument) Download(bearerToken fetcher.BearerToken) (*DocumentData, error)

func (*InvoiceDocument) DownloadURL

func (invoiceDocument *InvoiceDocument) DownloadURL() string

func (*InvoiceDocument) SetCustomerID

func (invoiceDocument *InvoiceDocument) SetCustomerID(customerID string)

type InvoiceList

type InvoiceList struct {
	CustomerID string     `json:"customerId"`
	Invoices   []*Invoice `json:"invoices"`
}

func ListFor

func ListFor(contractID ContractID, bearerToken fetcher.BearerToken) (*InvoiceList, error)

func (*InvoiceList) GetNumDocuments

func (invoiceList *InvoiceList) GetNumDocuments() int

func (*InvoiceList) GetNumInvoices

func (invoiceList *InvoiceList) GetNumInvoices() int

func (*InvoiceList) PropagateCustomerID

func (invoiceList *InvoiceList) PropagateCustomerID()

type InvoiceOverview

type InvoiceOverview struct {
	Data map[ContractID]*InvoiceList
}

func List

func List(contractIDFetcher ContractIDFetcher, bearerToken fetcher.BearerToken) (*InvoiceOverview, error)

func (*InvoiceOverview) GetNumDocuments

func (invoiceOverview *InvoiceOverview) GetNumDocuments() int

func (*InvoiceOverview) GetNumInvoices

func (invoiceOverview *InvoiceOverview) GetNumInvoices() int

Jump to

Keyboard shortcuts

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