usecase

package
v0.0.0-...-26a0867 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package usecase contains the usecases of the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalanceChecker

type AccountBalanceChecker interface {
	// BalanceCheck checks whether the account has enough balance or not from a storage.
	//
	// Returns the bank account detail when ever the account has enough balance, otherwise error
	BalanceCheck(ctx context.Context, accountState model.BankAccountState, amount model.Cents) (*model.BankAccount, error)
}

AccountBalanceChecker is a storage interface that defines the functionality to check the account balance.

type BalanceUpdater

type BalanceUpdater interface {
	// BalanceUpdate updates the account balance from a storage.
	BalanceUpdate(ctx context.Context, accountID model.BankAccountID, amount model.Cents) error
}

BalanceUpdater is a storage interface that defines the functionality to update the account balance.

type TransactionAdder

type TransactionAdder interface {
	// Add adds a transaction into a storage.
	Add(ctx context.Context, transactionStates []model.TransactionState) error
}

TransactionAdder is a storage interface that defines the functionality to add the transaction.

type TransactionBulk

type TransactionBulk interface {
	// TransactionBulk use case functionality to process a transaction in bulk.
	TransactionBulk(ctx context.Context, input TransactionBulkInput) error
}

TransactionBulk defines the functionality of the use case TransactionBulk used to process a transaction in bulk.

func NewTransactionBulk

func NewTransactionBulk(
	logger ctxd.Logger,
	storage *sqluct.Storage,
	checker AccountBalanceChecker,
	didacticer BalanceUpdater,
	adder TransactionAdder,
) TransactionBulk

NewTransactionBulk creates an instance of TransactionBulk use case.

type TransactionBulkInput

type TransactionBulkInput struct {
	OrganizationName string
	OrganizationIban string
	OrganizationBic  string
	CreditTransfers  []TransactionBulkTransferInput
}

TransactionBulkInput contains all the inputs require executing TransactionBulk use case.

type TransactionBulkTransferInput

type TransactionBulkTransferInput struct {
	Amount           float64
	Currency         string
	CounterpartyName string
	CounterpartyBic  string
	CounterpartyIban string
	Description      string
}

TransactionBulkTransferInput contains all the inputs transfer require executing TransactionBulk use case.

Jump to

Keyboard shortcuts

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