Fix: Add TeleBot integration and expired payment handling

TeleBot Configuration:
- Added TeleBot API URL and API key to docker-compose.yml
- Configured to connect to telebot-service:5000 internally
- Enables customer notifications via Telegram bot

Expired Payment Handling:
- Auto-cancel orders when payment status is Expired
- Only cancels orders in PendingPayment status
- Logs cancellation for audit trail

Customer View Improvements:
- Hide cancelled orders from customer order lists
- Filters applied to both GetOrdersByIdentityAsync and GetOrdersByCustomerIdAsync
- Prevents confusion from displaying cancelled/expired orders

This resolves:
- No notifications to customers (TeleBot not configured)
- No notifications to admin (TeleBot connection failed)
- Expired orders remaining visible to customers
- Orders not auto-cancelled when payment expires

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-06 16:55:19 +01:00
parent cede0e7c47
commit 6c95ed3145
3 changed files with 23 additions and 13 deletions

View File

@@ -51,7 +51,7 @@ public class OrderService : IOrderService
.Include(o => o.Items)
.ThenInclude(oi => oi.ProductVariant)
.Include(o => o.Payments)
.Where(o => o.IdentityReference == identityReference)
.Where(o => o.IdentityReference == identityReference && o.Status != OrderStatus.Cancelled)
.OrderByDescending(o => o.CreatedAt)
.ToListAsync();
@@ -69,7 +69,7 @@ public class OrderService : IOrderService
.Include(o => o.Items)
.ThenInclude(oi => oi.ProductVariant)
.Include(o => o.Payments)
.Where(o => o.CustomerId == customerId)
.Where(o => o.CustomerId == customerId && o.Status != OrderStatus.Cancelled)
.OrderByDescending(o => o.CreatedAt)
.ToListAsync();