Commit Graph

276 Commits

Author SHA1 Message Date
1588c79df0 Add BotActivityTracker service registration 2025-09-25 02:30:40 +01:00
ac4fe688d9 Add bot activity tracking system 2025-09-25 01:28:56 +01:00
d6f8a5e697 Add comprehensive integration test suite with deployment verification
- Created multiple test scripts to verify all system integrations
- test-integration-fixed.sh: Main test suite with all fixes (RECOMMENDED)
- test-integration-simple.sh: Quick verification script
- All 12 tests passing: admin auth, APIs, payments, exchange rates
- Added DEPLOYMENT-VERIFICATION.md with post-deployment testing process
- Tests verify: LittleShop, TeleBot, and SilverPay integration
- Exchange rate fix: Use BTC/GBP format (crypto-to-fiat)
- Payment response updated for new walletAddress field
- Admin login correctly accepts 401 for API testing

IMPORTANT: Run ./test-integration-fixed.sh after EVERY deployment

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 00:04:30 +01:00
f12f35cc48 Implement product variant selection in TeleBot
FEATURES IMPLEMENTED:

1. Enhanced Product Display:
   - Shows multi-buy deals with pricing (e.g., "3 for £25")
   - Displays available variants grouped by type (Color, Flavor, etc.)
   - Clear visual separation between multi-buys and variants

2. Variant Selection Flow:
   - Single item: Select one variant from available options
   - Multi-buy bundles: Select individual variants for each item
   - Example: 3-pack allows choosing Red, Blue, Green individually
   - Visual feedback with checkmarks and counters

3. Smart Cart Management:
   - Tracks selected variants for each cart item
   - Supports both single variant (regular items) and multiple variants (multi-buys)
   - Unique cart entries based on product + variant combination
   - Prevents duplicate multi-buy bundles

4. User Experience Improvements:
   - Clear "Select Color/Flavor" prompts
   - Progress indicator for multi-item selection
   - Confirm button appears when selection complete
   - Clear selection option for multi-buys
   - Back navigation preserves context

TECHNICAL CHANGES:
- ProductCarouselService: Enhanced caption formatting with variants/multi-buys
- MenuBuilder: New VariantSelectionMenu with dynamic button generation
- CallbackHandler: Added handlers for selectvar, setvariant, addvariant, confirmvar
- ShoppingCart: New AddItem overload accepting Product and variant list
- CartItem: Added SelectedVariants list for multi-buy support
- UserSession: Added SelectingVariants state

This update enables customers to:
- See all available product options at a glance
- Choose specific variants when ordering
- Mix and match variants in multi-buy deals
- Get exactly what they want with clear visual feedback

Next steps: Add bot activity tracking for live dashboard

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 23:09:33 +01:00
5530f9e4f5 Add product variants system and live bot activity dashboard
FEATURES IMPLEMENTED:
1. Product Multi-Buys (renamed from Variations for clarity)
   - Quantity-based pricing deals (e.g., 1 for £10, 3 for £25)
   - Renamed UI to "Multi-Buys" with tags icon for better understanding

2. Product Variants (NEW)
   - Support for colors, flavors, sizes, and other product options
   - Separate from multi-buys - these are the actual variations customers choose
   - Admin UI for managing variants per product
   - Updated OrderItem model to store selected variants as JSON array

3. Live Bot Activity Dashboard
   - Real-time view of customer interactions across all bots
   - Shows active users (last 5 minutes)
   - Live activity feed with user actions
   - Statistics including today's activities and trending products
   - Auto-refreshes every 5 seconds for live updates
   - Accessible via "Live Activity" menu item

TECHNICAL CHANGES:
- Modified OrderItem.SelectedVariant to SelectedVariants (JSON array)
- Added BotActivityController for dashboard endpoints
- Created views for variant management (ProductVariants, CreateVariant, EditVariant)
- Updated Products Index to show separate buttons for Multi-Buys and Variants
- Fixed duplicate DTO definitions (removed duplicate files)
- Fixed ApplicationDbContext reference (changed to LittleShopContext)

UI IMPROVEMENTS:
- Multi-Buys: Tags icon, labeled as "pricing deals"
- Variants: Palette icon, labeled as "colors/flavors"
- Live dashboard with animated activity feed
- Visual indicators for active users and trending products
- Mobile-responsive dashboard layout

