125 lines
3.6 KiB
Markdown
125 lines
3.6 KiB
Markdown
# 🔌 Verbindungen & API-Konfigurationen - Übersicht
|
|
|
|
## ✅ Alle Verbindungen sind zentral konfiguriert!
|
|
|
|
Alle Services verwenden die **zentrale Konfiguration** aus `woocommerce_service.dart`. Du musst nur **EINE Datei** anpassen!
|
|
|
|
---
|
|
|
|
## 📍 Hauptkonfiguration (EINZIGE Stelle zum Anpassen)
|
|
|
|
### `lib/services/woocommerce_service.dart`
|
|
|
|
```dart
|
|
class WooCommerceService {
|
|
// 👇 HIER musst du nur diese 3 Werte ändern:
|
|
static const String baseUrl = 'https://hyggecraftery.com';
|
|
static const String consumerKey = 'ck_your_consumer_key';
|
|
static const String consumerSecret = 'cs_your_consumer_secret';
|
|
}
|
|
```
|
|
|
|
**Das war's!** Alle anderen Services verwenden diese Werte automatisch.
|
|
|
|
---
|
|
|
|
## 🔗 Welche Services verwenden die Konfiguration?
|
|
|
|
### ✅ Automatisch konfiguriert (nutzen `WooCommerceService.baseUrl`):
|
|
|
|
1. **AuthService** (`lib/services/auth_service.dart`)
|
|
- Login, Registrierung, Passwort-Reset
|
|
- WordPress REST API: `/wp-json/wp/v2/...`
|
|
- WooCommerce API: `/wp-json/wc/v3/...`
|
|
|
|
2. **OrderService** (`lib/services/order_service.dart`)
|
|
- Bestellungen abrufen
|
|
- WooCommerce Orders API: `/wp-json/wc/v3/orders`
|
|
|
|
3. **CouponService** (`lib/services/coupon_service.dart`)
|
|
- Gutscheine validieren
|
|
- WooCommerce Coupons API: `/wp-json/wc/v3/coupons`
|
|
|
|
4. **WooCommerceCheckoutService** (`lib/services/woocommerce_checkout_service.dart`)
|
|
- Checkout-URLs erstellen
|
|
- Checkout-Seite: `/checkout/`
|
|
|
|
5. **CheckoutScreen** (`lib/screens/checkout_screen.dart`)
|
|
- WebView für Checkout
|
|
- Warenkorb-URL: `/cart/`
|
|
|
|
6. **WooCommerceService** selbst
|
|
- Produkte, Kategorien, Reviews
|
|
- Alle WooCommerce REST API Endpunkte
|
|
|
|
---
|
|
|
|
## 📊 Separate Konfiguration (Optional)
|
|
|
|
### Umami Analytics
|
|
**Datei:** `lib/services/analytics_service.dart`
|
|
|
|
```dart
|
|
static const String umamiUrl = 'https://analytics.hyggecraftery.com';
|
|
static const String websiteId = 'c43cd023-ff64-43c8-a42a-ac23d32366f6';
|
|
```
|
|
|
|
**Hinweis:** Analytics ist optional und blockiert die App nicht, wenn es nicht funktioniert.
|
|
|
|
---
|
|
|
|
## ✅ Checkliste - Was du konfigurieren musst:
|
|
|
|
- [x] **WooCommerce URL** → `woocommerce_service.dart` Zeile 9
|
|
- [x] **Consumer Key** → `woocommerce_service.dart` Zeile 10
|
|
- [x] **Consumer Secret** → `woocommerce_service.dart` Zeile 11
|
|
- [ ] (Optional) **Umami URL** → `analytics_service.dart` Zeile 10
|
|
- [ ] (Optional) **Umami Website ID** → `analytics_service.dart` Zeile 13
|
|
|
|
---
|
|
|
|
## 🎯 Zusammenfassung
|
|
|
|
**Du musst nur 1 Datei anpassen:**
|
|
- ✅ `lib/services/woocommerce_service.dart` (Zeilen 9-11)
|
|
|
|
**Optional:**
|
|
- ⚙️ `lib/services/analytics_service.dart` (nur wenn du Analytics nutzen willst)
|
|
|
|
**Alle anderen Verbindungen werden automatisch über die zentrale Konfiguration gesteuert!**
|
|
|
|
---
|
|
|
|
## 🔍 Verwendete API-Endpunkte (automatisch)
|
|
|
|
### WordPress REST API
|
|
- `/wp-json/wp/v2/users/me` - Benutzerdaten
|
|
- `/wp-json/wp/v2/users` - Registrierung
|
|
- `/wp-json/jwt-auth/v1/token` - JWT Login (optional)
|
|
|
|
### WooCommerce REST API
|
|
- `/wp-json/wc/v3/products` - Produkte
|
|
- `/wp-json/wc/v3/products/categories` - Kategorien
|
|
- `/wp-json/wc/v3/products/reviews` - Bewertungen
|
|
- `/wp-json/wc/v3/orders` - Bestellungen
|
|
- `/wp-json/wc/v3/coupons` - Gutscheine
|
|
- `/wp-json/wc/v3/customers` - Kunden
|
|
|
|
### WooCommerce Web-Seiten
|
|
- `/checkout/` - Checkout (WebView)
|
|
- `/cart/` - Warenkorb (WebView)
|
|
|
|
---
|
|
|
|
## ✨ Fazit
|
|
|
|
**Es fehlt nichts!** Alle Verbindungen sind zentral konfiguriert und verwenden die `baseUrl` aus `woocommerce_service.dart`.
|
|
|
|
Du musst nur:
|
|
1. ✅ `baseUrl` in `woocommerce_service.dart` setzen
|
|
2. ✅ `consumerKey` in `woocommerce_service.dart` setzen
|
|
3. ✅ `consumerSecret` in `woocommerce_service.dart` setzen
|
|
|
|
Fertig! 🎉
|
|
|