Files
aza/AzA march 2026 - Kopie (28)/wordpress/aza-license-bridge/README-FLEXIBLE-SUBSCRIPTIONS.md
2026-05-23 21:31:34 +02:00

41 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AZA License Bridge & WP Desk Flexible Subscriptions
## Kontext
Auf der Produktivseite ist **WP Desk Flexible Subscriptions** aktiv, nicht das klassische Plugin **WooCommerce Subscriptions**.
Die öffentliche Woo-REST-Route `/wp-json/wc/v3/subscriptions` kann fehlen oder durch Hosting/WAF blockiert werden unabhängig davon liefert Flexible Subscriptions laut WP-Desk-Doku u. a.:
- `next_payment_date_gmt` (REST)
- `billing_period` als **Einzelbuchstabe**: `D`, `W`, `M`, `Y`
- `billing_interval` (Integer)
## Root Cause (Kurz)
1. **AZA-Hetzner** soll **keine** Abo-Perioden mehr ausschließlich über Shop-REST laden müssen.
2. Die **WordPress-Bridge** kennt das Subscription-Objekt lokal und kann **next payment + billing** an den Server schicken.
3. Backend (`wc_period_payload.py`) normalisiert **`M/D/W/Y` → month/day/week/year** für die Periodenberechnung.
## Endpunkte auf Hetzner (nach Deploy des Backend-Codes)
| Methode | Pfad | Auth |
|--------|------|------|
| POST | `/wc/provision` | `X-WC-Secret` = `WC_PROVISION_SECRET` |
| POST | `/wc/subscription_period` | gleiches Secret |
`subscription_period` aktualisiert nur `current_period_start`, `current_period_end`, `updated_at` für Zeilen `subscription_id LIKE 'wc_sub_%'` und `status = active`.
## Plugin-Verhalten (Repo-Stand)
- `woocommerce_subscription_status_active` Priorität **10**: Lizenz-Provisioning (wie bisher).
- Dieselbe Action Priorität **20**: `aza_lb_after_subscription_active_push_period` → POST `/wc/subscription_period`.
Flexible Subscriptions setzt in der Regel dieselbe Hook-Familie voraus (WCS-kompatibel); wenn der Hook auf einer Installation **nicht** feuert, bitte WP-Desk-Doku oder Support zu den **Status-Wechsel-Hooks** prüfen und ggf. einen weiteren Hook ergänzen (ohne AZA-Core zu ändern).
## Logs
`wp-content/uploads/aza-logs/license-bridge.log` — Einträge `PERIOD PUSH …` ohne Klartext-Secrets.
## Snippet
Zusätzlich: `snippets/phase1f-period-endpoint-snippet.php` (Referenz für Code-Snippets-Plugin).