messages

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package messages contains extra types used by the application's message definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DailyDebitLimitDate

func DailyDebitLimitDate(t time.Time) string

DailyDebitLimitDate returns the date of a transaction for the purposes of checking daily debit limits.

It normalizes the date to the UTC timezone so that regardless of which timezone is used to schedule the transaction two equivalent times always contribute towards the same day's limit.

func FormatAmount

func FormatAmount(v int64) string

FormatAmount formats a cent amount as dollars.

Types

type DebitFailureReason

type DebitFailureReason string

DebitFailureReason defines reasons why a debits may fail.

const (
	// InsufficientFunds means there was not enough funds available in the
	// account to perform the debit.
	InsufficientFunds DebitFailureReason = "insufficient funds"

	// DailyDebitLimitExceeded means that the debit cannot be performed
	// because it will exceed the account daily debit limit.
	DailyDebitLimitExceeded DebitFailureReason = "daily debit limit exceeded"
)

func (DebitFailureReason) Validate

func (r DebitFailureReason) Validate() error

Validate return an error if r is not a valid reason.

type TransactionType

type TransactionType string

TransactionType defines types of debits.

const (
	// Deposit is a deposit transaction type.
	Deposit TransactionType = "deposit"

	// Withdrawal is a withdrawal transaction type.
	Withdrawal TransactionType = "withdrawal"

	// Transfer is a transfer transaction type.
	Transfer TransactionType = "transfer"
)

func (TransactionType) IsDebit

func (t TransactionType) IsDebit() bool

IsDebit returns true if the transaction type is a debit type.

func (TransactionType) Validate

func (t TransactionType) Validate() error

Validate return an error if t is not a valid transaction type.

Directories

Path Synopsis
Package commands contains the application's command message definitions.
Package commands contains the application's command message definitions.
Package events contains the application's event message definitions.
Package events contains the application's event message definitions.
internal
validation
Package validation contains some message validation helpers.
Package validation contains some message validation helpers.

Jump to

Keyboard shortcuts

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