Basic implementation of payment methods

This commit is contained in:
2026-07-28 15:50:58 +02:00
parent afc91545a9
commit 6c9281516e
39 changed files with 749 additions and 24 deletions
@@ -0,0 +1,33 @@
<?php
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
use App\Domains\Admin\Actions\RemovePaymentMethodUsage\RemovePaymentMethodUsageAction;
class UpdateAvailablePaymentMethodAction
{
public function __construct(private UpdateAvailablePaymentMethodRequest $request)
{
}
public function execute(): UpdateAvailablePaymentMethodResponse
{
$response = new UpdateAvailablePaymentMethodResponse();
$wasActive = $this->request->availablePaymentMethod->active;
$this->request->availablePaymentMethod->update([
'name' => $this->request->name,
'description' => $this->request->description,
'active' => $this->request->active,
]);
if ($wasActive && !$this->request->active) {
(new RemovePaymentMethodUsageAction())->execute($this->request->availablePaymentMethod);
}
$response->success = true;
$response->message = 'Zahlungsmethode wurde gespeichert.';
return $response;
}
}
@@ -0,0 +1,16 @@
<?php
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
use App\Models\AvailablePaymentMethod;
class UpdateAvailablePaymentMethodRequest
{
public function __construct(
public AvailablePaymentMethod $availablePaymentMethod,
public string $name,
public ?string $description,
public bool $active,
) {
}
}
@@ -0,0 +1,9 @@
<?php
namespace App\Domains\Admin\Actions\UpdateAvailablePaymentMethod;
class UpdateAvailablePaymentMethodResponse
{
public bool $success = false;
public string $message = '';
}