Add PayPal support for add-on and gift voucher checkout

This commit is contained in:
Codex Agent
2026-02-04 14:54:40 +01:00
parent 7025418d9e
commit 17025df47b
24 changed files with 1599 additions and 34 deletions

View File

@@ -21,6 +21,8 @@ class EventAddonCatalog
'label' => $addon->label,
'variant_id' => $addon->variant_id,
'increments' => $addon->increments,
'price' => $this->resolveMetadataPrice($addon->metadata ?? []),
'currency' => 'EUR',
]];
})
->all();
@@ -46,6 +48,26 @@ class EventAddonCatalog
return $addon['variant_id'] ?? null;
}
public function resolvePrice(string $key): ?float
{
$addon = $this->find($key);
if (! $addon) {
return null;
}
$price = $addon['price'] ?? $addon['price_eur'] ?? null;
return is_numeric($price) ? (float) $price : null;
}
protected function resolveMetadataPrice(array $metadata): ?float
{
$price = $metadata['price_eur'] ?? null;
return is_numeric($price) ? (float) $price : null;
}
/**
* @return array<string, int>
*/