Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ internal class UserFlagsMapper @Inject constructor():
preferredOnRampProvider = from.preferredOnRampProvider.toDomain().takeIf { it != OnRampProvider.Unknown },
supportedOnRampProviders = from.supportedOnRampProvidersList.map { it.toDomain() },
minimumVersion = from.minBuildNumber,
billExchangeDataTimeout = from.billExchangeDataTimeout.seconds.toDuration(DurationUnit.SECONDS),
billExchangeDataTimeout = if (from.hasBillExchangeDataTimeout()) {
from.billExchangeDataTimeout.seconds.toDuration(DurationUnit.SECONDS)
} else null,
newCurrencyPurchaseAmount = Fiat(quarks = from.newCurrencyPurchaseAmount),
newCurrencyFeeAmount = Fiat(quarks = from.newCurrencyFeeAmount),
withdrawalFeeAmount = Fiat(quarks = from.withdrawalFeeAmount),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ data class UserFlags(
val preferredOnRampProvider: OnRampProvider?,
val supportedOnRampProviders: List<OnRampProvider>,
val minimumVersion: Int?,
// How long a verified exchange rate stays usable for a bill. Absent when the
// server hasn't set a timeout (not the same as a zero-length one, which
// disables verified exchange data entirely).
val billExchangeDataTimeout: Duration?,
val newCurrencyPurchaseAmount: Fiat,
val newCurrencyFeeAmount: Fiat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ class UserFlagsMapperTest {
assertEquals(30.seconds, result.billExchangeDataTimeout)
}

@Test
fun `bill exchange data timeout is null when unset, not zero`() {
val proto = userFlags { }

val result = mapper.map(proto)

assertNull(result.billExchangeDataTimeout)
}

@Test
fun `maps new currency purchase amount`() {
val proto = userFlags {
Expand Down
Loading