TP-000000 | call linked accounts only when customer status is linked … (#7778)

This commit is contained in:
Mohit Rajput
2023-09-06 15:20:08 +05:30
committed by GitHub
parent b7619d28cc
commit 128e120a89
3 changed files with 18 additions and 9 deletions

View File

@@ -134,6 +134,9 @@ class NaviPayActivity : BaseActivity() {
).apply {
data = intent?.data
})
if (viewModel.isCustomerStatusDeviceBounded()) {
checkOnboardedUserMandatoryPermissions()
}
}
}

View File

@@ -117,4 +117,8 @@ class NaviPayViewModel @Inject constructor(
fun isUserOnboarded(): Boolean {
return getCustomerStatus() == NaviPayCustomerStatus.LINKED_VPA
}
fun isCustomerStatusDeviceBounded(): Boolean {
return getCustomerStatus() == NaviPayCustomerStatus.DEVICE_BOUNDED
}
}

View File

@@ -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 -> {