feat: transfer funds between accounts
All checks were successful
Deploy / build-and-deploy (push) Successful in 1m32s

This commit is contained in:
juancwu 2026-05-04 02:18:30 +00:00
commit ff237e2fab
14 changed files with 1186 additions and 60 deletions

View file

@ -147,9 +147,12 @@ func accountActivityTxMessage(spaceID, accountID string, log *model.TransactionA
switch log.Action {
case model.TransactionAuditActionCreated:
var meta struct {
TransactionType string `json:"transaction_type"`
Title string `json:"title"`
Amount string `json:"amount"`
TransactionType string `json:"transaction_type"`
Title string `json:"title"`
Amount string `json:"amount"`
TransferRole string `json:"transfer_role"`
TransferOtherAcct string `json:"transfer_other_acct"`
TransferOtherName string `json:"transfer_other_name"`
}
_ = json.Unmarshal(log.Metadata, &meta)
title := meta.Title
@ -161,6 +164,20 @@ func accountActivityTxMessage(spaceID, accountID string, log *model.TransactionA
if meta.Amount != "" {
amountSuffix = fmt.Sprintf(" for $%s", templEscape(meta.Amount))
}
// Transfer events get a more descriptive sentence so users can see
// which side this entry is and where the money went / came from.
if meta.TransferRole != "" {
direction := "to"
if meta.TransferRole == "destination" {
direction = "from"
}
otherName := meta.TransferOtherName
if otherName == "" {
otherName = "another account"
}
return fmt.Sprintf("%s transferred %s%s %s %s.",
actor, titleHTML, amountSuffix, templEscape(direction), bold(otherName))
}
return fmt.Sprintf("%s added a %s %s%s.",
actor, templEscape(transactionTypeLabel(meta.TransactionType)), titleHTML, amountSuffix)
case model.TransactionAuditActionEdited: