tingbill

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bill

type Bill struct {
	Description    string   `toml:"description"`
	Devices        []Device `toml:"devices"`
	ShortStrawID   string   `toml:"shortStrawId"`
	Total          float64  `toml:"total"`
	DevicesCost    float64  `toml:"devicesCost"`
	Minutes        float64  `toml:"minutes"`
	Messages       float64  `toml:"messages"`
	Megabytes      float64  `toml:"megabytes"`
	ExtraMinutes   float64  `toml:"extraMinutes"`
	ExtraMessages  float64  `toml:"extraMessages"`
	ExtraMegabytes float64  `toml:"extraMegabytes"`
	Fees           float64  `toml:"fees"`
}

Used to represent the Ting-provided and user-provided info required to split Bill costs

func (Bill) DeviceIds

func (b Bill) DeviceIds() []string

func (Bill) OwnerByID

func (b Bill) OwnerByID(id string) string

type BillSplit

type BillSplit struct {
	MinuteCosts     map[string]decimal.Decimal
	MinuteQty       map[string]int
	MinutePercent   map[string]decimal.Decimal
	MessageCosts    map[string]decimal.Decimal
	MessageQty      map[string]int
	MessagePercent  map[string]decimal.Decimal
	MegabyteCosts   map[string]decimal.Decimal
	MegabyteQty     map[string]int
	MegabytePercent map[string]decimal.Decimal
	SharedCosts     map[string]decimal.Decimal
}

Used to contain all subtotals for a monthly Bill. MinuteCosts, MessageCosts, MegabyteCosts are maps of decimal.Decimal totals. They are split by Bill.Devices and calculated by usage in parseMaps. SharedCosts reflect the rest of the items not based on usage, which get split evenly across all DeviceIds TODO: finish these comments

type Device

type Device struct {
	DeviceID string
	Owner    string
}

Jump to

Keyboard shortcuts

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