billing

package
v1.57.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TXType

type TXType int

TXType is a type wrapper for transaction types.

const (
	// Storjscan defines transactions which are originated from storjscan payment wallets.
	Storjscan TXType = iota
	// Stripe defines transactions which are Stripe processed credits and/or debits.
	Stripe
	// Coinpayments defines transactions which are originated from coinpayments.
	Coinpayments
)

func (TXType) Int

func (t TXType) Int() int

Int returns int representation of transaction type.

func (TXType) String

func (t TXType) String() string

String returns string representation of transaction type.

type Transaction

type Transaction struct {
	TXID        string
	AccountID   uuid.UUID
	Amount      monetary.Amount
	Description string
	TXType      TXType
	Timestamp   time.Time
	CreatedAt   time.Time
}

Transaction defines billing related transaction info that is stored in the DB.

type TransactionsDB

type TransactionsDB interface {
	// Insert inserts the provided transaction.
	Insert(ctx context.Context, tx Transaction) error
	// List returns all transactions for the specified user.
	List(ctx context.Context, userID uuid.UUID) ([]Transaction, error)
	// ListType returns all transactions of a given type for the specified user.
	ListType(ctx context.Context, userID uuid.UUID, txType TXType) ([]Transaction, error)
	// ComputeBalance returns the current usable balance for the specified user.
	ComputeBalance(ctx context.Context, userID uuid.UUID) (monetary.Amount, error)
}

TransactionsDB is an interface which defines functionality of DB which stores billing transactions.

architecture: Database

Jump to

Keyboard shortcuts

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