Add PayPal support for add-on and gift voucher checkout
This commit is contained in:
@@ -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>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user