billing

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingService

type BillingService interface {
	GetCards(parameters connection.APIRequestParameters) ([]Card, error)
	GetCardsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Card], error)
	GetCard(cardID int) (Card, error)
	CreateCard(req CreateCardRequest) (int, error)
	PatchCard(cardID int, patch PatchCardRequest) error
	DeleteCard(cardID int) error

	GetCloudCosts(parameters connection.APIRequestParameters) ([]CloudCost, error)
	GetCloudCostsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[CloudCost], error)
	GetCloudCost(costID int) (CloudCost, error)

	GetDirectDebit() (DirectDebit, error)

	GetInvoices(parameters connection.APIRequestParameters) ([]Invoice, error)
	GetInvoicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Invoice], error)
	GetInvoice(invoiceID int) (Invoice, error)

	GetInvoiceQueries(parameters connection.APIRequestParameters) ([]InvoiceQuery, error)
	GetInvoiceQueriesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[InvoiceQuery], error)
	GetInvoiceQuery(queryID int) (InvoiceQuery, error)
	CreateInvoiceQuery(req CreateInvoiceQueryRequest) (int, error)

	GetPayments(parameters connection.APIRequestParameters) ([]Payment, error)
	GetPaymentsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Payment], error)
	GetPayment(paymentID int) (Payment, error)

	GetRecurringCosts(parameters connection.APIRequestParameters) ([]RecurringCost, error)
	GetRecurringCostsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[RecurringCost], error)
	GetRecurringCost(costID int) (RecurringCost, error)
}

BillingService is an interface for managing billing

type Card

type Card struct {
	ID           int    `json:"id"`
	FriendlyName string `json:"friendly_name"`
	Name         string `json:"name"`
	Address      string `json:"address"`
	Postcode     string `json:"postcode"`
	CardNumber   string `json:"card_number"`
	CardType     string `json:"card_type"`
	ValidFrom    string `json:"valid_from"`
	Expiry       string `json:"expiry"`
	IssueNumber  int    `json:"issue_number"`
	PrimaryCard  bool   `json:"primary_card"`
}

Card represents a credit/debit card

type CardNotFoundError

type CardNotFoundError struct {
	ID int
}

CardNotFoundError indicates a card was not found

func (*CardNotFoundError) Error

func (e *CardNotFoundError) Error() string

type CloudCost

type CloudCost struct {
	ID       int `json:"id"`
	ServerID int `json:"server_id"`
	Resource struct {
		Type                   string              `json:"type"`
		Quantity               int                 `json:"quantity"`
		Price                  float32             `json:"price"`
		Period                 string              `json:"period"`
		UsageSinceLastInvoice  int                 `json:"usage_since_last_invoice"`
		CostSinceLastInvoice   float32             `json:"cost_since_last_invoice"`
		UsageForPeriodEstimate int                 `json:"usage_for_period_estimate"`
		CostForPeriodEstimate  float32             `json:"cost_for_period_estimate"`
		BillingStart           connection.DateTime `json:"billing_start"`
		BillingEnd             connection.DateTime `json:"billing_end"`
		BillingDueDate         connection.DateTime `json:"billing_due_date"`
	} `json:"resource"`
}

CloudCost represents a cloud cost item

type CloudCostNotFoundError

type CloudCostNotFoundError struct {
	ID int
}

CloudCostNotFoundError indicates a cloud cost was not found

func (*CloudCostNotFoundError) Error

func (e *CloudCostNotFoundError) Error() string

type CreateCardRequest

type CreateCardRequest struct {
	FriendlyName string `json:"friendly_name"`
	Name         string `json:"name"`
	Address      string `json:"address"`
	Postcode     string `json:"postcode"`
	CardNumber   string `json:"card_number"`
	CardType     string `json:"card_type"`
	ValidFrom    string `json:"valid_from"`
	Expiry       string `json:"expiry"`
	IssueNumber  int    `json:"issue_number"`
	PrimaryCard  bool   `json:"primary_card"`
}

CreateCardRequest represents a request to create a card

type CreateInvoiceQueryRequest

type CreateInvoiceQueryRequest struct {
	ContactID        int                 `json:"contact_id"`
	Amount           float32             `json:"amount"`
	WhatWasExpected  string              `json:"what_was_expected"`
	WhatWasReceived  string              `json:"what_was_received"`
	ProposedSolution string              `json:"proposed_solution"`
	ContactMethod    string              `json:"contact_method"`
	InvoiceIDs       []int               `json:"invoice_ids"`
	Resolution       string              `json:"resolution"`
	ResolutionDate   connection.DateTime `json:"resolution_date"`
	Status           string              `json:"status"`
	Date             connection.DateTime `json:"date"`
}

