fix: Show Processing status orders in Pending Payment tab
- Modified OrdersController to include Processing (legacy) status in pending tab - Updated badge count to include Processing orders in PendingPaymentCount - Added database reset script that preserves bot tokens and integrations Processing status (OrderStatus=20) is a legacy unpaid status that should be visible in the Pending Payment workflow to allow staff to retry failed payment creation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e52526b6f9
commit
e534e51b91
@ -23,7 +23,10 @@ public class OrdersController : Controller
|
||||
switch (tab.ToLower())
|
||||
{
|
||||
case "pending":
|
||||
ViewData["Orders"] = await _orderService.GetOrdersByStatusAsync(LittleShop.Enums.OrderStatus.PendingPayment);
|
||||
// Include both PendingPayment and legacy Processing status (orders stuck without payment)
|
||||
var pendingOrders = await _orderService.GetOrdersByStatusAsync(LittleShop.Enums.OrderStatus.PendingPayment);
|
||||
var processingOrders = await _orderService.GetOrdersByStatusAsync(LittleShop.Enums.OrderStatus.Processing);
|
||||
ViewData["Orders"] = pendingOrders.Concat(processingOrders).OrderByDescending(o => o.CreatedAt);
|
||||
ViewData["TabTitle"] = "Pending Payment";
|
||||
break;
|
||||
case "accept":
|
||||
|
||||
63
LittleShop/Migrations/reset-preserve-config.sql
Normal file
63
LittleShop/Migrations/reset-preserve-config.sql
Normal file
@ -0,0 +1,63 @@
|
||||
-- ============================================================================
|
||||
-- LittleShop Database Reset - Preserve Bot & SilverPay Configuration
|
||||
-- ============================================================================
|
||||
-- This script clears all transactional data while preserving:
|
||||
-- - Bot registrations and tokens
|
||||
-- - User accounts (admin)
|
||||
-- - SilverPay integration settings
|
||||
-- - Push notification subscriptions
|
||||
-- ============================================================================
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 1: Clear Transactional Data (Orders, Payments, Messages)
|
||||
-- ============================================================================
|
||||
|
||||
DELETE FROM CryptoPayments;
|
||||
DELETE FROM OrderItems;
|
||||
DELETE FROM Orders;
|
||||
DELETE FROM CustomerMessages;
|
||||
DELETE FROM Customers;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 2: Clear Product Catalog
|
||||
-- ============================================================================
|
||||
|
||||
DELETE FROM ProductPhotos;
|
||||
DELETE FROM ProductMultiBuys;
|
||||
DELETE FROM ProductVariants;
|
||||
DELETE FROM Products;
|
||||
DELETE FROM Categories;
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 3: Reset Auto-Increment Sequences (optional, for clean IDs)
|
||||
-- ============================================================================
|
||||
|
||||
DELETE FROM sqlite_sequence WHERE name IN (
|
||||
'CryptoPayments', 'OrderItems', 'Orders', 'CustomerMessages',
|
||||
'Customers', 'ProductPhotos', 'ProductMultiBuys',
|
||||
'ProductVariants', 'Products', 'Categories'
|
||||
);
|
||||
|
||||
-- ============================================================================
|
||||
-- STEP 4: Verify Preserved Data
|
||||
-- ============================================================================
|
||||
|
||||
-- These should return rows (data preserved):
|
||||
-- SELECT COUNT(*) AS BotRegistrations FROM BotRegistrations WHERE IsActive = 1;
|
||||
-- SELECT COUNT(*) AS AdminUsers FROM Users WHERE Role = 'Admin';
|
||||
-- SELECT COUNT(*) AS PushSubscriptions FROM PushSubscriptions;
|
||||
|
||||
-- These should return 0 (data cleared):
|
||||
-- SELECT COUNT(*) AS Orders FROM Orders;
|
||||
-- SELECT COUNT(*) AS Products FROM Products;
|
||||
-- SELECT COUNT(*) AS Categories FROM Categories;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- ============================================================================
|
||||
-- Success! Database reset complete.
|
||||
-- Preserved: Bot tokens, Admin users, Push subscriptions
|
||||
-- Cleared: Orders, Products, Categories, Customers, Payments
|
||||
-- ============================================================================
|
||||
@ -616,7 +616,8 @@ public class OrderService : IOrderService
|
||||
|
||||
var statusCounts = new OrderStatusCountsDto
|
||||
{
|
||||
PendingPaymentCount = orders.Count(o => o.Status == OrderStatus.PendingPayment),
|
||||
// Include legacy Processing status in PendingPayment count (orders stuck without payment)
|
||||
PendingPaymentCount = orders.Count(o => o.Status == OrderStatus.PendingPayment || o.Status == OrderStatus.Processing),
|
||||
RequiringActionCount = orders.Count(o => o.Status == OrderStatus.PaymentReceived),
|
||||
ForPackingCount = orders.Count(o => o.Status == OrderStatus.Accepted),
|
||||
DispatchedCount = orders.Count(o => o.Status == OrderStatus.Dispatched),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user