Documentation ¶
Index ¶
- Variables
- type Card
- type CreateCommand
- type Repository
- type Service
- func (s Service) Create(ctx context.Context, args any) error
- func (s Service) Delete(ctx context.Context, id string) error
- func (s Service) GetByID(ctx context.Context, id string) (View, error)
- func (s Service) List(ctx context.Context, cr storage.Criteria) ([]View, storage.PageToken, error)
- func (s Service) ListUserCards(ctx context.Context, cr storage.Criteria, userID string) ([]View, storage.PageToken, error)
- func (s Service) Update(ctx context.Context, args any) error
- type TypeCard
- type UpdateCommand
- type View
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = exception.ResourceNotFound{Resource: "card"} ErrInvalidCardType = exception.InvalidParameter{ Field: "card", ValidValues: "CREDIT,DEBIT", } ErrCreditWithAccount = exception.DomainGeneric{ Code: "InvalidCreditCard", Parent: errors.New("credit cards are not allowed to attach financial accounts"), } )
Functions ¶
This section is empty.
Types ¶
type Card ¶
type Card struct { ID string User user.User // req, FK -> users FinancialAccount *financialaccount.FinancialAccount // FK -> financial_accounts (nullable on credit cards) DisplayName string // req BankName string LastDigits uint16 CardType TypeCard // enum: credit/debit, req Balance float64 // nullable BalanceLimit float64 // nullable CurrencyCode string customtype.Auditable }
Card financial instrument issued by a financial institution as component for interactions between a User and either a FinancialAccount or credit line.
type CreateCommand ¶
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(r Repository, accRepo financialaccount.Repository) Service
func (Service) ListUserCards ¶
type UpdateCommand ¶
type UpdateCommand struct {
// contains filtered or unexported fields
}
type View ¶
type View struct { ID string `json:"card_id"` User *user.View `json:"user"` FinancialAccount *financialaccount.View `json:"financial_account"` DisplayName string `json:"display_name"` BankName *string `json:"bank_name"` LastDigits *uint16 `json:"last_digits"` CardType string `json:"card_type"` Balance float64 `json:"balance"` BalanceLimit *float64 `json:"balance_limit"` CurrencyCode string `json:"currency_code"` customtype.Auditable }
Click to show internal directories.
Click to hide internal directories.