Commit Graph

159 Commits

Author SHA1 Message Date
4be8dbfa1b Configure push notifications for public domain - Add WebPush VAPID configuration to docker-compose.yml 2025-09-30 16:13:57 +01:00
aff6780848 feat: Consolidate deployments to GitLab CI/CD pipeline
- Add comprehensive integration test script for Hostinger VPS deployment
- Fixed database schema check in test script (correct database path)
- Consolidated deployment from manual (/opt/docker/littleshop) to GitLab CI/CD (/opt/littleshop)
- All deployment configuration now managed through GitLab pipeline
- Integration tests: 15/15 passing (100% success rate)

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 13:57:09 +01:00
8fc58bb918 Database-migration-scripts-for-deployment-fixes 2025-09-29 17:30:34 +01:00
51cc0463de Update .gitlab-ci.yml file 2025-09-29 18:12:34 +02:00
d3371f011f Merge branch 'revert-84b0a880' into 'main'
Revert "Update .gitlab-ci.yml file"

See merge request Jamie/littleshop!1
2025-09-29 18:07:37 +02:00
37687757bb Revert "Update .gitlab-ci.yml file" 2025-09-29 18:07:37 +02:00
fb3269e680 Update .gitlab-ci.yml file 2025-09-29 17:58:58 +02:00
84b0a880f6 Update .gitlab-ci.yml file 2025-09-29 17:44:10 +02:00
sysadmin
f5e87d8b6b "Test-Infrastructure-v2.5.0-Coverage-Improvement" 2025-09-29 09:05:58 +01:00
sysadmin
c5c56ec3d8 "Test-infrastructure-fixes" 2025-09-29 08:03:36 +01:00
sysadmin
6e5f5ae279 "Test-infrastructure-improvements" 2025-09-29 06:59:49 +01:00
sysadmin
7c522535c6 "Security-fixes" 2025-09-29 06:37:15 +01:00
sysadmin
d096cf0ced deployment-script 2025-09-29 06:24:51 +01:00
sysadmin
c8fdbb2e03 security-and-docker-fixes 2025-09-29 06:23:52 +01:00
ec894ba529 Implement critical security fixes from code review 2025-09-29 05:26:29 +01:00
8a7c07ead7 Fix CI/CD: Add Docker network cleanup to prevent pool conflicts 2025-09-28 19:02:26 +01:00
7ffb3de3f2 Fix CI/CD: Force cleanup orphan containers before deployment 2025-09-28 19:00:09 +01:00
1b46222300 Security hardening: Fix critical JWT, rate limiting, and deployment issues 2025-09-28 18:52:05 +01:00
sysadmin
586d491b83 Add database force upgrade script with config preservation
This commit adds scripts to handle production database migrations that
failed due to schema inconsistencies. The force upgrade script preserves
critical configuration data while recreating the database structure.

Features:
- Exports and preserves SystemSettings (wallet addresses, API keys)
- Preserves Users (admin accounts with passwords)
- Preserves BotRegistrations (Telegram bot configuration)
- Creates timestamped backups before any changes
- Automatic rollback on failure
- Manual SQL migration script as fallback option

Usage:
  bash force-upgrade-production-db.sh

This is safe to use when product catalog data is not critical and
configuration/wallet data must be preserved.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 17:15:53 +01:00
sysadmin
eb87148c63 Add variant collections system and enhance ProductVariant with weight/stock tracking
This commit introduces a comprehensive variant management system and enhances
the existing ProductVariant model with per-variant weight overrides and stock
tracking, integrated across Admin Panel and TeleBot.

Features Added:
- Variant Collections: Reusable variant templates (e.g., "Standard Sizes")
- Admin UI for managing variant collections (CRUD operations)
- Dynamic variant editor with JavaScript-based UI
- Per-variant weight and weight unit overrides
- Per-variant stock level tracking
- SalesLedger model for financial tracking

ProductVariant Enhancements:
- Added Weight (decimal, nullable) field for variant-specific weights
- Added WeightUnit (enum, nullable) field for variant-specific units
- Maintains backward compatibility with product-level weights

TeleBot Integration:
- Enhanced variant selection UI to display stock levels
- Shows weight information with proper unit conversion (µg, g, oz, lb, ml, L)
- Compact button format: "Medium (15 in stock, 350g)"
- Real-time stock availability display

Database Migrations:
- 20250928014850_AddVariantCollectionsAndSalesLedger
- 20250928155814_AddWeightToProductVariants

Technical Changes:
- Updated Product model to support VariantCollectionId and VariantsJson
- Extended ProductService with variant collection operations
- Enhanced OrderService to handle variant-specific pricing and weights
- Updated LittleShop.Client DTOs to match server models
- Added JavaScript dynamic variant form builder

