account

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID              string         `json:"id"`
	Name            string         `json:"name"`
	ParentAccountID *string        `json:"parentAccountId,omitempty"`
	EntityID        string         `json:"entityId"`
	InstrumentCode  string         `json:"instrumentCode"`
	OrganizationID  string         `json:"organizationId"`
	LedgerID        string         `json:"ledgerId"`
	PortfolioID     string         `json:"portfolioId"`
	ProductID       string         `json:"productId"`
	Balance         Balance        `json:"balance"`
	Status          Status         `json:"status"`
	AllowSending    bool           `json:"allowSending"`
	AllowReceiving  bool           `json:"allowReceiving"`
	Alias           *string        `json:"alias"`
	Type            string         `json:"type"`
	CreatedAt       time.Time      `json:"createdAt"`
	UpdatedAt       time.Time      `json:"updatedAt"`
	DeletedAt       *time.Time     `json:"deletedAt"`
	Metadata        map[string]any `json:"metadata"`
}

Account is a struct designed to encapsulate response payload data.

type AccountPostgreSQLModel

type AccountPostgreSQLModel struct {
	ID                string
	Name              string
	ParentAccountID   *string
	EntityID          string
	InstrumentCode    string
	OrganizationID    string
	LedgerID          string
	PortfolioID       string
	ProductID         string
	AvailableBalance  *float64
	OnHoldBalance     *float64
	BalanceScale      *float64
	Status            string
	StatusDescription *string
	AllowSending      bool
	AllowReceiving    bool
	Alias             *string
	Type              string
	CreatedAt         time.Time
	UpdatedAt         time.Time
	DeletedAt         sql.NullTime
	Metadata          map[string]any
}

AccountPostgreSQLModel represents the entity Account into SQL context in Database

func (*AccountPostgreSQLModel) FromEntity

func (t *AccountPostgreSQLModel) FromEntity(account *Account)

FromEntity converts a request entity Account to AccountPostgreSQLModel

func (*AccountPostgreSQLModel) ToEntity

func (t *AccountPostgreSQLModel) ToEntity() *Account

ToEntity converts an AccountPostgreSQLModel to a response entity Account

type Balance

type Balance struct {
	Available *float64 `json:"available"`
	OnHold    *float64 `json:"onHold"`
	Scale     *float64 `json:"scale"`
}

Balance structure for marshaling/unmarshalling JSON.

func (Balance) IsEmpty

func (b Balance) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type CreateAccountInput

type CreateAccountInput struct {
	InstrumentCode  string         `json:"instrumentCode"`
	Name            string         `json:"name"`
	Alias           *string        `json:"alias"`
	Type            string         `json:"type"`
	ParentAccountID *string        `json:"parentAccountId"`
	ProductID       string         `json:"productId"`
	EntityID        *string        `json:"entityId"`
	Status          Status         `json:"status"`
	Metadata        map[string]any `json:"metadata"`
}

CreateAccountInput is a struct design to encapsulate request create payload data.

type Repository

type Repository interface {
	Create(ctx context.Context, account *Account) (*Account, error)
	FindAll(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID) ([]*Account, error)
	Find(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) (*Account, error)
	FindByAlias(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, alias string) (bool, error)
	ListByIDs(ctx context.Context, organizationID, ledgerID, portfolioID uuid.UUID, ids []uuid.UUID) ([]*Account, error)
	Update(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID, account *Account) (*Account, error)
	Delete(ctx context.Context, organizationID, ledgerID, portfolioID, id uuid.UUID) error
}

Repository provides an interface for operations related to account entities.

type Status

type Status struct {
	Code        string  `json:"code"`
	Description *string `json:"description"`
}

Status structure for marshaling/unmarshalling JSON.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type UpdateAccountInput

type UpdateAccountInput struct {
	Name           string         `json:"name"`
	Status         Status         `json:"status"`
	Alias          *string        `json:"alias"`
	AllowSending   bool           `json:"allowSending"`
	AllowReceiving bool           `json:"allowReceiving"`
	ProductID      string         `json:"productId"`
	Metadata       map[string]any `json:"metadata"`
}

UpdateAccountInput is a struct design to encapsulate request update payload data.

Jump to

Keyboard shortcuts

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