summaryrefslogtreecommitdiff
path: root/wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt
diff options
context:
space:
mode:
Diffstat (limited to 'wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt')
-rw-r--r--wallet/src/commonMain/kotlin/net/taler/lib/wallet/exchange/Denomination.kt24
1 files changed, 11 insertions, 13 deletions
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 a515d96..036e4eb 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
@@ -85,14 +85,14 @@ internal data class Denomination(
* Signature over the denomination information by the exchange's master
* signing key.
*/
- val master_sig: String
+ val master_sig: String,
) {
fun toDenominationRecord(
baseUrl: String,
denomPubHash: ByteArray,
isOffered: Boolean,
isRevoked: Boolean,
- status: DenominationStatus
+ status: DenominationStatus,
): DenominationRecord =
DenominationRecord(
denomPub = denom_pub,
@@ -110,11 +110,11 @@ internal data class Denomination(
stampExpireWithdraw = stamp_expire_withdraw,
stampStart = stamp_start,
status = status,
- value = value
+ value = value,
)
}
-enum class DenominationStatus {
+internal enum class DenominationStatus {
/**
* Verification was delayed.
*/
@@ -128,10 +128,10 @@ enum class DenominationStatus {
/**
* Verified as invalid.
*/
- VerifiedBad
+ VerifiedBad,
}
-data class DenominationRecord(
+internal data class DenominationRecord(
/**
* Value of one coin of the denomination.
*/
@@ -201,7 +201,7 @@ data class DenominationRecord(
/**
* Base URL of the exchange.
*/
- val exchangeBaseUrl: String
+ val exchangeBaseUrl: String,
) {
fun isWithdrawable(now: Timestamp = Timestamp.now()): Boolean {
if (isRevoked) return false // can not use revoked denomination
@@ -213,15 +213,13 @@ data class DenominationRecord(
}
}
-data class DenominationSelectionInfo(
+internal data class DenominationSelectionInfo(
val totalCoinValue: Amount,
val totalWithdrawCost: Amount,
- val selectedDenominations: List<SelectedDenomination>
+ val selectedDenominations: List<SelectedDenomination>,
) {
fun getEarliestDepositExpiry(): Timestamp {
- if (selectedDenominations.isEmpty()) return Timestamp(
- Timestamp.NEVER
- )
+ if (selectedDenominations.isEmpty()) return Timestamp.never()
var earliest = selectedDenominations[0].denominationRecord.stampExpireDeposit
for (i in 1 until selectedDenominations.size) {
val stampExpireDeposit = selectedDenominations[i].denominationRecord.stampExpireDeposit
@@ -231,4 +229,4 @@ data class DenominationSelectionInfo(
}
}
-data class SelectedDenomination(val count: Int, val denominationRecord: DenominationRecord)
+internal data class SelectedDenomination(val count: Int, val denominationRecord: DenominationRecord)