Warenwirtschaft: AP-13 API-Bestellungen — Protokoll mit SKU-Fehlermarkierung

Neuer Navigationspunkt „API-Bestellungen": jede wp/order-Übertragung wird
protokolliert (api_order_logs) — auch abgelehnte (Kunde unbekannt, Bestellung
existiert bereits, Speicherfehler). Positionen ohne Produktzuordnung
(unbekannte WP-Nummer) markieren den Eintrag rot; das Modal zeigt den Inhalt
der Übertragung je Position (SKU, Produkt, Menge, Preis, Meldung übersetzt).
Dazu SKU-Konsistenzprüfung auf der Seite: doppelte WP-Nummern aktiver Produkte
(Warnung) und aktive Produkte ohne WP-Nummer (aufklappbar). Behebt die stille
Lücke, dass „article not found" nur in der API-Antwort unterging und die
Position kommentarlos in Bestellung und Bestandsabzug fehlte (Plan §4).
ShoppingUserController per Pint formatiert.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-16 08:04:16 +00:00
parent 211aeed384
commit 71d5591e7b
8 changed files with 859 additions and 170 deletions

View file

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* AP-13: Protokoll aller über die Partnercenter-API eingehenden Bestell-Übertragungen
* (wp/order). Positionen inkl. SKU-Zuordnungsergebnis liegen als JSON im payload;
* fehlgeschlagene Zuordnungen markieren den Eintrag (has_errors).
*/
public function up(): void
{
Schema::create('api_order_logs', function (Blueprint $table) {
$table->id();
// shopping_orders.id / shopping_users.id sind historisch unsignedInteger (increments)
$table->unsignedInteger('shopping_order_id')->nullable();
$table->unsignedInteger('shopping_user_id')->nullable();
$table->unsignedBigInteger('wp_order_number')->nullable()->index();
$table->string('endpoint', 20)->default('order');
$table->json('payload')->nullable();
$table->boolean('has_errors')->default(false)->index();
$table->string('error_summary')->nullable();
$table->timestamps();
$table->foreign('shopping_order_id')->references('id')->on('shopping_orders')->nullOnDelete();
$table->foreign('shopping_user_id')->references('id')->on('shopping_users')->nullOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('api_order_logs');
}
};