refactored payment orchestration

This commit is contained in:
Stephan D
2026-02-03 00:40:46 +01:00
parent 05d998e0f7
commit 5e87e2f2f9
184 changed files with 3920 additions and 2219 deletions

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/tech/sendico/pkg/model"
"github.com/tech/sendico/pkg/model/account_role"
"go.mongodb.org/mongo-driver/v2/bson"
)
@@ -40,7 +41,7 @@ type Account struct {
// Posting policy & lifecycle
AllowNegative bool `bson:"allowNegative" json:"allowNegative"`
Status model.LedgerAccountStatus `bson:"status" json:"status"`
Role model.AccountRole `bson:"role,omitempty" json:"role,omitempty"`
Role account_role.AccountRole `bson:"role,omitempty" json:"role,omitempty"`
// Legal ownership history
Ownerships []Ownership `bson:"ownerships,omitempty" json:"ownerships,omitempty"`
@@ -78,17 +79,17 @@ func (a *Account) Validate() error {
if role := strings.TrimSpace(string(a.Role)); role != "" {
switch a.Role {
case model.AccountRoleOperating,
model.AccountRoleHold,
model.AccountRoleTransit,
model.AccountRoleSettlement,
model.AccountRoleClearing,
model.AccountRolePending,
model.AccountRoleReserve,
model.AccountRoleLiquidity,
model.AccountRoleFee,
model.AccountRoleChargeback,
model.AccountRoleAdjustment:
case account_role.AccountRoleOperating,
account_role.AccountRoleHold,
account_role.AccountRoleTransit,
account_role.AccountRoleSettlement,
account_role.AccountRoleClearing,
account_role.AccountRolePending,
account_role.AccountRoleReserve,
account_role.AccountRoleLiquidity,
account_role.AccountRoleFee,
account_role.AccountRoleChargeback,
account_role.AccountRoleAdjustment:
default:
veAdd(&verr, "role", "invalid", "unknown account role")
}