Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-01 16:07:28 +03:00
parent 1f8386c05e
commit 0bfc7eee60
11 changed files with 112 additions and 9 deletions

View file

@ -1,5 +1,6 @@
package com.tangem.data.pay.repository
import arrow.core.Either
import com.squareup.moshi.Moshi
import com.tangem.data.common.cache.CacheRegistry
import com.tangem.data.visa.utils.TangemPayTxHistoryItemConverter
@ -11,6 +12,7 @@ import com.tangem.domain.tangempay.model.TangemPayTxHistoryListBatchFlow
import com.tangem.domain.tangempay.model.TangemPayTxHistoryListBatchingContext
import com.tangem.domain.tangempay.model.TangemPayTxHistoryListConfig
import com.tangem.domain.tangempay.repository.TangemPayTxHistoryRepository
import com.tangem.domain.visa.error.VisaApiError
import com.tangem.domain.visa.model.TangemPayTxHistoryItem
import com.tangem.pagination.BatchFetchResult
import com.tangem.pagination.BatchListSource
@ -99,6 +101,17 @@ internal class DefaultTangemPayTxHistoryRepository @Inject constructor(
return "tangem_pay_tx_history_${userWalletId.stringValue}_${cursor ?: INITIAL_CURSOR}"
}
override suspend fun getTransaction(
userWalletId: UserWalletId,
transactionId: String,
): Either<VisaApiError, TangemPayTxHistoryItem?> {
return requestPerformer.performRequest(userWalletId = userWalletId) { authHeader ->
visaApi.getCustomerTransaction(authHeader = authHeader, transactionId = transactionId)
}.map { response ->
txHistoryItemConverter.convert(response.result)
}
}
private suspend fun fetch(userWalletId: UserWalletId, cursor: String?, pageSize: Int) {
requestPerformer.performRequest(userWalletId = userWalletId) { authHeader ->
visaApi.getTangemPayTxHistory(authHeader = authHeader, limit = pageSize, cursor = cursor)

View file

@ -55,6 +55,8 @@ internal class TangemPayTxHistoryItemConverter(moshi: Moshi) :
status = TangemPayTxHistoryItemStatusConverter.convert(spend.status),
enrichedMerchantIconUrl = spend.enrichedMerchantIcon,
declinedReason = spend.declinedReason,
cardName = spend.cardDisplayName,
cardNumberLast4 = spend.cardNumberEnd,
)
}