balance

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Kind = "balance"

Kind distinguishes between different resource kinds

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Metadata  resource.Metadata `json:"metadata,omitempty"`
	Data      Data              `json:"data,omitempty"`
	Signature string            `json:"signature,omitempty"`
}

Balance is a resource to communicate the amounts of each currency held by the PFI on behalf of its customer.

func Create

func Create(fromDID did.BearerDID, currencyCode, availableAmount string, opts ...CreateOption) (Balance, error)

Create a Balance object

func Parse

func Parse(data []byte) (Balance, error)

Parse validates, parses input data into a Balance, and verifies the signature.

func (Balance) Digest

func (b Balance) Digest() ([]byte, error)

Digest computes a hash of the resource

func (*Balance) UnmarshalJSON

func (b *Balance) UnmarshalJSON(data []byte) error

UnmarshalJSON validates and unmarshals the input data into a Balance.

func (*Balance) Verify

func (b *Balance) Verify() error

Verify verifies the signature of the Balance.

type CreateOption

type CreateOption func(*createOptions)

CreateOption implements functional options pattern for Create.

func CreatedAt

func CreatedAt(t time.Time) CreateOption

CreatedAt can be passed to Create to provide a custom created at time.

func UpdatedAt

func UpdatedAt(t time.Time) CreateOption

UpdatedAt can be passed to Create to provide a custom updated at time.

type Data

type Data struct {
	CurrencyCode string `json:"currencyCode,omitempty"`
	Available    string `json:"available,omitempty"`
}

Data represents the data of a Balance.

type ID

type ID struct {
	typeid.TypeID[ID]
}

ID is a unique identifier for a Balance.

func (ID) Prefix

func (id ID) Prefix() string

Prefix returns the prefix for the Balance ID.

Jump to

Keyboard shortcuts

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