fixed tg message
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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 \"<amount> <currency>\" (e.g., 12.34 USD).")
|
||||
return builder.String()
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user