CreateInvoiceQueryRequest represents a request to create an invoice query

type DirectDebit

type DirectDebit struct {
	Name           string              `json:"name"`
	Number         string              `json:"number"`
	SortCode       string              `json:"sortcode"`
	IsActivated    bool                `json:"is_activated"`
	Status         string              `json:"status"`
	DaysCredit     int                 `json:"days_credit"`
	SignupDateTime connection.DateTime `json:"signup_datetime"`
	SignupSource   string              `json:"signup_source"`
}

DirectDebit represents a direct debit

type DirectDebitNotFoundError

type DirectDebitNotFoundError struct {
}

DirectDebitNotFoundError indicates direct debit details were not found

func (*DirectDebitNotFoundError) Error

func (e *DirectDebitNotFoundError) Error() string

type Invoice

type Invoice struct {
	ID             int                 `json:"id"`
	Date           connection.DateTime `json:"date"`
	Paid           bool                `json:"paid"`
	Gross          float32             `json:"gross"`
	VAT            float32             `json:"vat"`
	Net            float32             `json:"net"`
	Outstanding    float32             `json:"outstanding"`
	ViaDirectDebit bool                `json:"via_direct_debit"`
}

Invoice represents an invoice

type InvoiceNotFoundError

type InvoiceNotFoundError struct {
	ID int
}

InvoiceNotFoundError indicates an invoice was not found

func (*InvoiceNotFoundError) Error

func (e *InvoiceNotFoundError) Error() string

type InvoiceQuery

type InvoiceQuery struct {
	ID               int                 `json:"id"`
	ContactID        int                 `json:"contact_id"`
	Amount           float32             `json:"amount"`
	WhatWasExpected  string              `json:"what_was_expected"`
	WhatWasReceived  string              `json:"what_was_received"`
	ProposedSolution string              `json:"proposed_solution"`
	InvoiceIDs       []int               `json:"invoice_ids"`
	Resolution       bool                `json:"resolution"`
	ResolutionDate   connection.DateTime `json:"resolution_date"`
	Status           string              `json:"status"`
	Date             connection.DateTime `json:"date"`
}

InvoiceQuery represents an invoice query

type InvoiceQueryNotFoundError

type InvoiceQueryNotFoundError struct {
	ID int
}

InvoiceQueryNotFoundError indicates an invoice query was not found

func (*InvoiceQueryNotFoundError) Error

func (e *InvoiceQueryNotFoundError) Error() string

type PatchCardRequest

type PatchCardRequest struct {
	FriendlyName string `json:"friendly_name,omitempty"`
	Name         string `json:"name,omitempty"`
	Address      string `json:"address,omitempty"`
	Postcode     string `json:"postcode,omitempty"`
	CardNumber   string `json:"card_number,omitempty"`
	CardType     string `json:"card_type,omitempty"`
	ValidFrom    string `json:"valid_from,omitempty"`
	Expiry       string `json:"expiry,omitempty"`
	IssueNumber  int    `json:"issue_number,omitempty"`
	PrimaryCard  *bool  `json:"primary_card,omitempty"`
}

PatchCardRequest represents a request to create a card

type Payment

type Payment struct {
	ID          int                 `json:"id"`
	Category    string              `json:"category"`
	Quantity    int                 `json:"quantity"`
	Description string              `json:"description"`
	Date        connection.DateTime `json:"date"`
	DateFrom    connection.DateTime `json:"date_from"`
	DateTo      connection.DateTime `json:"date_to"`
	Cost        float32             `json:"cost"`
	VAT         float32             `json:"vat"`
	Gross       float32             `json:"gross"`
	Discount    float32             `json:"discount"`
}

Payment represents a payment

type PaymentNotFoundError

type PaymentNotFoundError struct {
	ID int
}

PaymentNotFoundError indicates a payment was not found

func (*PaymentNotFoundError) Error

func (e *PaymentNotFoundError) Error() string

type RecurringCost

type RecurringCost struct {
	ID   int `json:"id"`
	Type struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"type"`
	Description     string `json:"description"`
	Status          string `json:"status"`
	OrderID         string `json:"order_id"`
	PurchaseOrderID string `json:"purchase_order_id"`
	CostCentreID    int    `json:"cost_centre_id"`
	Product         struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"product"`
	Cost                     float32             `json:"cost"`
	Period                   string              `json:"period"`
	Interval                 int                 `json:"interval"`
	ByCard                   bool                `json:"by_card"`
	NextPaymentAt            connection.Date     `json:"next_payment_at"`
	EndDate                  connection.Date     `json:"end_date"`
	ContractEndDate          connection.Date     `json:"contract_end_date"`
	FrozenEndDate            connection.Date     `json:"frozen_end_date"`
	MigrationEndDate         connection.Date     `json:"migration_end_date"`
	ExtendedMigrationEndDate connection.Date     `json:"extended_migration_end_date"`
	CreatedAt                connection.DateTime `json:"created_at"`
	Partner                  struct {
		ID   int    `json:"id"`
		Cost string `json:"cost"`
	} `json:"partner"`
	ProjectID int `json:"project_id"`
}

