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

@@ -6,6 +6,7 @@ import (
"github.com/tech/sendico/pkg/db/storable"
pkgmodel "github.com/tech/sendico/pkg/model"
pmodel "github.com/tech/sendico/pkg/model"
"github.com/tech/sendico/pkg/mservice"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
)
@@ -23,17 +24,17 @@ type ManagedWallet struct {
storable.Base `bson:",inline" json:",inline"`
pkgmodel.Describable `bson:",inline" json:",inline"`
IdempotencyKey string `bson:"idempotencyKey" json:"idempotencyKey"`
WalletRef string `bson:"walletRef" json:"walletRef"`
OrganizationRef string `bson:"organizationRef" json:"organizationRef"`
OwnerRef string `bson:"ownerRef" json:"ownerRef"`
Network string `bson:"network" json:"network"`
TokenSymbol string `bson:"tokenSymbol" json:"tokenSymbol"`
ContractAddress string `bson:"contractAddress" json:"contractAddress"`
DepositAddress string `bson:"depositAddress" json:"depositAddress"`
KeyReference string `bson:"keyReference,omitempty" json:"keyReference,omitempty"`
Status ManagedWalletStatus `bson:"status" json:"status"`
Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"`
IdempotencyKey string `bson:"idempotencyKey" json:"idempotencyKey"`
WalletRef string `bson:"walletRef" json:"walletRef"`
OrganizationRef string `bson:"organizationRef" json:"organizationRef"`
OwnerRef string `bson:"ownerRef" json:"ownerRef"`
Network pkgmodel.ChainNetwork `bson:"network" json:"network"`
TokenSymbol string `bson:"tokenSymbol" json:"tokenSymbol"`
ContractAddress string `bson:"contractAddress" json:"contractAddress"`
DepositAddress string `bson:"depositAddress" json:"depositAddress"`
KeyReference string `bson:"keyReference,omitempty" json:"keyReference,omitempty"`
Status ManagedWalletStatus `bson:"status" json:"status"`
Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"`
}
// Collection implements storable.Storable.
@@ -66,7 +67,7 @@ type ManagedWalletFilter struct {
// - pointer to empty string: filter for wallets where owner_ref is empty
// - pointer to a value: filter for wallets where owner_ref matches
OwnerRefFilter *string
Network string
Network pmodel.ChainNetwork
TokenSymbol string
Cursor string
Limit int32
@@ -93,7 +94,6 @@ func (m *ManagedWallet) Normalize() {
m.Description = &desc
}
}
m.Network = strings.TrimSpace(strings.ToLower(m.Network))
m.TokenSymbol = strings.TrimSpace(strings.ToUpper(m.TokenSymbol))
m.ContractAddress = strings.TrimSpace(strings.ToLower(m.ContractAddress))
m.DepositAddress = normalizeWalletAddress(m.DepositAddress)