fix for proto migration

This commit is contained in:
Stephan D
2026-02-11 18:15:04 +01:00
parent fab07fdc8e
commit 7b53ca6cef
62 changed files with 517 additions and 554 deletions

View File

@@ -16,12 +16,13 @@ import (
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
chainv1 "github.com/tech/sendico/pkg/proto/gateway/chain/v1"
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
orchestratorv1 "github.com/tech/sendico/pkg/proto/payments/orchestrator/v1"
quotationv1 "github.com/tech/sendico/pkg/proto/payments/quotation/v1"
sharedv1 "github.com/tech/sendico/pkg/proto/payments/shared/v1"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/timestamppb"
)
func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest) (*orchestratorv1.PaymentQuote, time.Time, error) {
func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *quotationv1.QuotePaymentRequest) (*sharedv1.PaymentQuote, time.Time, error) {
intent := req.GetIntent()
amount := intent.GetAmount()
fxSide := fxv1.Side_SIDE_UNSPECIFIED
@@ -94,7 +95,7 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc
debitAmount, settlementAmount := computeAggregates(payAmount, settlementAmountBeforeFees, feeTotal, networkFee, fxQuote, intent.GetSettlementMode())
quote := &orchestratorv1.PaymentQuote{
quote := &sharedv1.PaymentQuote{
DebitAmount: debitAmount,
DebitSettlementAmount: payAmount,
ExpectedSettlementAmount: settlementAmount,
@@ -116,7 +117,7 @@ func (s *Service) buildPaymentQuote(ctx context.Context, orgRef string, req *orc
return quote, expiresAt, nil
}
func (s *Service) quoteFees(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest, baseAmount *moneyv1.Money) (*feesv1.PrecomputeFeesResponse, error) {
func (s *Service) quoteFees(ctx context.Context, orgRef string, req *quotationv1.QuotePaymentRequest, baseAmount *moneyv1.Money) (*feesv1.PrecomputeFeesResponse, error) {
if !s.deps.fees.available() {
return &feesv1.PrecomputeFeesResponse{}, nil
}
@@ -152,7 +153,7 @@ func (s *Service) quoteFees(ctx context.Context, orgRef string, req *orchestrato
return resp, nil
}
func (s *Service) quoteConversionFees(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest, baseAmount *moneyv1.Money) (*feesv1.PrecomputeFeesResponse, error) {
func (s *Service) quoteConversionFees(ctx context.Context, orgRef string, req *quotationv1.QuotePaymentRequest, baseAmount *moneyv1.Money) (*feesv1.PrecomputeFeesResponse, error) {
if !s.deps.fees.available() {
return &feesv1.PrecomputeFeesResponse{}, nil
}
@@ -196,7 +197,7 @@ func (s *Service) quoteConversionFees(ctx context.Context, orgRef string, req *o
return resp, nil
}
func (s *Service) shouldQuoteConversionFee(ctx context.Context, intent *orchestratorv1.PaymentIntent) bool {
func (s *Service) shouldQuoteConversionFee(ctx context.Context, intent *sharedv1.PaymentIntent) bool {
if intent == nil {
return false
}
@@ -264,7 +265,7 @@ func mergeFeeRules(primary, secondary *feesv1.PrecomputeFeesResponse) []*feesv1.
return rules
}
func ensureFeeAttributes(intent *orchestratorv1.PaymentIntent, baseAmount *moneyv1.Money, attrs map[string]string) map[string]string {
func ensureFeeAttributes(intent *sharedv1.PaymentIntent, baseAmount *moneyv1.Money, attrs map[string]string) map[string]string {
if attrs == nil {
attrs = map[string]string{}
}
@@ -297,7 +298,7 @@ func ensureFeeAttributes(intent *orchestratorv1.PaymentIntent, baseAmount *money
return attrs
}
func feeTriggerForIntent(intent *orchestratorv1.PaymentIntent) feesv1.Trigger {
func feeTriggerForIntent(intent *sharedv1.PaymentIntent) feesv1.Trigger {
if intent == nil {
return feesv1.Trigger_TRIGGER_UNSPECIFIED
}
@@ -308,11 +309,11 @@ func feeTriggerForIntent(intent *orchestratorv1.PaymentIntent) feesv1.Trigger {
return trigger
}
func isManagedWalletEndpoint(endpoint *orchestratorv1.PaymentEndpoint) bool {
func isManagedWalletEndpoint(endpoint *sharedv1.PaymentEndpoint) bool {
return endpoint != nil && endpoint.GetManagedWallet() != nil
}
func isLedgerEndpoint(endpoint *orchestratorv1.PaymentEndpoint) bool {
func isLedgerEndpoint(endpoint *sharedv1.PaymentEndpoint) bool {
return endpoint != nil && endpoint.GetLedger() != nil
}
@@ -333,13 +334,13 @@ func setFeeAttributeIfMissing(attrs map[string]string, key, value string) {
attrs[key] = value
}
func feeOperationFromKind(kind orchestratorv1.PaymentKind) string {
func feeOperationFromKind(kind sharedv1.PaymentKind) string {
switch kind {
case orchestratorv1.PaymentKind_PAYMENT_KIND_PAYOUT:
case sharedv1.PaymentKind_PAYMENT_KIND_PAYOUT:
return "payout"
case orchestratorv1.PaymentKind_PAYMENT_KIND_INTERNAL_TRANSFER:
case sharedv1.PaymentKind_PAYMENT_KIND_INTERNAL_TRANSFER:
return "internal_transfer"
case orchestratorv1.PaymentKind_PAYMENT_KIND_FX_CONVERSION:
case sharedv1.PaymentKind_PAYMENT_KIND_FX_CONVERSION:
return "fx_conversion"
default:
return ""
@@ -358,7 +359,7 @@ func feeCurrencyFromAmount(baseAmount, intentAmount *moneyv1.Money) string {
return ""
}
func endpointTypeFromProto(endpoint *orchestratorv1.PaymentEndpoint) string {
func endpointTypeFromProto(endpoint *sharedv1.PaymentEndpoint) string {
if endpoint == nil {
return ""
}
@@ -376,7 +377,7 @@ func endpointTypeFromProto(endpoint *orchestratorv1.PaymentEndpoint) string {
}
}
func assetFromIntent(intent *orchestratorv1.PaymentIntent) *chainv1.Asset {
func assetFromIntent(intent *sharedv1.PaymentIntent) *chainv1.Asset {
if intent == nil {
return nil
}
@@ -386,7 +387,7 @@ func assetFromIntent(intent *orchestratorv1.PaymentIntent) *chainv1.Asset {
return assetFromEndpoint(intent.GetSource())
}
func assetFromEndpoint(endpoint *orchestratorv1.PaymentEndpoint) *chainv1.Asset {
func assetFromEndpoint(endpoint *sharedv1.PaymentEndpoint) *chainv1.Asset {
if endpoint == nil {
return nil
}
@@ -399,7 +400,7 @@ func assetFromEndpoint(endpoint *orchestratorv1.PaymentEndpoint) *chainv1.Asset
return nil
}
func (s *Service) estimateNetworkFee(ctx context.Context, intent *orchestratorv1.PaymentIntent) (*chainv1.EstimateTransferFeeResponse, error) {
func (s *Service) estimateNetworkFee(ctx context.Context, intent *sharedv1.PaymentIntent) (*chainv1.EstimateTransferFeeResponse, error) {
req := &chainv1.EstimateTransferFeeRequest{
Amount: cloneProtoMoney(intent.GetAmount()),
}
@@ -453,7 +454,7 @@ func (s *Service) estimateNetworkFee(ctx context.Context, intent *orchestratorv1
return resp, nil
}
func (s *Service) requestFXQuote(ctx context.Context, orgRef string, req *orchestratorv1.QuotePaymentRequest) (*oraclev1.Quote, error) {
func (s *Service) requestFXQuote(ctx context.Context, orgRef string, req *quotationv1.QuotePaymentRequest) (*oraclev1.Quote, error) {
if !s.deps.oracle.available() {
if req.GetIntent().GetRequiresFx() {
return nil, merrors.Internal("fx_oracle_unavailable")
@@ -528,7 +529,7 @@ func feesRequiredForRails(sourceRail, destRail model.Rail) bool {
return true
}
func (s *Service) feeLedgerAccountForIntent(intent *orchestratorv1.PaymentIntent) string {
func (s *Service) feeLedgerAccountForIntent(intent *sharedv1.PaymentIntent) string {
if intent == nil || len(s.deps.feeLedgerAccounts) == 0 {
return ""
}
@@ -540,7 +541,7 @@ func (s *Service) feeLedgerAccountForIntent(intent *orchestratorv1.PaymentIntent
return strings.TrimSpace(s.deps.feeLedgerAccounts[key])
}
func (s *Service) assignFeeLedgerAccounts(intent *orchestratorv1.PaymentIntent, lines []*feesv1.DerivedPostingLine) {
func (s *Service) assignFeeLedgerAccounts(intent *sharedv1.PaymentIntent, lines []*feesv1.DerivedPostingLine) {
account := s.feeLedgerAccountForIntent(intent)
key := s.gatewayKeyFromIntent(intent)
@@ -565,7 +566,7 @@ func (s *Service) assignFeeLedgerAccounts(intent *orchestratorv1.PaymentIntent,
s.logger.Debug("Applied fee ledger account mapping", zap.String("gateway", key), zap.String("ledger_account", account), zap.Int("lines", missing))
}
func (s *Service) gatewayKeyFromIntent(intent *orchestratorv1.PaymentIntent) string {
func (s *Service) gatewayKeyFromIntent(intent *sharedv1.PaymentIntent) string {
if intent == nil {
return ""
}