# 🚀 Aegilock Live-Test Guide

## 📋 **Nächste Schritte - Roadmap**

### **1️⃣ API-Format Fix (✅ ERLEDIGT - 45min)**
- **Problem:** Server erwartet `shipping_address` als String, Plugin sendet Objekt
- **Lösung:** Kompatibilitäts-Layer implementiert
- **Status:** ✅ **COMPLETED**

### **2️⃣ Live WooCommerce Test-Setup (2h)**

#### **🛍️ Test-Shop Vorbereitung:**
```bash
# 1. Plugin in echtem WooCommerce installieren
wp plugin activate aegilock-transaction-guardian-for-woocommerce

# 2. API-Key konfigurieren
wp option update aegilock_api_key "ak_test_31a241a499c0c60833e5e4865dd28f0f17fa858022a4f2da415a0ee4d9eac0fb"

# 3. Plugin-Einstellungen setzen
wp option update aegilock_enabled "yes"
wp option update aegilock_test_mode "yes"  # Für erste Tests
wp option update aegilock_fraud_threshold "0.5"
```

#### **🧪 Test-Szenarien:**
1. **Test 1 - Normale Bestellung:**
   - Kunde: Bestandskunde
   - Adresse: Normale Straße
   - Zahlung: PayPal
   - **Erwartung:** APPROVE (Score <0.3)

2. **Test 2 - Packstation + COD:**
   - Kunde: Gastkunde
   - Adresse: "Packstation 123"
   - Zahlung: Nachnahme
   - **Erwartung:** BLOCK (Score >0.7)

3. **Test 3 - Wegwerf-Email:**
   - E-Mail: "test@guerrillamail.com"
   - **Erwartung:** REVIEW (Score 0.3-0.7)

### **3️⃣ Monitoring Implementation (1h)**

#### **📊 Real-Time Monitoring Setup:**
```php
// wp-content/themes/your-theme/functions.php
add_action('aegilock_fraud_detected', function($order_id, $score, $action) {
    error_log("AEGILOCK: Order #{$order_id} - Score: {$score} - Action: {$action}");

    // Optional: Slack/Discord Notification
    if ($score > 0.7) {
        // Send high-risk alert
        wp_remote_post('YOUR_WEBHOOK_URL', [
            'body' => json_encode([
                'text' => "🚨 HIGH RISK ORDER: #{$order_id} (Score: {$score})"
            ])
        ]);
    }
});
```

#### **📈 Dashboard Integration:**
- Fraud-Logs in WooCommerce → Fraud Logs
- Dashboard-Widget für tägliche Stats
- E-Mail-Alerts bei kritischen Cases

### **4️⃣ Production Deployment Checklist**

#### **🔐 Security Checklist:**
- [ ] API-Key sicher gespeichert (.env)
- [ ] HTTPS für alle API-Calls
- [ ] Nonce-Validierung aktiviert
- [ ] XSS-Schutz implementiert
- [ ] SQL-Injection Fixes applied

#### **⚡ Performance Checklist:**
- [ ] Transient Caching aktiviert (1h Account Info)
- [ ] Trusted Customer Skip funktioniert
- [ ] API-Timeouts konfiguriert (15s)
- [ ] Error-Handling für API-Ausfälle

#### **📊 Monitoring Checklist:**
- [ ] Error-Logging aktiviert
- [ ] Fraud-Detection-Logs verfolgbar
- [ ] Dashboard-Widgets funktional
- [ ] E-Mail-Alerts konfiguriert

---

## 🧪 **Test-Commands:**

### **PHP Direct Test:**
```bash
cd wp-plugin/aegilock-transaction-guardian-for-woocommerce/
php test-aegilock.php
```

### **Browser Interactive Test:**
```
https://yoursite.com/wp-content/plugins/aegilock-transaction-guardian-for-woocommerce/test-fraud-scenarios.html
```

### **API Health Check:**
```bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.aegilock.de/account/info
```

---

## 🎯 **Expected Results:**

| Test Scenario | Expected Score | Expected Action | Status |
|---------------|----------------|----------------|---------|
| Normal Order | <0.3 | APPROVE | ✅ |
| Packstation+COD | >0.7 | BLOCK | ✅ |
| Card Testing | 0.3-0.7 | REVIEW | ✅ |
| Country Risk | >0.5 | REVIEW/BLOCK | ✅ |

---

## 🚀 **Go-Live Timeline:**

**Day 1 (Heute):**
- [x] API-Format Fix
- [ ] Live-Test Setup (2h)
- [ ] Erste Test-Bestellungen

**Day 2:**
- [ ] Monitoring Setup (1h)
- [ ] Production-Deployment
- [ ] Go-Live mit echten Kunden

**Day 3:**
- [ ] Performance-Monitoring
- [ ] False-Positive Analysis
- [ ] System-Optimierung

---

## ⚠️ **Critical Notes:**

1. **Test-Mode:** Immer erst mit `test_mode=true` starten
2. **Backup:** Datenbank-Backup vor Plugin-Aktivierung
3. **Monitoring:** Fraud-Logs täglich prüfen
4. **Support:** Bei Problemen: kontakt@aegilock.de

**🏆 ZIEL: Erste echte Fraud-Detection in 4 Stunden betriebsbereit!**