Documentation
¶
Index ¶
- func NewAccountFromData(data AccountData, services AccountLiveServices) (ledger.Account, error)
- type Account
- type AccountData
- type AccountLiveServices
- type Address
- type AddressData
- type BusinessAccount
- type CreateAccountInput
- type CreateSubAccountInput
- type CustomerAccount
- type CustomerAccruedAccount
- type CustomerFBOAccount
- type CustomerReceivableAccount
- type ListAccountsInput
- type ListSubAccountsInput
- type Repo
- type Service
- type SubAccount
- type SubAccountCreatorLister
- type SubAccountData
- type SubAccountRouteData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAccountFromData ¶
func NewAccountFromData(data AccountData, services AccountLiveServices) (ledger.Account, error)
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account instance represent a given account
func (*Account) ID ¶
func (a *Account) ID() models.NamespacedID
ID returns the namespaced identifier of this account.
func (*Account) Type ¶
func (a *Account) Type() ledger.AccountType
type AccountData ¶
type AccountData struct {
ID models.NamespacedID
Annotations models.Annotations
models.ManagedModel
AccountType ledger.AccountType
}
AccountData is a simple data transfer object for the Account entity.
type AccountLiveServices ¶
type AccountLiveServices struct {
SubAccountService SubAccountCreatorLister
}
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddressFromData ¶
func NewAddressFromData(data AddressData) (*Address, error)
func (*Address) AccountType ¶
func (a *Address) AccountType() ledger.AccountType
func (*Address) Route ¶
func (a *Address) Route() ledger.SubAccountRoute
func (*Address) SubAccountID ¶
type AddressData ¶
type AddressData struct {
SubAccountID string
AccountType ledger.AccountType
Route ledger.Route
RouteID string
RoutingKey ledger.RoutingKey
}
type BusinessAccount ¶
type BusinessAccount struct {
*Account
}
BusinessAccount implements ledger.BusinessAccount.
func (*BusinessAccount) GetSubAccountForRoute ¶
func (a *BusinessAccount) GetSubAccountForRoute(ctx context.Context, params ledger.BusinessRouteParams) (ledger.SubAccount, error)
GetSubAccountForRoute finds or creates a sub-account for the given route.
type CreateAccountInput ¶
type CreateAccountInput = ledger.CreateAccountInput
type CreateSubAccountInput ¶
type CreateSubAccountInput = ledger.CreateSubAccountInput
type CustomerAccount ¶
type CustomerAccount struct {
*Account
}
type CustomerAccruedAccount ¶
type CustomerAccruedAccount struct {
*CustomerAccount
}
CustomerAccruedAccount implements ledger.CustomerAccruedAccount.
func (*CustomerAccruedAccount) GetSubAccountForRoute ¶
func (a *CustomerAccruedAccount) GetSubAccountForRoute(ctx context.Context, params ledger.CustomerAccruedRouteParams) (ledger.SubAccount, error)
GetSubAccountForRoute finds or creates a sub-account for the given route. Accrued accounts are routed by currency only.
type CustomerFBOAccount ¶
type CustomerFBOAccount struct {
*CustomerAccount
}
CustomerFBOAccount implements ledger.CustomerFBOAccount.
func (*CustomerFBOAccount) GetSubAccountForRoute ¶
func (a *CustomerFBOAccount) GetSubAccountForRoute(ctx context.Context, params ledger.CustomerFBORouteParams) (ledger.SubAccount, error)
GetSubAccountForRoute finds or creates a sub-account for the given route.
type CustomerReceivableAccount ¶
type CustomerReceivableAccount struct {
*CustomerAccount
}
CustomerReceivableAccount implements ledger.CustomerReceivableAccount.
func (*CustomerReceivableAccount) GetSubAccountForRoute ¶
func (a *CustomerReceivableAccount) GetSubAccountForRoute(ctx context.Context, params ledger.CustomerReceivableRouteParams) (ledger.SubAccount, error)
GetSubAccountForRoute finds or creates a sub-account for the given route.
type ListAccountsInput ¶
type ListAccountsInput = ledger.ListAccountsInput
type ListSubAccountsInput ¶
type ListSubAccountsInput = ledger.ListSubAccountsInput
type Repo ¶
type Repo interface {
entutils.TxCreator
// CreateAccount creates a new account
CreateAccount(ctx context.Context, input CreateAccountInput) (*AccountData, error)
// GetAccountByID returns the account by its ID
GetAccountByID(ctx context.Context, id models.NamespacedID) (*AccountData, error)
// EnsureSubAccount creates a new sub-account or returns the existing one if the route already exists.
EnsureSubAccount(ctx context.Context, input CreateSubAccountInput) (*SubAccountData, error)
// GetSubAccountByID returns the sub-account by its ID
GetSubAccountByID(ctx context.Context, id models.NamespacedID) (*SubAccountData, error)
// ListSubAccounts returns sub-accounts for account + route filters
ListSubAccounts(ctx context.Context, input ListSubAccountsInput) ([]*SubAccountData, error)
// ListAccounts returns accounts filtered by type within a namespace
ListAccounts(ctx context.Context, input ListAccountsInput) ([]*AccountData, error)
}
type Service ¶
type Service interface {
ledger.AccountCatalog
ledger.AccountLocker
}
type SubAccount ¶
type SubAccount struct {
// contains filtered or unexported fields
}
func NewSubAccountFromData ¶
func NewSubAccountFromData(data SubAccountData) (*SubAccount, error)
func (*SubAccount) AccountID ¶
func (s *SubAccount) AccountID() models.NamespacedID
func (*SubAccount) Address ¶
func (s *SubAccount) Address() ledger.PostingAddress
func (*SubAccount) Route ¶
func (s *SubAccount) Route() ledger.Route
type SubAccountCreatorLister ¶
type SubAccountCreatorLister interface {
ListSubAccounts(ctx context.Context, input ledger.ListSubAccountsInput) ([]ledger.SubAccount, error)
EnsureSubAccount(ctx context.Context, input ledger.CreateSubAccountInput) (ledger.SubAccount, error)
}
SubAccountCreatorLister is used by account types to find-or-create sub-accounts for a given route.
type SubAccountData ¶
type SubAccountData struct {
ID string
Namespace string
Annotations models.Annotations
CreatedAt time.Time
AccountID string
AccountType ledger.AccountType
Route ledger.Route
RouteMeta SubAccountRouteData
}
type SubAccountRouteData ¶
type SubAccountRouteData struct {
ID string
RoutingKeyVersion ledger.RoutingKeyVersion
RoutingKey string
}