Files Modified: 15
Files Added: 17
Lines Changed: ~2000

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-28 17:03:09 +01:00
191a9f27f2 Enable auto-deploy for LittleShop on main branch
- Added auto-deploy on successful builds for main branch
- Deployment uses commit SHA when no tag is present
- Manual deployment still available for tagged releases
- Follows same pattern as TeleBot deployment

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 09:54:48 +01:00
fd02836450 Add TeleBot CI/CD pipeline configuration
- Created .gitlab-ci.yml for automated builds and deployment
- Added docker-compose.production.yml for VPS deployment
- Added .env.production.example for configuration template
- Follows LittleShop deployment pattern
- Auto-deploy on main branch commits

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 09:53:43 +01:00
766216e542 Add TeleBot e2e test script
- Comprehensive e2e test for TeleBot functionality
- Tests LittleShop API connectivity
- Verifies catalog access and order creation
- Includes build verification
- Designed to run on VPS with VPN access

Build test passed 

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 09:52:20 +01:00
8e3efb7c3a Update TeleBot configuration and add versioning
- Updated LittleShop API URL to use VPN hostname (hq.lan)
- Added Version 1.0.3 properties to project file
- Follows infrastructure changes with VPN-based access

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 09:50:12 +01:00
6be1ea8085 Add version 1.0.5 and /api/version endpoint
- Added Version, AssemblyVersion, and FileVersion to project file
- Added /api/version endpoint returning version info
- Follows SilverPay versioning pattern

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 09:46:13 +01:00
e75411dab9 Fix health check port to 5100 (host port) 2025-09-27 08:03:06 +01:00
d57f3ddd59 Fix SSH variable quoting in GitLab CI/CD 2025-09-27 07:47:57 +01:00
5bae87d5ec Fix compilation error in TestController
Change order.Total to order.TotalAmount to match model property.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 07:44:03 +01:00
849d4994de Fix GitLab CI/CD Docker socket configuration
Remove docker:24-dind service to use runner's mounted Docker socket.
This fixes the 403 Git access error and Docker socket conflict.

Changes:
- Remove services: docker:24-dind from build and deploy jobs
- Change image from docker:24-dind to docker:24
- Update DOCKER_HOST to use unix socket

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 07:39:48 +01:00
6c05b7d0e8 Add GitLab CI/CD deployment pipeline
- Add .gitlab-ci.yml with build, deploy, and rollback stages
- Add docker-compose.production.yml (security-compliant, no hardcoded secrets)
- Update .env.example with SilverPay integration variables
- Add GITLAB-CI-DEPLOYMENT.md documentation

Security improvements:
- All secrets in VPS .env file (never in Git)
- Environment variables without defaults (fail-fast)
- SSH key authentication for CI/CD
- VPN-only access via hq.lan

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-27 07:05:02 +01:00
e2f809c4f3 Fix integration test: correct field name from customerIdentity to identityReference
Fixed:
• Order creation now uses correct 'identityReference' field
• Integration tests now pass at 92% (11/12)
• SilverPAY wallet unlock confirmed working
• Payment address generation validated

Test Results:
• SilverPAY Order Creation:  Working
• Exchange Rates:  Live data (£81,852/BTC)
• Order Creation:  Fixed field validation
• System Status: 92% operational

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-26 01:38:04 +01:00
33ca93150a Add comprehensive credentials and configuration documentation
📋 Critical system information documented:
• All production credentials and API keys
• Manual payment verification workflow details
• Deployment scripts and automation commands
• System architecture and maintenance procedures
• Test data cleanup mechanisms

🔐 Security: Contains production credentials - store securely

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 19:30:53 +01:00
127be759c8 Refactor payment verification to manual workflow and add comprehensive cleanup tools
Major changes:
• Remove BTCPay Server integration in favor of SilverPAY manual verification
• Add test data cleanup mechanisms (API endpoints and shell scripts)
• Fix compilation errors in TestController (IdentityReference vs CustomerIdentity)
• Add deployment automation scripts for Hostinger VPS
• Enhance integration testing with comprehensive E2E validation
• Add Blazor components and mobile-responsive CSS for admin interface
• Create production environment configuration scripts

Key Features Added:
• Manual payment verification through Admin panel Order Details
• Bulk test data cleanup with proper cascade handling
• Deployment automation with systemd service configuration
• Comprehensive E2E testing suite with SilverPAY integration validation
• Mobile-first admin interface improvements

Security & Production:
• Environment variable configuration for production secrets
• Proper JWT and VAPID key management
• SilverPAY API integration with live credentials
• Database cleanup and maintenance tools

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 19:29:00 +01:00
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