This update provides the foundation for:
- Customers selecting variants during checkout
- Real-time monitoring of bot usage patterns
- Better understanding of popular products and user behavior

Next steps: Implement variant selection in TeleBot checkout flow

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 23:00:20 +01:00
94b6bd421d Fix HTTP 500 on login and create comprehensive deployment documentation
CRITICAL FIXES:
- Fixed JWT key configuration issue causing HTTP 500 on login
  - Changed environment variable from JWT_SECRET_KEY to Jwt__Key (double underscore)
  - Increased JWT key length to >32 bytes (256 bits) as required by HMAC-SHA256
  - Fixed ASPNETCORE_URLS configuration (not ASPNETCORE_HTTP_PORTS)

DOCUMENTATION CREATED:
- TROUBLESHOOTING.md: Complete troubleshooting guide with common issues and solutions
- deploy-littleshop.sh: Automated deployment script with working configuration
- docker-compose.hostinger.yml: Docker Compose file with all correct environment variables
- Updated WORKING_BASELINE_2024-09-24.md: Added HTTP 500 fix details

ROOT CAUSES IDENTIFIED:
1. JWT key environment variable naming mismatch (Jwt__Key vs JWT_SECRET_KEY)
2. JWT key too short (was 17 bytes, needs >32 bytes)
3. ASP.NET Core URL configuration issue (ASPNETCORE_URLS vs HTTP_PORTS)
4. Database file permissions (must be owned by UID 1654)

WORKING CONFIGURATION:
- Jwt__Key with 79-byte key
- ASPNETCORE_URLS=http://+:8080
- Proper Docker network configuration (littleshop-network)
- SilverPay integration on port 8000 (not 8001)

This commit ensures we have a stable, documented baseline for future updates
and addresses the concern about "one step forward, two steps back" by
providing comprehensive documentation of all fixes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 22:48:25 +01:00
0f9e92130c Fix login: Make username parameter case-insensitive
- Changed parameter names to uppercase (Username, Password)
- Convert to lowercase internally for consistency
- Fixes HTTP 500 error when form submits with lowercase field names
2025-09-24 22:26:16 +01:00
069930fe40 Revert ForwardedHeaders changes - restore working baseline
Login was working before these changes. Reverting to known working state
without ForwardedHeaders middleware which was causing routing issues.
2025-09-24 22:07:14 +01:00
96a4c178bb Fix HTTP 500 login error: Configure anti-forgery and routing for proxy
- Re-enabled ValidateAntiForgeryToken attribute
- Configured anti-forgery for proxy environments with SameAsRequest
- Fixed area routing order and constraints
- Added proper forwarded headers middleware
2025-09-24 22:06:15 +01:00
2fb173696e Fix compilation error: Add using statement for HttpOverrides 2025-09-24 22:02:29 +01:00
2a9039bd7a Fix HTTP 500 on login: Add ForwardedHeaders middleware for proxy support
- Added UseForwardedHeaders to properly handle X-Forwarded-For and X-Forwarded-Proto
- Fixes anti-forgery token validation when behind nginx proxy
- Resolves HTTP 500 errors on POST requests to login endpoint
2025-09-24 21:53:27 +01:00
4aecf22879 Establish working baseline - September 24, 2024
WORKING BASELINE CONFIRMED:
- TeleBot: Checkout flow fixed, currency display corrected
- LittleShop: CSRF tokens fixed, SilverPay integration working
- SilverPay: Payment creation fixed with fiat_amount field
- Network: All containers connected on littleshop-network
- Payments: Successfully creating crypto payments with live exchange rates

