private suspend fun goToDuplicateCheck(isContactAdmin: Boolean = false) { val userParams = JsonObject() userParams.addProperty("companyName", uiState.value.companyName.value) userParams.addProperty("city", uiState.value.addressFields.city.value) userParams.addProperty("email", uiState.value.email.value) userParams.addProperty("username", uiState.value.userName.value) userParams.addProperty("country", uiState.value.addressFields.selectedIso3Code) when (val dupResult = getAccountInformationUseCase.getDuplicateResult( url = NetworkingService.instance.getOnboardingAPIURL("onboarding/dupcheck"), headers = if (isContactAdmin) { NetworkingService.instance.anAccessTokenHeadersForGoogleRecaptchaForContactAdmin } else { NetworkingService.instance.anAccessTokenHeadersForGoogleRecaptcha }, body = userParams )) { is RemoteResponse.Success -> { if (dupResult.value.matchResults.isEmpty()) { _uiState.value = uiState.value.copy( signInProcessing = false ) //TODO go to next step in sign up } else { _uiState.value = uiState.value.copy( signInProcessing = false, matchedResult = dupResult.value.matchResults ) navigationEvent.emit(RegistrationNavigationEvent.OpenAccountReviewScreen) } } is RemoteResponse.Failure -> { } } }
Function to make the api call for the Duplicate check of the account and provide the recommendation