yxcyxc
This commit is contained in:
@@ -512,7 +512,7 @@ final class OcrService
|
||||
}
|
||||
$amount = round((float) str_replace(',', '.', $match[1]), 10);
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
$walletBalance = is_array($balances[$walletCurrencyHint])
|
||||
? (float) ($balances[$walletCurrencyHint]['balance'] ?? 0.0)
|
||||
: (float) $balances[$walletCurrencyHint];
|
||||
} elseif ($balances !== []) {
|
||||
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;
|
||||
$walletBalance = is_array($balances[$preferredCurrency])
|
||||
? (float) ($balances[$preferredCurrency]['balance'] ?? 0.0)
|
||||
: (float) $balances[$preferredCurrency];
|
||||
$walletBalance = $preferredBalance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user