Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-24 18:01:17 +04:00
parent 4ef7082504
commit 33848f2d49
5 changed files with 105 additions and 22 deletions

View file

@ -37,6 +37,9 @@ internal class DefaultOnboardingRepository @Inject constructor(
private val cardFrozenStateStore: TangemPayCardFrozenStateStore,
) : OnboardingRepository {
// Save data for a session
private var lastFetchedCustomerInfo: CustomerInfo? = null
override suspend fun validateDeeplink(link: String): Either<UniversalError, Boolean> {
return requestHelper.runWithErrorLogs(TAG) {
val result = tangemPayApi.validateDeeplink(DeeplinkValidityRequest(link))
@ -115,6 +118,10 @@ internal class DefaultOnboardingRepository @Inject constructor(
}
}
override fun getSavedCustomerInfo(): CustomerInfo? {
return lastFetchedCustomerInfo
}
override suspend fun createOrder(): Either<UniversalError, Unit> = withContext(dispatcherProvider.io) {
requestHelper.runWithErrorLogs(TAG) {
val walletAddress = requestHelper.getCustomerWalletAddress()
@ -162,7 +169,7 @@ internal class DefaultOnboardingRepository @Inject constructor(
productInstance = productInstance,
isKycApproved = response?.kyc?.status == APPROVED_KYC_STATUS,
cardInfo = cardInfo,
)
).also { lastFetchedCustomerInfo = it }
}
private suspend fun getOrderStatus(orderId: String): OrderStatus {