Addon-Kauf im Event admin korrigiert.
This commit is contained in:
@@ -59,7 +59,7 @@ class EventAddonWebhookService
|
||||
return true; // idempotent
|
||||
}
|
||||
|
||||
$increments = $this->catalog->resolveIncrements($addonKey);
|
||||
$increments = $this->resolveAddonIncrements($addon, $addonKey);
|
||||
|
||||
DB::transaction(function () use ($addon, $transactionId, $checkoutId, $data, $increments) {
|
||||
$addon->forceFill([
|
||||
@@ -128,4 +128,25 @@ class EventAddonWebhookService
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, int>
|
||||
*/
|
||||
private function resolveAddonIncrements(EventPackageAddon $addon, string $addonKey): array
|
||||
{
|
||||
$stored = Arr::get($addon->metadata ?? [], 'increments', []);
|
||||
|
||||
if (is_array($stored) && $stored !== []) {
|
||||
$filtered = collect($stored)
|
||||
->map(fn ($value) => is_numeric($value) ? (int) $value : 0)
|
||||
->filter(fn ($value) => $value > 0)
|
||||
->all();
|
||||
|
||||
if ($filtered !== []) {
|
||||
return $filtered;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->catalog->resolveIncrements($addonKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user