Test confirmed: £10 GBP = 0.00011846 BTC at £84,415.99/BTC
All systems operational and integrated.
2025-09-24 21:19:24 +01:00
7809b6e49c Fix SilverPay payment creation - use fiat_amount instead of amount
SilverPay API expects 'fiat_amount' and 'fiat_currency' fields, not 'amount'.
This was causing 422 Unprocessable Entity errors when creating payments.
2025-09-24 21:08:16 +01:00
5013e60358 Fix TeleBot compilation errors - use RequiredAmount property
- Fixed CryptoAmount property that doesn't exist
- Display £ amounts with note about needing conversion
- Show actual crypto amounts when less than 1.0
2025-09-24 19:26:40 +01:00
ddff64991b Fix TeleBot checkout flow and currency display
- 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)
2025-09-24 19:24:19 +01:00
409531fd79 Add detailed TeleBot deployment instructions for manual execution 2025-09-24 18:16:12 +01:00
02994d45a7 Add server-side TeleBot deployment script for manual execution 2025-09-24 18:15:38 +01:00
162400b987 Add TeleBot Hostinger deployment configuration with source build 2025-09-24 18:12:27 +01:00
bc708bb0a3 Fix missing CSRF tokens in all delete forms
- Added @Html.AntiForgeryToken() to Products delete form
- Added @Html.AntiForgeryToken() to Categories delete form
- Added @Html.AntiForgeryToken() to Users delete form
- Added @Html.AntiForgeryToken() to ShippingRates delete form
- Added @Html.AntiForgeryToken() to Product Variations delete form

This fixes the 400 Bad Request errors when trying to delete items
2025-09-24 18:02:17 +01:00
96125d6042 Add explicit antiforgery configuration and better error handling for UpdateStatus 2025-09-24 16:49:21 +01:00
66c948e4d8 Fix order status update form - add CSRF token and correct enum values 2025-09-24 16:32:26 +01:00
6e3c11ad75 Add Pending Payment tab and rebrand to TeleShop Admin
- Added new 'Pending Payment' tab to show orders awaiting payment (4 orders)
- Rebranded admin panel from 'LittleShop Admin' to 'TeleShop Admin'
- Updated login page, layout, and dashboard with new branding
- Fixed visibility issue where PendingPayment orders had no tab
- All 13 orders are now visible across appropriate tabs

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 15:55:15 +01:00
10cd2ac7a1 Fix TeleBot compilation errors - remove duplicate /review case 2025-09-24 15:18:33 +01:00
515ee4d08e Complete TeleBot improvements and fixes
- Add reviews section with /reviews command and menu button
- Fix /delete command to include main menu after deletion
- Remove unused commands (tor, ephemeral, pgpkey) from help
- Remove 'Products with Images' button from main menu
- Update main menu: rename Browse to 'Browse Products', add Reviews button
- Add placeholder reviews display handler (TODO: fetch from API)
- Clean up help text to reflect actual available commands

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 15:11:40 +01:00
524f0639e1 Fix multiple TeleBot and admin panel issues
- Fix admin panel to show all pending orders (PendingPayment + PaymentReceived)
- Fix currency display from USD ($) to GBP (£) throughout TeleBot
- Update payment methods to use dynamic SilverPay currency list
- Consolidate shipping address collection into single message
- Implement cart backup/restore on payment failure
- Remove unsupported XMR from TeleBot config

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 15:04:24 +01:00
e7d97f581c Fix network configuration for TeleBot connectivity
- Added littleshop-network to LittleShop container
- Ensures TeleBot can access LittleShop API
- Maintains bridge network for BunkerWeb access
2025-09-24 14:29:47 +01:00
6f3314de26 Fix SilverPay port: Use 8000 instead of 8001 for internal connection 2025-09-24 14:21:52 +01:00
c8adee8db4 Fix TeleBot LittleShop API credentials 2025-09-24 14:12:18 +01:00
c0b3a47cd8 Add simplified Dockerfile for TeleBot using pre-built binaries 2025-09-24 14:09:16 +01:00
71ad637804 Fix Dockerfile.telebot: Update COPY paths for project structure 2025-09-24 14:06:45 +01:00
5210b5b70c Add TeleBot deployment with Tor integration
- Created docker-compose.telebot.yml with Tor proxy
- Added deployment script for automated setup
- Configured Telegram traffic routing through Tor
- Integrated with LittleShop API via Docker network

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:05:11 +01:00
127e810daa Fix port configuration: Use port 8080 for ASP.NET Core 9 2025-09-24 13:18:52 +01:00
4f0724e94d Fix network configuration for Hostinger deployment 2025-09-24 13:13:45 +01:00
af45d7c955 Fix Dockerfile: Remove --no-build flag from publish stage 2025-09-24 13:11:21 +01:00
6b9902daf4 Fix Dockerfile: Use standard .NET SDK 9.0 image instead of jammy variant 2025-09-24 13:10:00 +01:00
252416318d Add Hostinger deployment configuration
- Created docker-compose.hostinger.yml with BunkerWeb labels
- Added deployment script for automated deployment
- Configured for admin.thebankofdebbie.giize.com
- Integrated with SilverPay at pay.thebankofdebbie.giize.com

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 13:03:12 +01:00
caff08cb6f Deploy LittleShop to Hostinger with Docker and BunkerWeb
- Updated Docker configuration for production deployment
- Added SilverPay integration settings
- Configured for admin.thebankofdebbie.giize.com deployment
- Includes all recent security fixes and improvements

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 13:00:17 +01:00
622bdcf111 🔒 SECURITY: Emergency fixes and hardening
EMERGENCY FIXES:
 DELETE MockSilverPayService.cs - removed fake payment system
 REMOVE mock service registration - no fake payments possible
 GENERATE new JWT secret - replaced hardcoded key
 FIX HttpClient disposal - proper resource management

