# Working Baseline - September 24, 2024 ## ๐ŸŽฏ System Status: FULLY OPERATIONAL This document captures the current working state of the LittleShop/TeleBot/SilverPay integrated system. ## โœ… All Systems Working ### 1. **TeleBot** - Telegram Bot Interface - **Status**: โœ… Operational - **Container**: `telebot:latest` - **Bot**: @Littleshop_tom_bot - **Key Fixes Applied**: - โœ… Checkout flow collects all address details in one message (not Step 1/5) - โœ… No duplicate `/review` commands - โœ… Currency display shows proper conversion notes - โœ… Connected to LittleShop API successfully - โœ… Tor proxy available via `telebot-tor` container ### 2. **LittleShop Admin** - E-commerce Backend - **Status**: โœ… Operational - **URL**: https://admin.thebankofdebbie.giize.com - **Container**: `littleshop-admin` - **Key Fixes Applied**: - โœ… CSRF tokens on all forms (delete, update status) - โœ… Pending Payment orders tab - โœ… Rebranded to "TeleShop Admin" - โœ… SilverPay integration fixed (fiat_amount field) - โœ… Connected to both `littleshop-network` and `bridge` networks - โœ… **HTTP 500 Login Fixed**: Username parameter case-insensitive - โœ… **JWT Configuration Fixed**: Use Jwt__Key environment variable (not JWT_SECRET_KEY) - โœ… **JWT Key Length**: Must be > 32 bytes/256 bits ### 3. **SilverPay** - Cryptocurrency Payment Gateway - **Status**: โœ… Operational - **URL**: https://pay.thebankofdebbie.giize.com - **Container**: `silverpay-api` - **Key Fixes Applied**: - โœ… Connected to `littleshop-network` for container name resolution - โœ… API accepting orders with correct field names - โœ… Currency conversion working (GBP โ†’ BTC/ETH) - โœ… Generating payment addresses successfully ## ๐Ÿ”ง Critical Configuration ### Docker Networks All containers must be on `littleshop-network` for inter-container communication: ```bash docker network connect littleshop-network [container-name] ``` ### Environment Variables (LittleShop) - CRITICAL ``` ASPNETCORE_ENVIRONMENT=Production ASPNETCORE_URLS=http://+:8080 ConnectionStrings__DefaultConnection=Data Source=/app/data/littleshop-production.db Jwt__Key=ThisIsAVeryLongSecretKeyThatIsDefinitelyLongerThan32BytesForSure123456789ABCDEF SilverPay__BaseUrl=http://silverpay-api:8000 SilverPay__ApiKey=7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8 SilverPay__WebhookSecret=Thefa1r1esd1d1twebhooks2024 ``` **IMPORTANT**: Use `Jwt__Key` (double underscore) NOT `JWT_SECRET_KEY`! ### API Field Names (SilverPay) Request must include: - `fiat_amount` (not `amount`) - `fiat_currency` (e.g., "GBP") - `currency` (crypto: "BTC", "ETH") - `external_id` - `webhook_url` ## ๐Ÿ“Š Recent Fixes (Git Commits) 1. **7809b6e** - Fix SilverPay payment creation - use fiat_amount instead of amount 2. **5013e60** - Fix TeleBot compilation errors - use RequiredAmount property 3. **ddff649** - Fix TeleBot checkout flow and currency display 4. **bc708bb** - Fix missing CSRF tokens in all delete forms 5. **6e3c11a** - Add Pending Payment tab and rebrand to TeleShop Admin ## ๐Ÿงช Verification Tests ### Test 1: Payment Creation ```bash curl -X POST http://silverpay-api:8000/api/v1/orders \ -H "Content-Type: application/json" \ -H "X-API-Key: 7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \ -d '{ "external_id": "test-001", "fiat_amount": 10.00, "fiat_currency": "GBP", "currency": "BTC", "webhook_url": "https://admin.thebankofdebbie.giize.com/webhook" }' ``` **Expected**: 200 OK with crypto_amount and payment_address ### Test 2: Container Connectivity ```bash docker exec littleshop-admin curl http://silverpay-api:8000/health ``` **Expected**: {"status":"healthy"...} ### Test 3: TeleBot Order Flow 1. Message @Littleshop_tom_bot 2. Browse products and add to cart 3. Checkout - provides all address details in one message 4. Select payment method (BTC/ETH) 5. Receive payment address with converted crypto amount ## ๐Ÿš€ Deployment Commands ### Working Docker Run Command (LittleShop Admin) ```bash docker run -d \ --name littleshop-admin \ --restart unless-stopped \ --network littleshop-network \ -p 127.0.0.1:5100:8080 \ -v /opt/littleshop/data:/app/data \ -v /opt/littleshop/logs:/app/logs \ -v /opt/littleshop/uploads:/app/wwwroot/uploads \ -e ASPNETCORE_ENVIRONMENT=Production \ -e ASPNETCORE_URLS="http://+:8080" \ -e ConnectionStrings__DefaultConnection="Data Source=/app/data/littleshop-production.db" \ -e Jwt__Key="ThisIsAVeryLongSecretKeyThatIsDefinitelyLongerThan32BytesForSure123456789ABCDEF" \ -e SilverPay__BaseUrl="http://silverpay-api:8000" \ -e SilverPay__ApiKey="7703aa7a62fa4b40a87e9cfd867f5407147515c0986116ea54fc00c0a0bc30d8" \ -e SilverPay__WebhookSecret="Thefa1r1esd1d1twebhooks2024" \ littleshop:latest ``` ### Restart All Services ```bash # On Hostinger server (srv1002428.hstgr.cloud) docker restart littleshop-admin docker restart telebot docker restart silverpay-api ``` ### Check Status ```bash docker ps --format "table {{.Names}}\t{{.Status}}" | grep -E "littleshop|telebot|silverpay" ``` ### View Logs ```bash docker logs --tail 50 littleshop-admin docker logs --tail 50 telebot docker logs --tail 50 silverpay-api ``` ## ๐Ÿ“ Known Working Configuration ### Container Versions (as of Sept 24, 2024) - **LittleShop**: Built from commit 7809b6e - **TeleBot**: Built from commit 7809b6e - **SilverPay**: localhost:5000/silverpay:latest ### Database - **LittleShop**: SQLite at `/opt/littleshop/data/littleshop-production.db` - **SilverPay**: PostgreSQL (silverpay-postgres container) ### File Permissions - LittleShop data: owned by UID 1654 - TeleBot data: owned by UID 1001 - Use `chown -R [uid]:[uid] /path` to fix permission issues ## โš ๏ธ Critical Points to Remember 1. **Network Connectivity**: Containers must be on the same Docker network 2. **Field Names**: SilverPay expects `fiat_amount`, not `amount` 3. **CSRF Tokens**: All forms need `@Html.AntiForgeryToken()` 4. **Currency Display**: Shows GBP with conversion note for amounts > 1.0 5. **Checkout Flow**: Single message for address, not multi-step ## ๐ŸŽ‰ System Capabilities Users can now: 1. โœ… Browse products via TeleBot 2. โœ… Add items to cart 3. โœ… Complete checkout with single address entry 4. โœ… Select cryptocurrency for payment 5. โœ… Receive correct crypto amounts with live exchange rates 6. โœ… Get unique payment addresses for each order 7. โœ… Admin can manage orders through TeleShop Admin panel 8. โœ… View pending payments in dedicated tab ## ๐Ÿ“… Baseline Date: September 24, 2024, 20:15 UTC All systems confirmed working at this timestamp.