Last active
August 29, 2015 14:19
-
-
Save tral/6048ceebf906edc0b44f to your computer and use it in GitHub Desktop.
alg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Баланс пользователя в Rch | |
Double userBalanceRch = Double.parseDouble(User.getBalanceRch(activity)); | |
// Шаг вывода в валюте продавца, если не задан, берем 1 | |
Double outStep = 1.0; | |
try { | |
outStep = Double.parseDouble(f_out_step); | |
} catch (Exception e) { | |
} | |
// Минимально возможный вывод в Rch, если не задан, то 0 | |
Double minPossibleOutRch = 0.0; | |
try { | |
minPossibleOutRch = Double.parseDouble(f_min_out); | |
} catch (Exception e) { | |
} | |
// Курс обмена, если не задан, то 1 | |
Double rateMerchant = 1.0; | |
try { | |
rateMerchant = Double.parseDouble(f_currency_rate); | |
} catch (Exception e) { | |
} | |
// Максимально возможный вывод в валюте продавца | |
// Вообще, максимально 8000 Rch можно выводить | |
userBalanceRch = (userBalanceRch > 8000) ? 8000 : userBalanceRch; | |
Double maxPossibleOut = userBalanceRch * rateMerchant; | |
maxPossibleOut = (Math.floor(maxPossibleOut / outStep)) * outStep; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment