From ddff64991b7de921bcb4e04e05c77fece6068950 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Wed, 24 Sep 2025 19:24:19 +0100 Subject: [PATCH] Fix TeleBot checkout flow and currency display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unnecessary shipping name step (Step 1/5) - now collects all address details in one message - Fix currency display to show crypto amounts instead of GBP values - Display proper BTC amounts instead of showing £39.99 as 39.99 BTC - Tor connectivity already working (verified via telebot-tor container) --- TeleBot/TeleBot/Handlers/CallbackHandler.cs | 18 ++++++++++++++---- TeleBot/TeleBot/UI/MessageFormatter.cs | 17 ++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/TeleBot/TeleBot/Handlers/CallbackHandler.cs b/TeleBot/TeleBot/Handlers/CallbackHandler.cs index ce635c8..2b8e969 100644 --- a/TeleBot/TeleBot/Handlers/CallbackHandler.cs +++ b/TeleBot/TeleBot/Handlers/CallbackHandler.cs @@ -615,12 +615,22 @@ namespace TeleBot.Handlers session.State = SessionState.CheckoutFlow; - // Send new message for checkout instead of editing + // Send new message for checkout - collect all details at once await bot.SendTextMessageAsync( message.Chat.Id, - "📦 *Checkout - Step 1/5*\n\n" + - "Please enter your shipping name:\n\n" + - "_Reply to this message with your name_", + "📦 *Checkout - Delivery Details*\n\n" + + "Please provide all delivery details in one message:\n\n" + + "• Full Name\n" + + "• Street Address\n" + + "• City\n" + + "• Post/Zip Code\n" + + "• Country (or leave blank for UK)\n\n" + + "_Example:_\n" + + "`John Smith\n" + + "123 Main Street\n" + + "London\n" + + "SW1A 1AA\n" + + "United Kingdom`", parseMode: Telegram.Bot.Types.Enums.ParseMode.Markdown ); } diff --git a/TeleBot/TeleBot/UI/MessageFormatter.cs b/TeleBot/TeleBot/UI/MessageFormatter.cs index d9facb8..2eb9189 100644 --- a/TeleBot/TeleBot/UI/MessageFormatter.cs +++ b/TeleBot/TeleBot/UI/MessageFormatter.cs @@ -290,7 +290,8 @@ namespace TeleBot.UI { sb.AppendLine($" Address: `{payment.WalletAddress}`"); } - sb.AppendLine($" Amount: {payment.RequiredAmount}"); + var cryptoAmount = payment.CryptoAmount > 0 ? payment.CryptoAmount.ToString("F8") : payment.RequiredAmount.ToString("F2"); + sb.AppendLine($" Amount: {cryptoAmount} {FormatCurrency(payment.Currency)}"); } } @@ -300,14 +301,20 @@ namespace TeleBot.UI public static string FormatPayment(CryptoPayment payment) { var sb = new StringBuilder(); - + sb.AppendLine($"💰 *Payment Instructions*\n"); sb.AppendLine($"*Currency:* {FormatCurrency(payment.Currency)}"); - sb.AppendLine($"*Amount:* `{payment.RequiredAmount}`"); + // Show crypto amount if available, otherwise show the order amount with note + var cryptoAmount = payment.CryptoAmount > 0 ? payment.CryptoAmount.ToString("F8") : payment.RequiredAmount.ToString("F2"); + sb.AppendLine($"*Amount:* `{cryptoAmount} {FormatCurrency(payment.Currency)}`"); + if (payment.CryptoAmount <= 0) + { + sb.AppendLine($"*Order Total:* £{payment.RequiredAmount:F2} (awaiting rate conversion)"); + } sb.AppendLine($"*Status:* {FormatPaymentStatus(payment.Status)}"); sb.AppendLine($"*Expires:* {payment.ExpiresAt:yyyy-MM-dd HH:mm} UTC"); - - sb.AppendLine($"\n*Send exactly {payment.RequiredAmount} {FormatCurrency(payment.Currency)} to:*"); + + sb.AppendLine($"\n*Send exactly {cryptoAmount} {FormatCurrency(payment.Currency)} to:*"); sb.AppendLine($"`{payment.WalletAddress}`"); if (!string.IsNullOrEmpty(payment.BTCPayCheckoutUrl))