Orchestrator refactoring + planned amounts

This commit is contained in:
Stephan D
2026-03-11 20:04:10 +01:00
parent 208b4283d0
commit f578278205
111 changed files with 2485 additions and 1517 deletions

View File

@@ -5,6 +5,7 @@ import (
"time"
"github.com/shopspring/decimal"
"github.com/tech/sendico/payments/quotation/internal/shared"
"github.com/tech/sendico/payments/storage/model"
"github.com/tech/sendico/pkg/merrors"
paymenttypes "github.com/tech/sendico/pkg/payments/types"
@@ -23,10 +24,7 @@ type moneyGetter interface {
}
func cloneMoney(input *paymenttypes.Money) *paymenttypes.Money {
if input == nil {
return nil
}
return &paymenttypes.Money{Currency: input.GetCurrency(), Amount: input.GetAmount()}
return shared.CloneModelMoneyRaw(input)
}
func cloneStringList(values []string) []string {
@@ -100,10 +98,7 @@ func protoMoney(m *paymenttypes.Money) *moneyv1.Money {
}
func cloneProtoMoney(input *moneyv1.Money) *moneyv1.Money {
if input == nil {
return nil
}
return &moneyv1.Money{Currency: input.GetCurrency(), Amount: input.GetAmount()}
return shared.CloneProtoMoneyRaw(input)
}
func decimalFromProto(value *moneyv1.Decimal) *paymenttypes.Decimal {

View File

@@ -67,13 +67,7 @@ func BuildFundingGateFromProfile(
}
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
if src == nil {
return nil
}
return &moneyv1.Money{
Amount: strings.TrimSpace(src.GetAmount()),
Currency: strings.TrimSpace(src.GetCurrency()),
}
return shared.CloneProtoMoneyTrim(src)
}
func clonePaymentEndpoint(src *model.PaymentEndpoint) *model.PaymentEndpoint {

View File

@@ -6,6 +6,7 @@ import (
"github.com/shopspring/decimal"
oracleclient "github.com/tech/sendico/fx/oracle/client"
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
"google.golang.org/protobuf/proto"
@@ -31,13 +32,7 @@ const (
)
func cloneProtoMoney(input *moneyv1.Money) *moneyv1.Money {
if input == nil {
return nil
}
return &moneyv1.Money{
Currency: input.GetCurrency(),
Amount: input.GetAmount(),
}
return qshared.CloneProtoMoneyRaw(input)
}
func cloneMetadata(input map[string]string) map[string]string {

View File

@@ -4,6 +4,7 @@ import (
"strings"
"time"
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
"github.com/tech/sendico/payments/storage/model"
payecon "github.com/tech/sendico/pkg/payments/economics"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
@@ -38,13 +39,7 @@ func firstNonEmpty(values ...string) string {
}
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
if src == nil {
return nil
}
return &moneyv1.Money{
Amount: strings.TrimSpace(src.GetAmount()),
Currency: strings.ToUpper(strings.TrimSpace(src.GetCurrency())),
}
return qshared.CloneProtoMoneyTrimUpperCurrency(src)
}
func resolvedSettlementModeFromModel(mode model.SettlementMode) paymentv1.SettlementMode {

View File

@@ -3,19 +3,14 @@ package quote_computation_service
import (
"strings"
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
"github.com/tech/sendico/payments/storage/model"
paymenttypes "github.com/tech/sendico/pkg/payments/types"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
)
func cloneProtoMoney(src *moneyv1.Money) *moneyv1.Money {
if src == nil {
return nil
}
return &moneyv1.Money{
Amount: strings.TrimSpace(src.GetAmount()),
Currency: strings.TrimSpace(src.GetCurrency()),
}
return qshared.CloneProtoMoneyTrim(src)
}
func protoMoneyFromModel(src *paymenttypes.Money) *moneyv1.Money {
@@ -58,13 +53,7 @@ func cloneAsset(src *paymenttypes.Asset) *paymenttypes.Asset {
}
func cloneModelMoney(src *paymenttypes.Money) *paymenttypes.Money {
if src == nil {
return nil
}
return &paymenttypes.Money{
Amount: strings.TrimSpace(src.GetAmount()),
Currency: strings.ToUpper(strings.TrimSpace(src.GetCurrency())),
}
return qshared.CloneModelMoneyTrimUpperCurrency(src)
}
func clonePaymentIntent(src model.PaymentIntent) model.PaymentIntent {

View File

@@ -3,6 +3,7 @@ package quote_response_mapper_v2
import (
"strings"
qshared "github.com/tech/sendico/payments/quotation/internal/shared"
feesv1 "github.com/tech/sendico/pkg/proto/billing/fees/v1"
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
paymentv1 "github.com/tech/sendico/pkg/proto/common/payment/v1"
@@ -12,13 +13,7 @@ import (
)
func cloneMoney(src *moneyv1.Money) *moneyv1.Money {
if src == nil {
return nil
}
return &moneyv1.Money{
Amount: strings.TrimSpace(src.GetAmount()),
Currency: strings.TrimSpace(src.GetCurrency()),
}
return qshared.CloneProtoMoneyTrim(src)
}
func cloneFeeLines(src []*feesv1.DerivedPostingLine) []*feesv1.DerivedPostingLine {