diff options
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt index ae90b98..a026283 100644 --- a/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt +++ b/wallet/src/main/java/net/taler/wallet/exchanges/ExchangeFees.kt @@ -18,7 +18,6 @@ package net.taler.wallet.exchanges import net.taler.common.Amount import net.taler.common.Timestamp -import org.json.JSONObject data class CoinFee( val coin: Amount, @@ -42,54 +41,4 @@ data class ExchangeFees( val earliestDepositExpiration: Timestamp, val coinFees: List<CoinFee>, val wireFees: List<WireFee> -) { - companion object { - fun fromExchangeWithdrawDetailsJson(json: JSONObject): ExchangeFees { - val earliestDepositExpiration = - json.getJSONObject("earliestDepositExpiration").getLong("t_ms") - val selectedDenoms = json.getJSONObject("selectedDenoms") - val denoms = selectedDenoms.getJSONArray("selectedDenoms") - val coinFees = ArrayList<CoinFee>(denoms.length()) - for (i in 0 until denoms.length()) { - val denom = denoms.getJSONObject(i) - val d = denom.getJSONObject("denom") - val coinFee = CoinFee( - coin = Amount.fromJsonObject(d.getJSONObject("value")), - quantity = denom.getInt("count"), - feeDeposit = Amount.fromJsonObject(d.getJSONObject("feeDeposit")), - feeRefresh = Amount.fromJsonObject(d.getJSONObject("feeRefresh")), - feeRefund = Amount.fromJsonObject(d.getJSONObject("feeRefund")), - feeWithdraw = Amount.fromJsonObject(d.getJSONObject("feeWithdraw")) - ) - coinFees.add(coinFee) - } - - val wireFeesJson = json.getJSONObject("wireFees") - val feesForType = wireFeesJson.getJSONObject("feesForType") - val bankFees = feesForType.getJSONArray("x-taler-bank") - val wireFees = ArrayList<WireFee>(bankFees.length()) - for (i in 0 until bankFees.length()) { - val fee = bankFees.getJSONObject(i) - val startStamp = - fee.getJSONObject("startStamp").getLong("t_ms") - val endStamp = - fee.getJSONObject("endStamp").getLong("t_ms") - val wireFee = WireFee( - start = Timestamp(startStamp), - end = Timestamp(endStamp), - wireFee = Amount.fromJsonObject(fee.getJSONObject("wireFee")), - closingFee = Amount.fromJsonObject(fee.getJSONObject("closingFee")) - ) - wireFees.add(wireFee) - } - - return ExchangeFees( - withdrawFee = Amount.fromJsonObject(json.getJSONObject("withdrawFee")), - overhead = Amount.fromJsonObject(json.getJSONObject("overhead")), - earliestDepositExpiration = Timestamp(earliestDepositExpiration), - coinFees = coinFees, - wireFees = wireFees - ) - } - } -} +) |