transactions

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: Unlicense Imports: 19 Imported by: 0

Documentation

Overview

Package transactions is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTransactionNotFound                   = errors.New("no transaction found with these filters")
	ErrFailLockAccount                       = errors.New("was not possible to lock account to process the operation")
	ErrMultpleTransactionsFound              = errors.New("multiple transactions found with these filters")
	ErrFromAccountToAccountShouldBeDifferent = errors.New("the from account and to account should not be equal")
	ErrAccountNotfound                       = errors.New("the to account could be found")
	ErrGetAccountBalance                     = errors.New("received error when get the account balance")
	ErrBalanceInsufficientFunds              = errors.New("insufficient funds to complete the transaction")
	ErrAccountInactive                       = errors.New("the account related to the transaction must be active")
	ErrInsufficientDailyLimit                = errors.New("the account has insufficient daily limit")
)

Functions

This section is empty.

Types

type MockRepository

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

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) Create

func (m *MockRepository) Create(ctx context.Context, model transactionModel) (transactionModel, error)

Create mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) GetByFilter

func (m *MockRepository) GetByFilter(ctx context.Context, filter transactionFilter) ([]transactionModel, error)

GetByFilter mocks base method.

type MockRepositoryMockRecorder

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

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) Create

func (mr *MockRepositoryMockRecorder) Create(ctx, model interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) GetByFilter

func (mr *MockRepositoryMockRecorder) GetByFilter(ctx, filter interface{}) *gomock.Call

GetByFilter indicates an expected call of GetByFilter.

type Repository

type Repository interface {
	Create(ctx context.Context, model transactionModel) (transactionModel, error)
	GetByFilter(ctx context.Context, filter transactionFilter) ([]transactionModel, error)
}

func NewRepository

func NewRepository(t tracer.Tracer, db database.Database) Repository

type Service

type Service interface {
	CreateCredit(ctx context.Context, transaction Transaction) (Transaction, error)
	CreateDebit(ctx context.Context, transaction Transaction) (Transaction, error)
	CreateP2P(ctx context.Context, transaction Transaction) (Transaction, error)
	GetByID(ctx context.Context, id uuid.UUID) (Transaction, error)
}

type Transaction

type Transaction struct {
	ID          uuid.UUID
	From        uuid.UUID
	To          uuid.UUID
	Type        TransactionType
	Amount      float64
	Description string
}

type TransactionType

type TransactionType string
var (
	CreditTransaction TransactionType = "CREDIT"
	DebitTransaction  TransactionType = "DEBIT"
	P2PTransaction    TransactionType = "P2P"
)

Jump to

Keyboard shortcuts

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