SECURITY HARDENING:
 ADD production guards - prevent mock services in production
 CREATE environment configs - separate dev/prod settings
 ADD config validation - fail fast on misconfiguration

IMPACT:
- Mock payment system completely eliminated
- JWT authentication now uses secure keys
- Production deployment now validated on startup
- Resource leaks fixed in TeleBot currency API

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 05:45:49 +01:00
5138242a99 Fix SilverPay payment integration JSON serialization
- Changed JSON naming policy from CamelCase to SnakeCaseLower for SilverPay API compatibility
- Fixed field name from 'fiat_amount' to 'amount' in request body
- Used unique payment ID instead of order ID to avoid duplicate external_id conflicts
- Modified SilverPayApiResponse to handle string amounts from API
- Added [JsonIgnore] attributes to computed properties to prevent JSON serialization conflicts
- Fixed test compilation errors (mock service and enum casting issues)
- Updated SilverPay endpoint to http://10.0.0.52:8001/

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-22 04:38:28 +01:00
034b8facee Implement product multi-buys and variants system
Major restructuring of product variations:
- Renamed ProductVariation to ProductMultiBuy for quantity-based pricing (e.g., "3 for £25")
- Added new ProductVariant model for string-based options (colors, flavors)
- Complete separation of multi-buy pricing from variant selection

Features implemented:
- Multi-buy deals with automatic price-per-unit calculation
- Product variants for colors/flavors/sizes with stock tracking
- TeleBot checkout supports both multi-buys and variant selection
- Shopping cart correctly calculates multi-buy bundle prices
- Order system tracks selected variants and multi-buy choices
- Real-time bot activity monitoring with SignalR
- Public bot directory page with QR codes for Telegram launch
- Admin dashboard shows multi-buy and variant metrics

Technical changes:
- Updated all DTOs, services, and controllers
- Fixed cart total calculation for multi-buy bundles
- Comprehensive test coverage for new functionality
- All existing tests passing with new features

Database changes:
- Migrated ProductVariations to ProductMultiBuys
- Added ProductVariants table
- Updated OrderItems to track variants

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 00:30:12 +01:00
7683b7dfe5 Document production deployment status and E2E test results
- Updated CLAUDE.md with September 20 deployment status
- Created comprehensive DEPLOYMENT_STATUS.md with:
  - Service status overview
  - E2E test results summary
  - Required configuration steps
  - Maintenance commands
  - Security notes
- Documented all access points and URLs
- Added troubleshooting and next steps
2025-09-20 22:02:46 +01:00
13aa20ffa4 Add production deployment infrastructure
- Created comprehensive deployment package with production builds
- Added deployment scripts for Linux and Docker environments
- Generated Dockerfiles for containerized deployment
- Included nginx reverse proxy configuration
- Added systemd service definitions for native Linux deployment
- Created docker-compose.production.yml for orchestration
- Comprehensive deployment documentation in README.md
- Both LittleShop and TeleBot production builds included
- Ready for deployment to Hostinger VPS server

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 21:10:48 +01:00
b8bda63cfa Production deployment: Complete SilverPAY integration and e2e testing
- Complete MockSilverPayService with GetExchangeRateAsync method
- Fix compilation errors and webhook response types
- Successful e2e testing with real SilverPAY server integration
- TeleBot integration verified with production payment flow
- Database optimization with Alembic migration system
- Webhook integration confirmed and operational
- All code quality checks passed (0 errors, 0 warnings)

