From 5013e6035885ddf3a1f591b0110b950fa0b87e0f Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Wed, 24 Sep 2025 19:26:40 +0100 Subject: [PATCH] Fix TeleBot compilation errors - use RequiredAmount property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed CryptoAmount property that doesn't exist - Display £ amounts with note about needing conversion - Show actual crypto amounts when less than 1.0 --- TeleBot/TeleBot/UI/MessageFormatter.cs | 33 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/TeleBot/TeleBot/UI/MessageFormatter.cs b/TeleBot/TeleBot/UI/MessageFormatter.cs index 2eb9189..43bc38e 100644 --- a/TeleBot/TeleBot/UI/MessageFormatter.cs +++ b/TeleBot/TeleBot/UI/MessageFormatter.cs @@ -290,8 +290,12 @@ namespace TeleBot.UI { sb.AppendLine($" Address: `{payment.WalletAddress}`"); } - var cryptoAmount = payment.CryptoAmount > 0 ? payment.CryptoAmount.ToString("F8") : payment.RequiredAmount.ToString("F2"); - sb.AppendLine($" Amount: {cryptoAmount} {FormatCurrency(payment.Currency)}"); + // Check if amount looks like a crypto amount (less than 1 for typical orders) + var isCryptoAmount = payment.RequiredAmount < 1.0m; + var amountDisplay = isCryptoAmount + ? $"{payment.RequiredAmount:F8} {FormatCurrency(payment.Currency)}" + : $"£{payment.RequiredAmount:F2} (needs conversion to {FormatCurrency(payment.Currency)})"; + sb.AppendLine($" Amount: {amountDisplay}"); } } @@ -304,17 +308,30 @@ namespace TeleBot.UI sb.AppendLine($"💰 *Payment Instructions*\n"); sb.AppendLine($"*Currency:* {FormatCurrency(payment.Currency)}"); - // 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) + // Check if amount looks like a crypto amount (less than 1 for typical orders) + var isCryptoAmount = payment.RequiredAmount < 1.0m; + if (isCryptoAmount) { - sb.AppendLine($"*Order Total:* £{payment.RequiredAmount:F2} (awaiting rate conversion)"); + sb.AppendLine($"*Amount:* `{payment.RequiredAmount:F8} {FormatCurrency(payment.Currency)}`"); + } + else + { + // This looks like a GBP amount that needs conversion + sb.AppendLine($"*Order Total:* £{payment.RequiredAmount:F2}"); + sb.AppendLine($"*Note:* Amount needs conversion to {FormatCurrency(payment.Currency)}"); + sb.AppendLine($"*Please check payment link for actual crypto amount*"); } sb.AppendLine($"*Status:* {FormatPaymentStatus(payment.Status)}"); sb.AppendLine($"*Expires:* {payment.ExpiresAt:yyyy-MM-dd HH:mm} UTC"); - sb.AppendLine($"\n*Send exactly {cryptoAmount} {FormatCurrency(payment.Currency)} to:*"); + if (isCryptoAmount) + { + sb.AppendLine($"\n*Send exactly {payment.RequiredAmount:F8} {FormatCurrency(payment.Currency)} to:*"); + } + else + { + sb.AppendLine($"\n*Wallet Address:*"); + } sb.AppendLine($"`{payment.WalletAddress}`"); if (!string.IsNullOrEmpty(payment.BTCPayCheckoutUrl))