diff options
Diffstat (limited to 'wallet/src/commonMain')
19 files changed, 189 insertions, 111 deletions
diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Base32Crockford.kt index 2517e85..b73f508 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Base32Crockford.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Base32Crockford.kt @@ -14,7 +14,7 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet +package net.taler.lib.crypto class EncodingException : Exception("Invalid encoding") diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Crypto.kt index cbb486a..7ca2ba8 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Crypto.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Crypto.kt @@ -14,7 +14,7 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet.crypto +package net.taler.lib.crypto internal interface Crypto { fun sha256(input: ByteArray): ByteArray diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/CryptoImpl.kt index 6b7cb8e..085b44b 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/CryptoImpl.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/CryptoImpl.kt @@ -14,7 +14,7 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet.crypto +package net.taler.lib.crypto abstract class CryptoImpl : Crypto { diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Deposit.kt index 66255d8..d63d034 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Deposit.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Deposit.kt @@ -14,11 +14,11 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet.crypto +package net.taler.lib.crypto import net.taler.lib.common.Amount import net.taler.lib.common.Timestamp -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.wallet.crypto.Signature import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_DEPOSIT import net.taler.lib.wallet.roundedToByteArray import net.taler.lib.wallet.toByteArray diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Kdf.kt index 2d714f8..ffdefb5 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Kdf.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/crypto/Kdf.kt @@ -14,7 +14,7 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet.crypto +package net.taler.lib.crypto import kotlin.experimental.xor import kotlin.math.ceil diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt index 7273dba..e7ee929 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Amount.kt @@ -17,7 +17,7 @@ package net.taler.lib.wallet import net.taler.lib.common.Amount -import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray +import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray fun Amount.toByteArray() = ByteArray(8 + 4 + 12).apply { value.toByteArray().copyInto(this, 0, 0, 8) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt index e67474b..6cb5a5c 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Time.kt @@ -17,7 +17,7 @@ package net.taler.lib.wallet import net.taler.lib.common.Timestamp -import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray +import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray fun Timestamp.roundedToByteArray(): ByteArray = ByteArray(8).apply { (truncateSeconds().ms * 1000L).toByteArray().copyInto(this) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt new file mode 100644 index 0000000..2542dd6 --- /dev/null +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Exchanges.kt @@ -0,0 +1,55 @@ +/* + * This file is part of GNU Taler + * (C) 2020 Taler Systems S.A. + * + * GNU Taler is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 3, or (at your option) any later version. + * + * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +package net.taler.lib.wallet.api + +import net.taler.lib.wallet.exchange.ExchangeRecord + +data class ExchangeListItem( + val exchangeBaseUrl: String, + val currency: String, + val paytoUris: List<String> +) { + companion object { + fun fromExchangeRecord(exchange: ExchangeRecord): ExchangeListItem? { + return if (exchange.details == null || exchange.wireInfo == null) null + else ExchangeListItem( + exchangeBaseUrl = exchange.baseUrl, + currency = exchange.details.currency, + paytoUris = exchange.wireInfo.accounts.map { + it.paytoUri + } + ) + } + } +} + +data class GetExchangeTosResult( + /** + * Markdown version of the current ToS. + */ + val tos: String, + + /** + * Version tag of the current ToS. + */ + val currentEtag: String, + + /** + * Version tag of the last ToS that the user has accepted, if any. + */ + val acceptedEtag: String? = null +) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Version.kt index ba9be3c..12916d3 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/Version.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Version.kt @@ -14,7 +14,7 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet +package net.taler.lib.wallet.api import net.taler.lib.common.Version diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt new file mode 100644 index 0000000..026c682 --- /dev/null +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletApi.kt @@ -0,0 +1,29 @@ +/* + * This file is part of GNU Taler + * (C) 2020 Taler Systems S.A. + * + * GNU Taler is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 3, or (at your option) any later version. + * + * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +package net.taler.lib.wallet.api + +import net.taler.lib.common.Amount + +public interface WalletApi { + fun getVersions(): SupportedVersions + fun getWithdrawalDetailsForUri(talerWithdrawUri: String): WithdrawalDetailsForUri + fun getWithdrawalDetailsForAmount(exchangeBaseUrl: String, amount: Amount): WithdrawalDetails + fun listExchanges(): List<ExchangeListItem> + fun addExchange(exchangeBaseUrl: String): ExchangeListItem + fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult + fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: String) +} diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt index bfe2825..d56f80c 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/WalletApi.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/WalletFactory.kt @@ -14,23 +14,27 @@ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -package net.taler.lib.wallet +package net.taler.lib.wallet.api import io.ktor.client.HttpClient import net.taler.lib.common.Amount import net.taler.lib.common.Timestamp import net.taler.lib.common.Version -import net.taler.lib.wallet.crypto.Crypto -import net.taler.lib.wallet.crypto.CryptoFactory +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.CryptoFactory +import net.taler.lib.wallet.Db +import net.taler.lib.wallet.DbFactory import net.taler.lib.wallet.crypto.Signature import net.taler.lib.wallet.exchange.Exchange -import net.taler.lib.wallet.exchange.ExchangeListItem -import net.taler.lib.wallet.exchange.GetExchangeTosResult +import net.taler.lib.wallet.getDefaultHttpClient import net.taler.lib.wallet.operations.Withdraw -import net.taler.lib.wallet.operations.WithdrawalDetails -import net.taler.lib.wallet.operations.WithdrawalDetailsForUri -public class WalletApi { + +public expect class WalletFactory { + fun createWalletApi(): WalletApi +} + +internal class WalletApiImpl { private val httpClient: HttpClient = getDefaultHttpClient() private val db: Db = DbFactory().openDb() @@ -39,7 +43,7 @@ public class WalletApi { private val exchangeManager: Exchange = Exchange(crypto, signature, httpClient, db = db) private val withdrawManager = Withdraw(httpClient, db, crypto, signature, exchangeManager) - public fun getVersions(): SupportedVersions { + fun getVersions(): SupportedVersions { return SupportedVersions( walletVersion = Version(8, 0, 0), exchangeVersion = Version(8, 0, 0), @@ -48,7 +52,7 @@ public class WalletApi { ) } - public suspend fun getWithdrawalDetailsForUri(talerWithdrawUri: String): WithdrawalDetailsForUri { + suspend fun getWithdrawalDetailsForUri(talerWithdrawUri: String): WithdrawalDetailsForUri { val bankInfo = withdrawManager.getBankInfo(talerWithdrawUri) return WithdrawalDetailsForUri( amount = bankInfo.amount, @@ -57,7 +61,7 @@ public class WalletApi { ) } - public suspend fun getWithdrawalDetailsForAmount( + suspend fun getWithdrawalDetailsForAmount( exchangeBaseUrl: String, amount: Amount ): WithdrawalDetails { @@ -69,19 +73,19 @@ public class WalletApi { ) } - public suspend fun listExchanges(): List<ExchangeListItem> { + suspend fun listExchanges(): List<ExchangeListItem> { return db.listExchanges().mapNotNull { exchange -> ExchangeListItem.fromExchangeRecord(exchange) } } - public suspend fun addExchange(exchangeBaseUrl: String): ExchangeListItem { + suspend fun addExchange(exchangeBaseUrl: String): ExchangeListItem { val exchange = exchangeManager.updateFromUrl(exchangeBaseUrl) db.put(exchange) return ExchangeListItem.fromExchangeRecord(exchange) ?: TODO("error handling") } - public suspend fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult { + suspend fun getExchangeTos(exchangeBaseUrl: String): GetExchangeTosResult { val record = db.getExchangeByBaseUrl(exchangeBaseUrl) ?: TODO("error handling") return GetExchangeTosResult( tos = record.termsOfServiceText ?: TODO("error handling"), @@ -90,7 +94,7 @@ public class WalletApi { ) } - public suspend fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: String) { + suspend fun setExchangeTosAccepted(exchangeBaseUrl: String, acceptedEtag: String) { db.transaction { val record = getExchangeByBaseUrl(exchangeBaseUrl) ?: TODO("error handling") val updatedRecord = record.copy( diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt new file mode 100644 index 0000000..88c96a4 --- /dev/null +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/api/Withdrawal.kt @@ -0,0 +1,53 @@ +/* + * This file is part of GNU Taler + * (C) 2020 Taler Systems S.A. + * + * GNU Taler is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 3, or (at your option) any later version. + * + * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +package net.taler.lib.wallet.api + +import net.taler.lib.common.Amount + +public data class WithdrawalDetailsForUri( + /** + * The amount that the user wants to withdraw + */ + val amount: Amount, + + /** + * Exchange suggested by the wallet + */ + val defaultExchangeBaseUrl: String?, + + /** + * A list of exchanges that can be used for this withdrawal + */ + val possibleExchanges: List<ExchangeListItem> +) + +public data class WithdrawalDetails( + /** + * Did the user accept the current version of the exchange's terms of service? + */ + val tosAccepted: Boolean, + + /** + * Amount that will be transferred to the exchange. + */ + val amountRaw: Amount, + + /** + * Amount that will be added to the user's wallet balance. + */ + val amountEffective: Amount +) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt index 22aa786..fa87348 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Planchet.kt @@ -17,7 +17,10 @@ package net.taler.lib.wallet.crypto import net.taler.lib.common.Amount -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.EddsaKeyPair +import net.taler.lib.wallet.crypto.Signature.PurposeBuilder +import net.taler.lib.crypto.Base32Crockford import net.taler.lib.wallet.toByteArray internal class Planchet(private val crypto: Crypto) { @@ -53,7 +56,7 @@ internal class Planchet(private val crypto: Crypto) { val denomPubHash = crypto.sha512(denomPub) val evHash = crypto.sha512(ev) - val withdrawRequest = Signature.PurposeBuilder(Signature.RESERVE_WITHDRAW) + val withdrawRequest = PurposeBuilder(Signature.RESERVE_WITHDRAW) .put(reservePub) .put(amountWithFee.toByteArray()) .put(req.feeWithdraw.toByteArray()) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt index c7678e4..b87eff2 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Recoup.kt @@ -16,10 +16,12 @@ package net.taler.lib.wallet.crypto -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.Base32Crockford import net.taler.lib.wallet.CoinRecord import net.taler.lib.wallet.CoinSourceType.REFRESH import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_RECOUP +import net.taler.lib.wallet.crypto.Signature.PurposeBuilder internal class Recoup(private val crypto: Crypto) { @@ -64,7 +66,7 @@ internal class Recoup(private val crypto: Crypto) { * Create and sign a message to recoup a coin. */ fun createRequest(coin: CoinRecord): Request { - val p = Signature.PurposeBuilder(WALLET_COIN_RECOUP) + val p = PurposeBuilder(WALLET_COIN_RECOUP) .put(Base32Crockford.decode(coin.coinPub)) .put(Base32Crockford.decode(coin.denomPubHash)) .put(Base32Crockford.decode(coin.blindingKey)) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt index 90478ef..8098437 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Refresh.kt @@ -17,9 +17,11 @@ package net.taler.lib.wallet.crypto import net.taler.lib.common.Amount -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.crypto.Base32Crockford import net.taler.lib.wallet.CoinRecord import net.taler.lib.common.Timestamp +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.EcdheKeyPair import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_LINK import net.taler.lib.wallet.crypto.Signature.Companion.WALLET_COIN_MELT import net.taler.lib.wallet.crypto.Signature.PurposeBuilder diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt index 006c004..8828509 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/crypto/Signature.kt @@ -16,8 +16,9 @@ package net.taler.lib.wallet.crypto -import net.taler.lib.wallet.Base32Crockford -import net.taler.lib.wallet.crypto.CryptoImpl.Companion.toByteArray +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.Base32Crockford +import net.taler.lib.crypto.CryptoImpl.Companion.toByteArray import net.taler.lib.wallet.exchange.DenominationRecord import net.taler.lib.wallet.exchange.WireFee import net.taler.lib.wallet.roundedToByteArray diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt index fca9e3f..a515d96 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt @@ -20,7 +20,7 @@ import kotlinx.serialization.Serializable import net.taler.lib.common.Amount import net.taler.lib.common.Duration import net.taler.lib.common.Timestamp -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.crypto.Base32Crockford import net.taler.lib.wallet.exchange.DenominationStatus.Unverified import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt index 4d89cd6..e685040 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Exchange.kt @@ -27,11 +27,11 @@ import io.ktor.http.HttpStatusCode import net.taler.lib.common.Amount import net.taler.lib.common.Timestamp import net.taler.lib.common.Version -import net.taler.lib.wallet.Base32Crockford +import net.taler.lib.crypto.Base32Crockford import net.taler.lib.wallet.Db import net.taler.lib.wallet.DbFactory -import net.taler.lib.wallet.crypto.Crypto -import net.taler.lib.wallet.crypto.CryptoFactory +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.CryptoFactory import net.taler.lib.wallet.crypto.Signature import net.taler.lib.wallet.exchange.DenominationStatus.Unverified import net.taler.lib.wallet.exchange.ExchangeUpdateReason.Initial @@ -223,40 +223,3 @@ internal class Exchange( } } - - -data class ExchangeListItem( - val exchangeBaseUrl: String, - val currency: String, - val paytoUris: List<String> -) { - companion object { - fun fromExchangeRecord(exchange: ExchangeRecord): ExchangeListItem? { - return if (exchange.details == null || exchange.wireInfo == null) null - else ExchangeListItem( - exchangeBaseUrl = exchange.baseUrl, - currency = exchange.details.currency, - paytoUris = exchange.wireInfo.accounts.map { - it.paytoUri - } - ) - } - } -} - -data class GetExchangeTosResult( - /** - * Markdown version of the current ToS. - */ - val tos: String, - - /** - * Version tag of the current ToS. - */ - val currentEtag: String, - - /** - * Version tag of the last ToS that the user has accepted, if any. - */ - val acceptedEtag: String? = null -) diff --git a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt index 69c68d1..84851ba 100644 --- a/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt +++ b/wallet/src/commonMain/kotlin/net/taler/lib/wallet/operations/Withdraw.kt @@ -23,12 +23,11 @@ import kotlinx.serialization.Serializable import net.taler.lib.common.Amount import net.taler.lib.common.TalerUri.parseWithdrawUri import net.taler.lib.common.Timestamp -import net.taler.lib.common.Version import net.taler.lib.common.Version.VersionMatchResult +import net.taler.lib.crypto.Crypto +import net.taler.lib.crypto.CryptoFactory import net.taler.lib.wallet.Db import net.taler.lib.wallet.DbFactory -import net.taler.lib.wallet.crypto.Crypto -import net.taler.lib.wallet.crypto.CryptoFactory import net.taler.lib.wallet.crypto.Signature import net.taler.lib.wallet.exchange.DenominationRecord import net.taler.lib.wallet.exchange.DenominationSelectionInfo @@ -36,7 +35,6 @@ import net.taler.lib.wallet.exchange.DenominationStatus.Unverified import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedBad import net.taler.lib.wallet.exchange.DenominationStatus.VerifiedGood import net.taler.lib.wallet.exchange.Exchange -import net.taler.lib.wallet.exchange.ExchangeListItem import net.taler.lib.wallet.exchange.ExchangeRecord import net.taler.lib.wallet.exchange.ExchangeWireInfo import net.taler.lib.wallet.exchange.SelectedDenomination @@ -46,7 +44,9 @@ internal class Withdraw( private val httpClient: HttpClient = getDefaultHttpClient(), private val db: Db = DbFactory().openDb(), private val crypto: Crypto = CryptoFactory.getCrypto(), - private val signature: Signature = Signature(crypto), + private val signature: Signature = Signature( + crypto + ), private val exchange: Exchange = Exchange(crypto, signature, httpClient, db = db) ) { @@ -270,37 +270,3 @@ internal class Withdraw( } } - -data class WithdrawalDetailsForUri( - /** - * The amount that the user wants to withdraw - */ - val amount: Amount, - - /** - * Exchange suggested by the wallet - */ - val defaultExchangeBaseUrl: String?, - - /** - * A list of exchanges that can be used for this withdrawal - */ - val possibleExchanges: List<ExchangeListItem> -) - -data class WithdrawalDetails( - /** - * Did the user accept the current version of the exchange's terms of service? - */ - val tosAccepted: Boolean, - - /** - * Amount that will be transferred to the exchange. - */ - val amountRaw: Amount, - - /** - * Amount that will be added to the user's wallet balance. - */ - val amountEffective: Amount -) |