issuer

package
v0.0.0-...-66e3c94 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is a HTTP API for the issuer service

func NewAPI

func NewAPI(issuer *Service) *API

func (*API) AppendRoutes

func (a *API) AppendRoutes(r chi.Router)

type App

type App struct {
	Addr              string
	ISO8583ServerAddr string
	// contains filtered or unexported fields
}

App is the main application, it contains all the components of the issuer service and is responsible for starting and stopping them.

func NewApp

func NewApp(logger *slog.Logger, config *Config) *App

func (*App) Shutdown

func (a *App) Shutdown()

func (*App) Start

func (a *App) Start() error

type Config

type Config struct {
	HTTPAddr    string
	ISO8583Addr string
}

Config is a configuration for the issuer application

func DefaultConfig

func DefaultConfig() *Config

type Repository

type Repository struct {
	Cards        []*models.Card
	Accounts     []*models.Account
	Transactions []*models.Transaction
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository() *Repository

func (*Repository) CreateAccount

func (r *Repository) CreateAccount(account *models.Account) error

func (*Repository) CreateCard

func (r *Repository) CreateCard(card *models.Card) error

func (*Repository) CreateTransaction

func (r *Repository) CreateTransaction(transaction *models.Transaction) error

func (*Repository) FindCardForAuthorization

func (r *Repository) FindCardForAuthorization(card models.Card) (*models.Card, error)

func (*Repository) GetAccount

func (r *Repository) GetAccount(accountID string) (*models.Account, error)

func (*Repository) ListTransactions

func (r *Repository) ListTransactions(accountID string) ([]*models.Transaction, error)

ListTransactions returns all transactions for a given account ID.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo *Repository) *Service

func (*Service) AuthorizeRequest

func (*Service) CreateAccount

func (i *Service) CreateAccount(req models.CreateAccount) (*models.Account, error)

func (*Service) GetAccount

func (i *Service) GetAccount(accountID string) (*models.Account, error)

func (*Service) IssueCard

func (i *Service) IssueCard(accountID string) (*models.Card, error)

func (*Service) ListTransactions

func (i *Service) ListTransactions(accountID string) ([]*models.Transaction, error)

ListTransactions returns a list of transactions for the given account ID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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