Documentation
¶
Index ¶
- Variables
- func AddProduct(product *Product) error
- func Setup(d *sql.DB, sqlTblPrefix string) error
- func TerminateProductBySerialNumber(serialNumber uint64) error
- func UpdateProduct(product *Product) error
- type Product
- func GetProductBySerialNumber(serialNumber uint64) (*Product, error)
- func ListActiveProductsByBillingCycle(billingCycle uint8) ([]*Product, error)
- func ListAffiliationProducts(ownerAffiliationID uint64) ([]*Product, error)
- func ListAllProducts() ([]*Product, error)
- func ListProductsByProductID(productID uint64) ([]*Product, error)
- func ListUserProducts(ownerUserID uint64) ([]*Product, error)
- type Wallet
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadAmount error = errors.New("billing: bad amount input") ErrInsufficientFunds error = errors.New("billing: insufficient funds") // I can hear it... )
var ( ErrInvalidSerialNumber = errors.New("billing: invalid serial number") ErrInvalidOwnerID = errors.New("billing: invalid owner ID, need OwnerUserID or OwnerAffiliationID") ErrInvalidProductID = errors.New("billing: invalid product ID") ErrInvalidWalletID = errors.New("billing: invalid wallet ID") )
Functions ¶
func TerminateProductBySerialNumber ¶ added in v0.0.17
func UpdateProduct ¶
Types ¶
type Product ¶
type Product struct {
// Ownership. At least one must be set.
// if both are set, the product is treated
// as a private owned product.
OwnerUserID uint64
OwnerAffiliationID uint64
// billing/payment
ProductID uint64 // identifier for product type, description, pricing, etc.
BillingCycle uint8
WalletID uint64
// contains filtered or unexported fields
}
func GetProductBySerialNumber ¶ added in v0.0.17
func ListActiveProductsByBillingCycle ¶
For automated-billing purposes. Designed for Pay-As-You-Go billing. But may be used for other purposes later?
func ListAffiliationProducts ¶ added in v0.0.17
For affliation user viewing. Lists all products owned by the affiliation, including both shared and private owned products. Client should implement local-pagination to reduce need of repeated query Client should mark private products (ownerUserID != 0) as private API Server should hide dateTermination in response, if dateTermination is earlier than dateCreation
func ListAllProducts ¶
For admin viewing. Client should implement local-pagination
func ListProductsByProductID ¶ added in v0.0.17
For admin viewing.
func ListUserProducts ¶
For user viewing. Lists all products owned by the user. Client should implement local-pagination to reduce need of repeated query API Server should hide dateTermination in reponse, if dateTermination is earlier than dateCreation
func (*Product) DateCreation ¶
func (*Product) DateTermination ¶
func (*Product) SerialNumber ¶ added in v0.0.17
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func GetWalletByID ¶ added in v0.0.17
GetWalletByID() build a Wallet struct reflecting an entry in the database.