yxcyxc
All checks were successful
Deploy / deploy-staging (push) Successful in 25s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-08-13 23:43:16 +02:00
parent 4e707fdcba
commit 2adff4c91d

View File

@@ -512,7 +512,7 @@ final class OcrService
} }
$amount = round((float) str_replace(',', '.', $match[1]), 10); $amount = round((float) str_replace(',', '.', $match[1]), 10);
$currency = strtoupper((string) $match[2]); $currency = strtoupper((string) $match[2]);
if ($amount <= 0 || $currency === '' || in_array($currency, ['USD', 'EUR'], true)) { if ($amount < 0 || $currency === '' || in_array($currency, ['USD', 'EUR'], true)) {
continue; continue;
} }
@@ -555,18 +555,23 @@ final class OcrService
]; ];
} }
if ($walletCurrencyHint !== '' && array_key_exists($walletCurrencyHint, $balances)) { if (
$walletCurrencyHint !== ''
&& array_key_exists($walletCurrencyHint, $balances)
&& (float) (is_array($balances[$walletCurrencyHint]) ? ($balances[$walletCurrencyHint]['balance'] ?? 0.0) : $balances[$walletCurrencyHint]) > 0
) {
$walletCurrency = $walletCurrencyHint; $walletCurrency = $walletCurrencyHint;
$walletBalance = is_array($balances[$walletCurrencyHint]) $walletBalance = is_array($balances[$walletCurrencyHint])
? (float) ($balances[$walletCurrencyHint]['balance'] ?? 0.0) ? (float) ($balances[$walletCurrencyHint]['balance'] ?? 0.0)
: (float) $balances[$walletCurrencyHint]; : (float) $balances[$walletCurrencyHint];
} elseif ($balances !== []) { } elseif ($balances !== []) {
foreach (['DOGE', 'BTC', 'ETH', 'CTC', 'HSH', 'LTC', 'USDT', 'USDC'] as $preferredCurrency) { foreach (['DOGE', 'BTC', 'ETH', 'CTC', 'HSH', 'LTC', 'USDT', 'USDC'] as $preferredCurrency) {
if (array_key_exists($preferredCurrency, $balances)) { $preferredBalance = array_key_exists($preferredCurrency, $balances)
? (is_array($balances[$preferredCurrency]) ? (float) ($balances[$preferredCurrency]['balance'] ?? 0.0) : (float) $balances[$preferredCurrency])
: 0.0;
if ($preferredBalance > 0) {
$walletCurrency = $preferredCurrency; $walletCurrency = $preferredCurrency;
$walletBalance = is_array($balances[$preferredCurrency]) $walletBalance = $preferredBalance;
? (float) ($balances[$preferredCurrency]['balance'] ?? 0.0)
: (float) $balances[$preferredCurrency];
break; break;
} }
} }