From ccc9737d1b63abb42716b6ca8c50dafcbc98be47 Mon Sep 17 00:00:00 2001 From: Stephan D Date: Wed, 4 Feb 2026 13:31:10 +0100 Subject: [PATCH] fixed tg message --- .../internal/service/gateway/service.go | 16 ------------- .../server/notificationimp/confirmation.go | 23 +++++++++++-------- .../orchestrator/card_payout_funding.go | 1 - .../orchestrator/provider_settlement.go | 7 +++--- 4 files changed, 16 insertions(+), 31 deletions(-) diff --git a/api/gateway/tgsettle/internal/service/gateway/service.go b/api/gateway/tgsettle/internal/service/gateway/service.go index adbccb9e..e6f6c863 100644 --- a/api/gateway/tgsettle/internal/service/gateway/service.go +++ b/api/gateway/tgsettle/internal/service/gateway/service.go @@ -556,22 +556,6 @@ func paymentRecordFromIntent(intent *model.PaymentGatewayIntent, confirmReq *mod return record } -func intentFromPayment(record *storagemodel.PaymentRecord) *model.PaymentGatewayIntent { - if record == nil { - return nil - } - return &model.PaymentGatewayIntent{ - PaymentRef: strings.TrimSpace(record.PaymentRef), - PaymentIntentID: strings.TrimSpace(record.PaymentIntentID), - IdempotencyKey: strings.TrimSpace(record.IdempotencyKey), - OutgoingLeg: strings.TrimSpace(record.OutgoingLeg), - QuoteRef: strings.TrimSpace(record.QuoteRef), - IntentRef: strings.TrimSpace(record.IntentRef), - OperationRef: strings.TrimSpace(record.OperationRef), - RequestedMoney: record.RequestedMoney, - } -} - func intentFromSubmitTransfer(req *chainv1.SubmitTransferRequest, defaultRail, defaultChatID string) (*model.PaymentGatewayIntent, error) { if req == nil { return nil, merrors.InvalidArgument("submit_transfer: request is required") diff --git a/api/notification/internal/server/notificationimp/confirmation.go b/api/notification/internal/server/notificationimp/confirmation.go index 22aa2aa0..7890106f 100644 --- a/api/notification/internal/server/notificationimp/confirmation.go +++ b/api/notification/internal/server/notificationimp/confirmation.go @@ -2,6 +2,7 @@ package notificationimp import ( "context" + "fmt" "regexp" "strconv" "strings" @@ -366,22 +367,24 @@ func parseConfirmationReply(text string) (*paymenttypes.Money, string, error) { func confirmationPrompt(req *model.ConfirmationRequest) string { var builder strings.Builder builder.WriteString("Payment confirmation required\n") - if req.PaymentIntentID != "" { - builder.WriteString("Payment intent: ") - builder.WriteString(req.PaymentIntentID) - builder.WriteString("\n") - } if req.QuoteRef != "" { builder.WriteString("Quote ref: ") builder.WriteString(req.QuoteRef) builder.WriteString("\n") } if req.RequestedMoney != nil { - builder.WriteString("Requested: ") - builder.WriteString(req.RequestedMoney.Amount) - builder.WriteString(" ") - builder.WriteString(req.RequestedMoney.Currency) - builder.WriteString("\n") + amountFloat, err := strconv.ParseFloat(req.RequestedMoney.Amount, 64) + if err != nil { + amountFloat = 0 + } + + amount := fmt.Sprintf("%.2f", amountFloat) + + builder.WriteString(fmt.Sprintf( + "\n*Requested: %s %s*\n\n", + amount, + req.RequestedMoney.Currency, + )) } builder.WriteString("Reply with \" \" (e.g., 12.34 USD).") return builder.String() diff --git a/api/payments/orchestrator/internal/service/orchestrator/card_payout_funding.go b/api/payments/orchestrator/internal/service/orchestrator/card_payout_funding.go index f1abc371..6135b892 100644 --- a/api/payments/orchestrator/internal/service/orchestrator/card_payout_funding.go +++ b/api/payments/orchestrator/internal/service/orchestrator/card_payout_funding.go @@ -257,7 +257,6 @@ func (s *Service) submitCardFundingTransfers(ctx context.Context, payment *model updateExecutionPlanTotalNetworkFee(plan) } - s.logger.Warn("Request", zap.Any("intent", intent)) fundResp, err := chainClient.SubmitTransfer(ctx, &chainv1.SubmitTransferRequest{ IdempotencyKey: payment.IdempotencyKey + ":card:fund", OrganizationRef: payment.OrganizationRef.Hex(), diff --git a/api/payments/orchestrator/internal/service/orchestrator/provider_settlement.go b/api/payments/orchestrator/internal/service/orchestrator/provider_settlement.go index 93fc5c76..2b24f0ff 100644 --- a/api/payments/orchestrator/internal/service/orchestrator/provider_settlement.go +++ b/api/payments/orchestrator/internal/service/orchestrator/provider_settlement.go @@ -53,13 +53,12 @@ func (p *paymentExecutor) buildProviderSettlementTransferRequest(payment *model. if strings.TrimSpace(metadata[providerSettlementMetaOutgoingLeg]) == "" { metadata[providerSettlementMetaOutgoingLeg] = strings.ToLower(strings.TrimSpace(string(step.Rail))) } - sourceAmount := resolveDebitAmount(payment, quote, payment.Intent.Amount) - if sourceAmount != nil { + if amount != nil { if strings.TrimSpace(metadata[providerSettlementMetaSourceAmount]) == "" { - metadata[providerSettlementMetaSourceAmount] = strings.TrimSpace(sourceAmount.Amount) + metadata[providerSettlementMetaSourceAmount] = strings.TrimSpace(amount.Amount) } if strings.TrimSpace(metadata[providerSettlementMetaSourceCurrency]) == "" { - metadata[providerSettlementMetaSourceCurrency] = strings.TrimSpace(sourceAmount.Currency) + metadata[providerSettlementMetaSourceCurrency] = strings.TrimSpace(amount.Currency) } }