System now production-ready with full cryptocurrency payment support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 20:47:00 +01:00
553088390e Remove BTCPay completely, integrate SilverPAY only, configure TeleBot with real token
- Removed all BTCPay references from services and configuration
- Implemented SilverPAY as sole payment provider (no fallback)
- Fixed JWT authentication with proper key length (256+ bits)
- Added UsersController with full CRUD operations
- Updated User model with Email and Role properties
- Configured TeleBot with real Telegram bot token
- Fixed launchSettings.json with JWT environment variable
- E2E tests passing for authentication, catalog, orders
- Payment creation pending SilverPAY server fix

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 19:22:29 +01:00
bcefd2c6fc Temporarily disable anti-forgery validation for HTTPS proxy compatibility 2025-09-19 16:44:37 +01:00
8b0e3e0611 Implement comprehensive notification system for LittleShop
- Add admin PWA push notifications for order management
- Integrate TeleBot customer messaging service
- Add push notification endpoints and VAPID key support
- Implement order status notifications throughout workflow
- Add notification UI components in admin panel
- Create TeleBotMessagingService for customer updates
- Add WebPush configuration to appsettings
- Fix compilation issues (BotStatus, BotContacts DbSet)
- Add comprehensive testing documentation

Features:
- Real-time admin notifications for new orders and status changes
- Customer order progress updates via TeleBot
- Graceful failure handling for notification services
- Test endpoints for notification system validation

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 16:17:24 +01:00
68c5d2dfdf Production optimization: Docker configuration and monitoring stack
🚀 Docker Production Optimizations:
- Chiseled Ubuntu base image for minimal attack surface
- Non-root user execution with security hardening
- Read-only filesystem with targeted writable volumes
- Resource limits (1GB RAM, 1 CPU) with health checks
- Multi-stage builds optimized for caching
- Zero-downtime deployment automation

🔍 Comprehensive Monitoring Stack:
- Prometheus metrics collection with custom rules
- Grafana dashboards for application visualization
- AlertManager with email notifications for critical events
- Fluentd centralized logging with retention policies
- Node Exporter + cAdvisor for system/container metrics
- Health check endpoint (/health) for container orchestration

📋 Production Deployment Ready:
- Complete deployment scripts with backup strategy
- Environment templates for secure configuration
- Performance monitoring and alerting rules
- Enterprise-grade security and observability

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 12:35:41 +01:00
SilverLabs DevTeam
56e6496c3b Merge and add BTCPay external nodes configuration 2025-09-19 12:15:52 +01:00
SilverLabs DevTeam
73e8773ea3 Configure BTCPay with external nodes via Tor
- Set up Tor container for SOCKS proxy (port 9050)
- Configured Monero wallet with remote onion node
- Bitcoin node continues syncing in background (60% complete)
- Created documentation for wallet configuration steps
- All external connections routed through Tor for privacy

BTCPay requires manual wallet configuration through web interface:
- Bitcoin: Need to add xpub/zpub for watch-only wallet
- Monero: Need to add address and view key

System ready for payment acceptance once wallets configured.
2025-09-19 12:14:39 +01:00
d343037bbd Security: Fix critical vulnerabilities and implement security hardening
CRITICAL SECURITY FIXES:
- Fixed certificate validation bypass vulnerability in BTCPayServerService
  * Removed unsafe ServerCertificateCustomValidationCallback
  * Added environment-specific SSL configuration
  * Production now enforces proper SSL validation

- Fixed overly permissive CORS policy
  * Replaced AllowAnyOrigin() with specific trusted origins
  * Created separate CORS policies for Development/Production/API
  * Configured from appsettings for environment-specific control

- Implemented CSRF protection across admin panel
  * Added [ValidateAntiForgeryToken] to all POST/PUT/DELETE actions
  * Protected 10 admin controllers with anti-forgery tokens
  * Prevents Cross-Site Request Forgery attacks

CONFIGURATION IMPROVEMENTS:
- Created appsettings.Development.json for dev-specific settings
- Added Security:AllowInsecureSSL flag (Development only)
- Added CORS:AllowedOrigins configuration arrays
- Created comprehensive security roadmap (ROADMAP.md)

ALSO FIXED:
- TeleBot syntax errors (Program.cs, MessageFormatter.cs)
- Added enterprise-full-stack-developer output style

Impact: All Phase 1 critical security vulnerabilities resolved
Status: Ready for security review and deployment preparation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 11:56:12 +01:00