TP-000000 | call linked accounts only when customer status is linked … (#7778)
This commit is contained in:
@@ -134,6 +134,9 @@ class NaviPayActivity : BaseActivity() {
|
||||
).apply {
|
||||
data = intent?.data
|
||||
})
|
||||
if (viewModel.isCustomerStatusDeviceBounded()) {
|
||||
checkOnboardedUserMandatoryPermissions()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,4 +117,8 @@ class NaviPayViewModel @Inject constructor(
|
||||
fun isUserOnboarded(): Boolean {
|
||||
return getCustomerStatus() == NaviPayCustomerStatus.LINKED_VPA
|
||||
}
|
||||
|
||||
fun isCustomerStatusDeviceBounded(): Boolean {
|
||||
return getCustomerStatus() == NaviPayCustomerStatus.DEVICE_BOUNDED
|
||||
}
|
||||
}
|
||||
@@ -500,28 +500,30 @@ class NaviPayOnboardingViewModel @Inject constructor(
|
||||
val customerAPIResponse =
|
||||
commonRepository.getCustomer(customerRequest = CustomerRequest(deviceData = deviceInfoProvider.getDeviceData()))
|
||||
|
||||
val customerStatus = customerAPIResponse.data?.customerStatus ?: ""
|
||||
|
||||
naviPayAnalytics.onGetCustomerCallAfterBindingEnd(
|
||||
deviceData = deviceInfoProvider.getDeviceData(),
|
||||
errors = customerAPIResponse.errors,
|
||||
customerStatus = customerAPIResponse.data?.customerStatus ?: ""
|
||||
customerStatus = customerStatus
|
||||
)
|
||||
|
||||
if (customerAPIResponse.isError()) {
|
||||
if (customerAPIResponse.isError() || customerStatus.isEmpty()) {
|
||||
onBindingError(customerAPIResponse)
|
||||
return@launch
|
||||
}
|
||||
|
||||
naviPayCustomerStatusHandler.updateCustomerStatus(
|
||||
customerAPIResponse.data?.customerStatus ?: ""
|
||||
)
|
||||
naviPayCustomerStatusHandler.updateCustomerStatus(customerStatus)
|
||||
|
||||
deferredApiCallList.add(viewModelScope.async { // Post verification linkedAccounts can be fetched
|
||||
refreshLinkedAccountsUseCase.execute()
|
||||
})
|
||||
if (customerStatus == NaviPayCustomerStatus.LINKED_VPA.name) {
|
||||
deferredApiCallList.add(viewModelScope.async { // Post verification linkedAccounts can be fetched
|
||||
refreshLinkedAccountsUseCase.execute()
|
||||
})
|
||||
}
|
||||
|
||||
deferredApiCallList.awaitAll() // wait for all API's to complete before navigating
|
||||
|
||||
when (customerAPIResponse.data?.customerStatus) {
|
||||
when (customerStatus) {
|
||||
NaviPayCustomerStatus.LINKED_VPA.name -> showLinkedAccountState()
|
||||
NaviPayCustomerStatus.DEVICE_BOUNDED.name -> showDeviceBoundedState()
|
||||
else -> {
|
||||
|
||||
Reference in New Issue
Block a user