Updated on 2026-08-14
This commit is contained in:
parent
45bd51c738
commit
717b8e2df2
4 changed files with 134 additions and 17 deletions
|
|
@ -1,14 +1,22 @@
|
|||
package com.tangem.common.test.data.quote
|
||||
|
||||
import com.tangem.datasource.api.tangemTech.models.QuotesResponse
|
||||
import com.tangem.datasource.local.quote.converter.QuoteStatusConverter
|
||||
import com.tangem.domain.models.StatusSource
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.quote.QuoteStatus
|
||||
import com.tangem.utils.extensions.orZero
|
||||
|
||||
fun QuotesResponse.Quote.toDomain(rawCurrencyId: String, source: StatusSource = StatusSource.ACTUAL): QuoteStatus {
|
||||
return QuoteStatusConverter(source = source).convert(value = mapOf(rawCurrencyId to this).entries.first())
|
||||
return QuoteStatus(
|
||||
rawCurrencyId = CryptoCurrency.RawID(rawCurrencyId),
|
||||
value = QuoteStatus.Data(
|
||||
source = source,
|
||||
fiatRate = price.orZero(),
|
||||
priceChange = priceChange24h.orZero().movePointLeft(2),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun Pair<String, QuotesResponse.Quote>.toDomain(source: StatusSource = StatusSource.ACTUAL): QuoteStatus {
|
||||
return QuoteStatusConverter(source = source).convert(value = mapOf(this).entries.first())
|
||||
return second.toDomain(rawCurrencyId = first, source = source)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue