pricing

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PriceString

func PriceString(price *big.Rat, currency string) string

Types

type Basket

type Basket []Usage

func NewBasket

func NewBasket() *Basket

func (*Basket) Add

func (b *Basket) Add(usage Usage) error

func (*Basket) Length

func (b *Basket) Length() int

func (*Basket) SetDuration

func (b *Basket) SetDuration(duration time.Duration) error

func (*Basket) Total

func (b *Basket) Total() *big.Rat

type PricingList

type PricingList []PricingObject
var CurrentPricing PricingList

CurrentPricing tries to be up-to-date with the real pricing we cannot guarantee of these values since we hardcode values for now later, we should be able to call a dedicated pricing API

func (*PricingList) GetByIdentifier

func (pl *PricingList) GetByIdentifier(identifier string) *PricingObject

GetByIdentifier returns an object matching a identifier

func (*PricingList) GetByPath

func (pl *PricingList) GetByPath(path string) *PricingObject

GetByPath returns an object matching a path

type PricingObject

type PricingObject struct {
	Path             string
	Identifier       string
	Currency         string
	UsageUnit        string
	UnitPrice        *big.Rat
	UnitQuantity     *big.Rat
	UnitPriceCap     *big.Rat
	UsageGranularity time.Duration
}

type Usage

type Usage struct {
	PricingObject *PricingObject
	Quantity      *big.Rat
}

func NewUsage

func NewUsage(object *PricingObject) Usage

func NewUsageByPath

func NewUsageByPath(objectPath string) Usage

func NewUsageByPathWithQuantity

func NewUsageByPathWithQuantity(objectPath string, quantity *big.Rat) Usage

func NewUsageWithQuantity

func NewUsageWithQuantity(object *PricingObject, quantity *big.Rat) Usage

func (*Usage) BillableQuantity

func (u *Usage) BillableQuantity() *big.Rat

func (*Usage) LostQuantity

func (u *Usage) LostQuantity() *big.Rat

func (*Usage) SetDuration

func (u *Usage) SetDuration(duration time.Duration) error

func (*Usage) SetQuantity

func (u *Usage) SetQuantity(quantity *big.Rat) error

func (*Usage) SetStartEnd

func (u *Usage) SetStartEnd(start, end time.Time) error

func (*Usage) Total

func (u *Usage) Total() *big.Rat

func (*Usage) TotalString

func (u *Usage) TotalString() string

Jump to

Keyboard shortcuts

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