RecurringCost represents a recurring cost

type RecurringCostNotFoundError

type RecurringCostNotFoundError struct {
	ID int
}

RecurringCostNotFoundError indicates a recurring cost was not found

func (*RecurringCostNotFoundError) Error

type Service

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

Service implements BillingService for managing Billing certificates via the UKFast API

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of BillingService

func (*Service) CreateCard

func (s *Service) CreateCard(req CreateCardRequest) (int, error)

CreateCard creates a new card

func (*Service) CreateInvoiceQuery

func (s *Service) CreateInvoiceQuery(req CreateInvoiceQueryRequest) (int, error)

CreateInvoiceQuery retrieves creates an InvoiceQuery

func (*Service) DeleteCard

func (s *Service) DeleteCard(cardID int) error

DeleteCard removes a card

func (*Service) GetCard

func (s *Service) GetCard(cardID int) (Card, error)

GetCard retrieves a single card by id

func (*Service) GetCards

func (s *Service) GetCards(parameters connection.APIRequestParameters) ([]Card, error)

GetCards retrieves a list of cards

func (*Service) GetCardsPaginated

func (s *Service) GetCardsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Card], error)

GetCardsPaginated retrieves a paginated list of cards

func (*Service) GetCloudCost

func (s *Service) GetCloudCost(costID int) (CloudCost, error)

GetCloudCost retrieves a single cost by id

func (*Service) GetCloudCosts

func (s *Service) GetCloudCosts(parameters connection.APIRequestParameters) ([]CloudCost, error)

GetCloudCosts retrieves a list of costs

func (*Service) GetCloudCostsPaginated

func (s *Service) GetCloudCostsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[CloudCost], error)

GetCloudCostsPaginated retrieves a paginated list of costs

func (*Service) GetDirectDebit

func (s *Service) GetDirectDebit() (DirectDebit, error)

GetDirectDebit retrieves direct debit details

func (*Service) GetInvoice

func (s *Service) GetInvoice(invoiceID int) (Invoice, error)

GetInvoice retrieves a single invoice by id

func (*Service) GetInvoiceQueries

func (s *Service) GetInvoiceQueries(parameters connection.APIRequestParameters) ([]InvoiceQuery, error)

GetInvoiceQueries retrieves a list of invoice queries

func (*Service) GetInvoiceQueriesPaginated

func (s *Service) GetInvoiceQueriesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[InvoiceQuery], error)

GetInvoiceQueriesPaginated retrieves a paginated list of invoice queries

func (*Service) GetInvoiceQuery

func (s *Service) GetInvoiceQuery(queryID int) (InvoiceQuery, error)

GetInvoiceQuery retrieves a single invoice query by id

func (*Service) GetInvoices

func (s *Service) GetInvoices(parameters connection.APIRequestParameters) ([]Invoice, error)

GetInvoices retrieves a list of invoices

func (*Service) GetInvoicesPaginated

func (s *Service) GetInvoicesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Invoice], error)

GetInvoicesPaginated retrieves a paginated list of invoices

func (*Service) GetPayment

func (s *Service) GetPayment(paymentID int) (Payment, error)

GetPayment retrieves a single payment by id

func (*Service) GetPayments

func (s *Service) GetPayments(parameters connection.APIRequestParameters) ([]Payment, error)

GetPayments retrieves a list of payments

func (*Service) GetPaymentsPaginated

func (s *Service) GetPaymentsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Payment], error)

GetPaymentsPaginated retrieves a paginated list of payments

func (*Service) GetRecurringCost

func (s *Service) GetRecurringCost(costID int) (RecurringCost, error)

GetRecurringCost retrieves a single cost by id

func (*Service) GetRecurringCosts

func (s *Service) GetRecurringCosts(parameters connection.APIRequestParameters) ([]RecurringCost, error)

GetRecurringCosts retrieves a list of costs

func (*Service) GetRecurringCostsPaginated

func (s *Service) GetRecurringCostsPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[RecurringCost], error)

GetRecurringCostsPaginated retrieves a paginated list of costs

func (*Service) PatchCard

func (s *Service) PatchCard(cardID int, patch PatchCardRequest) error

PatchCard patches a card

Jump to

Keyboard shortcuts

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