Updated on 2026-08-14
This commit is contained in:
parent
dcda504df6
commit
a3b65cd194
3 changed files with 25 additions and 37 deletions
|
|
@ -148,7 +148,23 @@ internal class DefaultPaymentAccountStatusFetcher @Inject constructor(
|
|||
-> PaymentAccountStatusValue.IssuingCard(source = StatusSource.ACTUAL)
|
||||
|
||||
OrderStatus.CANCELED -> {
|
||||
PaymentAccountStatusValue.Error.CardIssueFailed(customerId = orderData.customerId)
|
||||
onboardingRepository.getCustomerInfo(userWalletId = account.userWalletId)
|
||||
.fold(
|
||||
ifLeft = {
|
||||
PaymentAccountStatusValue.Error.CardIssueFailed(
|
||||
customerId = orderData.customerId,
|
||||
)
|
||||
},
|
||||
ifRight = { customerInfo ->
|
||||
if (customerInfo.kycStatus == KycStatus.REJECTED) {
|
||||
customerInfo.mapToPaymentAccountStatus()
|
||||
} else {
|
||||
PaymentAccountStatusValue.Error.CardIssueFailed(
|
||||
customerId = orderData.customerId,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
OrderStatus.COMPLETED -> {
|
||||
// Order was completed -> clear order id and get customer info
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.tangem.domain.pay.usecase
|
|||
import arrow.core.Either
|
||||
import arrow.core.left
|
||||
import arrow.core.right
|
||||
import com.tangem.domain.models.kyc.KycStatus
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pay.TangemPayEligibilityManager
|
||||
import com.tangem.domain.pay.model.*
|
||||
|
|
@ -149,41 +148,14 @@ class TangemPayMainScreenCustomerInfoUseCase(
|
|||
error.mapErrorForCustomer().left()
|
||||
},
|
||||
ifRight = { orderData ->
|
||||
when (orderData.status) {
|
||||
OrderStatus.NEW,
|
||||
OrderStatus.PROCESSING,
|
||||
-> {
|
||||
onboardingRepository.getCustomerInfo(userWalletId = userWalletId)
|
||||
.mapLeft { it.mapErrorForCustomer() }
|
||||
.map { customerInfo ->
|
||||
MainScreenCustomerInfo(info = customerInfo, orderStatus = orderData.status)
|
||||
}
|
||||
}
|
||||
|
||||
// Order cancelled. No need to get customer info
|
||||
OrderStatus.CANCELED -> {
|
||||
MainScreenCustomerInfo(
|
||||
info = CustomerInfo(
|
||||
customerId = null,
|
||||
productInstance = null,
|
||||
kycStatus = KycStatus.INIT,
|
||||
cardInfo = null,
|
||||
),
|
||||
orderStatus = OrderStatus.CANCELED,
|
||||
).right()
|
||||
}
|
||||
|
||||
OrderStatus.COMPLETED,
|
||||
OrderStatus.UNKNOWN,
|
||||
-> {
|
||||
onboardingRepository.clearOrderId(userWalletId)
|
||||
onboardingRepository.getCustomerInfo(userWalletId = userWalletId)
|
||||
.mapLeft { it.mapErrorForCustomer() }
|
||||
.map { customerInfo ->
|
||||
MainScreenCustomerInfo(info = customerInfo, orderStatus = orderData.status)
|
||||
}
|
||||
}
|
||||
if (orderData.status in setOf(OrderStatus.COMPLETED, OrderStatus.UNKNOWN)) {
|
||||
onboardingRepository.clearOrderId(userWalletId)
|
||||
}
|
||||
onboardingRepository.getCustomerInfo(userWalletId = userWalletId)
|
||||
.mapLeft { it.mapErrorForCustomer() }
|
||||
.map { customerInfo ->
|
||||
MainScreenCustomerInfo(info = customerInfo, orderStatus = orderData.status)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ internal class TangemPayUpdateInfoStateTransformer(
|
|||
|
||||
// when statement copied to WalletTangemPayAnalyticsEventSender. Be careful when editing.
|
||||
return when {
|
||||
value.orderStatus == OrderStatus.CANCELED -> createCancelledState(customerId)
|
||||
value.info.kycStatus != KycStatus.APPROVED && !value.info.customerId.isNullOrEmpty() ->
|
||||
createKycInProgressState(kycStatus = value.info.kycStatus, customerId = customerId)
|
||||
value.orderStatus == OrderStatus.CANCELED -> createCancelledState(customerId)
|
||||
cardInfo != null && productInstance != null && value.orderStatus == OrderStatus.COMPLETED ->
|
||||
getCardInfoState(customerId, cardInfo, productInstance)
|
||||
else -> createIssueProgressState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue