fees

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCalculated

func HandleCalculated(
	uow repository.UnitOfWork,
	logger *slog.Logger,
) eventbus.HandlerFunc

HandleCalculated handles FeesCalculated events. It updates the transaction with the calculated fees and deducts them from the account balance.

Types

type FeeCalculator

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

FeeCalculator handles fee calculation and application to transactions and accounts

func NewFeeCalculator

func NewFeeCalculator(
	txRepo repotransaction.Repository,
	accRepo repoaccount.Repository,
	logger *slog.Logger,
) *FeeCalculator

NewFeeCalculator creates a new FeeCalculator instance Returns nil if any of the required parameters are nil

func (*FeeCalculator) ApplyFees

func (fc *FeeCalculator) ApplyFees(
	ctx context.Context,
	transactionID uuid.UUID,
	fee account.Fee,
) error

ApplyFees applies the calculated fees to a transaction and updates the account balance

Jump to

Keyboard shortcuts

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