commit b4d9addb3eec7f71eebaef66d870aca9edf97284
parent 6e19f2beecba37bc063d285a8767625946069143
Author: Joel-Haeberli <haebu@rubigen.ch>
Date: Mon, 3 Jun 2024 21:03:20 +0200
fix: enhance logging
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/c2ec/api-bank-integration.go b/c2ec/api-bank-integration.go
@@ -3,6 +3,7 @@ package main
import (
"context"
"encoding/base64"
+ "errors"
"fmt"
http "net/http"
"strconv"
@@ -383,6 +384,12 @@ func formatWithdrawalOrErrorStatus(w *Withdrawal) ([]byte, int) {
return nil, HTTP_INTERNAL_SERVER_ERROR
}
+ client := PROVIDER_CLIENTS[operator.Name]
+ if client == nil {
+ LogError("bank-integration-api", errors.New("no provider client registered for provider "+operator.Name))
+ return nil, HTTP_INTERNAL_SERVER_ERROR
+ }
+
if amount, err := ToAmount(w.Amount); err != nil {
LogError("bank-integration-api", err)
return nil, HTTP_INTERNAL_SERVER_ERROR
@@ -395,7 +402,7 @@ func formatWithdrawalOrErrorStatus(w *Withdrawal) ([]byte, int) {
Status: w.WithdrawalStatus,
Amount: FormatAmount(amount, CONFIG.Server.CurrencyFractionDigits),
CardFees: FormatAmount(fees, CONFIG.Server.CurrencyFractionDigits),
- SenderWire: fmt.Sprintf("payto://%s/%d", operator.PaytoTargetType, w.ProviderTransactionId),
+ SenderWire: client.FormatPayto(w), // fmt.Sprintf("payto://%s/%d", operator.PaytoTargetType, w.ProviderTransactionId),
WireTypes: []string{operator.PaytoTargetType},
ReservePubKey: EddsaPublicKey((encodeCrock(w.ReservePubKey))),
SuggestedExchange: CONFIG.Server.ExchangeBaseUrl,