Widerruf: Gesetzliche Online-Widerrufsfunktion (Formular, Bestätigungsmail, Admin-Verwaltung)
- Öffentliches Widerrufsformular /widerruf mit Bestell-Lookup (throttled) - Bestätigungsmail an Kunde + Weiterleitung an bestellungen@ (config app.withdrawal_mail) - Admin-Übersicht/-Detail unter /admin/withdrawals inkl. Sidenav-Eintrag - Widerruf-Button in Portal-Bestellansicht und Footer-Links - Model OrderWithdrawal + Migration + Factory + Tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
9dc138e45b
commit
83ef5f1e52
24 changed files with 1607 additions and 92 deletions
40
database/factories/OrderWithdrawalFactory.php
Normal file
40
database/factories/OrderWithdrawalFactory.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\OrderWithdrawal;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<OrderWithdrawal>
|
||||
*/
|
||||
class OrderWithdrawalFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'shopping_order_id' => null,
|
||||
'user_shop_id' => null,
|
||||
'type' => OrderWithdrawal::TYPE_FULL,
|
||||
'status' => OrderWithdrawal::STATUS_RECEIVED,
|
||||
'order_reference' => (string) $this->faker->numberBetween(1000, 99999),
|
||||
'customer_email' => $this->faker->safeEmail(),
|
||||
'customer_name' => $this->faker->name(),
|
||||
'reason' => $this->faker->optional()->sentence(),
|
||||
'items' => null,
|
||||
'ip_address' => $this->faker->ipv4(),
|
||||
'user_agent' => $this->faker->userAgent(),
|
||||
'declared_at' => now(),
|
||||
];
|
||||
}
|
||||
|
||||
public function partial(): self
|
||||
{
|
||||
return $this->state(fn (): array => ['type' => OrderWithdrawal::TYPE_PARTIAL]);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('order_withdrawals', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('shopping_order_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('user_shop_id')->nullable()->index();
|
||||
$table->string('type')->default('full');
|
||||
$table->string('status')->default('received')->index();
|
||||
$table->string('order_reference')->nullable();
|
||||
$table->string('customer_email')->index();
|
||||
$table->string('customer_name')->nullable();
|
||||
$table->text('reason')->nullable();
|
||||
$table->json('items')->nullable();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->text('admin_note')->nullable();
|
||||
$table->timestamp('declared_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('order_withdrawals');
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue