minder change
This commit is contained in:
@@ -1003,7 +1003,7 @@ final class AnalyticsService
|
||||
private function expandOfferVariants(array $offers, array $settings): array
|
||||
{
|
||||
$expanded = [];
|
||||
foreach ($offers as $offer) {
|
||||
foreach ($this->configuredOfferBases($settings) as $offer) {
|
||||
$paymentType = $this->normalizeOfferPaymentType($offer);
|
||||
$baseSpeed = self::BASE_OFFER_SPEEDS[$paymentType] ?? self::BASE_OFFER_SPEEDS['fiat'];
|
||||
$baseSpeedValue = (float) $baseSpeed['value'];
|
||||
@@ -1089,6 +1089,39 @@ final class AnalyticsService
|
||||
return $expanded;
|
||||
}
|
||||
|
||||
private function configuredOfferBases(array $settings): array
|
||||
{
|
||||
$bases = [];
|
||||
$cryptoAmount = is_numeric($settings['crypto_base_price_amount'] ?? null) ? (float) $settings['crypto_base_price_amount'] : null;
|
||||
$cryptoCurrency = strtoupper(trim((string) ($settings['crypto_base_price_currency'] ?? '')));
|
||||
if ($cryptoAmount !== null && $cryptoAmount > 0 && $cryptoCurrency !== '') {
|
||||
$bases[] = [
|
||||
'id' => 'computed-crypto-base',
|
||||
'label' => 'Crypto Server',
|
||||
'payment_type' => 'crypto',
|
||||
'base_price_amount' => $cryptoAmount,
|
||||
'base_price_currency' => $cryptoCurrency,
|
||||
'auto_renew' => 0,
|
||||
'is_active' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
$fiatAmount = is_numeric($settings['fiat_base_price_amount'] ?? null) ? (float) $settings['fiat_base_price_amount'] : null;
|
||||
if ($fiatAmount !== null && $fiatAmount > 0) {
|
||||
$bases[] = [
|
||||
'id' => 'computed-fiat-base',
|
||||
'label' => 'Fiat Server',
|
||||
'payment_type' => 'fiat',
|
||||
'base_price_amount' => $fiatAmount,
|
||||
'base_price_currency' => 'EUR',
|
||||
'auto_renew' => 1,
|
||||
'is_active' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
return $bases;
|
||||
}
|
||||
|
||||
private function normalizeOfferPaymentType(array $offer): string
|
||||
{
|
||||
$paymentType = strtolower(trim((string) ($offer['payment_type'] ?? '')));
|
||||
|
||||
Reference in New Issue
Block a user