TP-74032 | Journey Revamp Phase 1 | API Endpoint Changes (#11865)
Co-authored-by: Prajjaval Verma <prajjaval.verma@navi.com>
This commit is contained in:
committed by
GitHub
parent
cbc3843305
commit
6d8f1b2933
@@ -3,22 +3,14 @@ import { Dispatch, SetStateAction } from "react";
|
||||
import { getXTargetHeaderInfo } from "../../../../network/ApiClient";
|
||||
import { GZIP } from "../../../../network/NetworkConstant";
|
||||
import { get, patch, post } from "../../../../network/NetworkService";
|
||||
import {
|
||||
ActionMetaData,
|
||||
BaseActionTypes,
|
||||
} from "../../../common/actions/GenericAction";
|
||||
import { ActionMetaData } from "../../../common/actions/GenericAction";
|
||||
import {
|
||||
AnalyticsFlowNameConstant,
|
||||
AnalyticsMethodNameConstant,
|
||||
AnalyticsModuleNameConstant,
|
||||
BASE_SCREEN,
|
||||
} from "../../../common/constants";
|
||||
import { GI } from "../../../common/constants/NavigationHandlerConstants";
|
||||
import {
|
||||
sendAsAnalyticsEvent,
|
||||
sendAsGlobalErrorEvent,
|
||||
} from "../../../common/hooks/useAnalyticsEvent";
|
||||
import { logToSentry } from "../../../common/hooks/useSentryLogging";
|
||||
import { sendAsAnalyticsEvent } from "../../../common/hooks/useAnalyticsEvent";
|
||||
import { CtaData } from "../../../common/interface";
|
||||
import { ScreenData } from "../../../common/interface/widgets/screenData/ScreenData";
|
||||
import { ScreenState } from "../../../common/screen/BaseScreen";
|
||||
@@ -27,10 +19,10 @@ import {
|
||||
handleResponseData,
|
||||
} from "../../../common/screen/ScreenActionHandler";
|
||||
import { ScreenActionTypes } from "../../../common/screen/ScreenActionTypes";
|
||||
import { getErrorTypeFromStatusCode } from "../../../common/utilities/ErrorUtils";
|
||||
export interface SumInsuredRequestData {
|
||||
sumInsured: string;
|
||||
planId?: string;
|
||||
applicationId?: string | null;
|
||||
}
|
||||
|
||||
export const createQuote = async (
|
||||
@@ -105,7 +97,7 @@ export const getQuotePageData = async (
|
||||
},
|
||||
};
|
||||
const url = `v3/quotes/${quoteId}`;
|
||||
return get<ApiResponse<CtaData>>(url, requestConfig)
|
||||
return get<ApiResponse<CtaData>>(url, requestConfig, screenMetaData.data)
|
||||
.then(response => {
|
||||
handleResponseData(setScreenData, response);
|
||||
})
|
||||
|
||||
@@ -113,7 +113,8 @@ const QuoteOfferScreen = ({
|
||||
};
|
||||
});
|
||||
|
||||
const { preQuoteId, quoteId, navigatorType } = extractCtaParameters(ctaData);
|
||||
const { applicationId, preQuoteId, quoteId, navigatorType } =
|
||||
extractCtaParameters(ctaData);
|
||||
|
||||
const nativeEventListener = new NativeEventEmitter();
|
||||
let reloadPageEventListener = {} as EmitterSubscription;
|
||||
@@ -163,8 +164,9 @@ const QuoteOfferScreen = ({
|
||||
? ScreenActionTypes.FETCH_QUOTE_V4
|
||||
: ScreenActionTypes.FETCH_INSURANCE_QUOTE_PAGE_FROM_BACKEND;
|
||||
const data: QuoteOfferRequest = {
|
||||
preQuoteId: preQuoteId ? preQuoteId : undefined,
|
||||
quoteId: quoteId ? quoteId : undefined,
|
||||
preQuoteId: preQuoteId,
|
||||
quoteId: quoteId,
|
||||
applicationId: applicationId,
|
||||
};
|
||||
handleActions({
|
||||
baseActionType: BaseActionTypes.SCREEN_ACTION,
|
||||
@@ -190,6 +192,7 @@ const QuoteOfferScreen = ({
|
||||
const data: QuoteOfferRequest = {
|
||||
preQuoteId: preQuoteId ? preQuoteId : undefined,
|
||||
quoteId: quoteId ? quoteId : undefined,
|
||||
applicationId: applicationId ? applicationId : undefined,
|
||||
};
|
||||
handleActions({
|
||||
baseActionType: BaseActionTypes.SCREEN_ACTION,
|
||||
|
||||
@@ -42,6 +42,7 @@ export const QUOTE_APOLOGY_SUBTITLE =
|
||||
export const QUOTE_APOLOGY_BUTTON = "Buy new policy";
|
||||
export const QUOTE_PATCH_FAIL_TOAST = "Failed. Try again";
|
||||
export const QUOTE_ID = "quoteId";
|
||||
export const APPLICATION_ID = "applicationId";
|
||||
export const BUILD_CONFIG_DETAILS = "BUILD_CONFIG_DETAILS";
|
||||
export const SPACE_UNICODE = "\u00A0";
|
||||
export const REACT_NATIVE = "rn";
|
||||
|
||||
@@ -51,6 +51,7 @@ export enum ParameterType {
|
||||
PRE_QUOTE_ID = "preQuoteId",
|
||||
QUOTE_ID = "quoteId",
|
||||
NAVIGATOR_TYPE = "RnNavigatorType",
|
||||
APPLICATION_ID = "applicationId",
|
||||
}
|
||||
|
||||
export enum CtaType {
|
||||
@@ -60,4 +61,3 @@ export enum CtaType {
|
||||
RN_NAVIGATOR = "RN_NAVIGATOR",
|
||||
GO_BACK = "GO_BACK",
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,12 @@ export const extractCtaParameters = (
|
||||
preQuoteId?: string | undefined | null;
|
||||
quoteId?: string | undefined | null;
|
||||
navigatorType?: string | undefined | null;
|
||||
applicationId?: string | undefined | null;
|
||||
} => {
|
||||
let preQuoteId: string | undefined | null = undefined;
|
||||
let quoteId: string | undefined | null = undefined;
|
||||
let navigatorType: string | undefined | null = undefined;
|
||||
let applicationId: string | undefined | null = undefined;
|
||||
|
||||
ctaData?.parameters?.forEach((item: CtaParameter) => {
|
||||
switch (item.key) {
|
||||
@@ -65,12 +67,15 @@ export const extractCtaParameters = (
|
||||
case ParameterType.NAVIGATOR_TYPE:
|
||||
navigatorType = item.value;
|
||||
break;
|
||||
case ParameterType.APPLICATION_ID:
|
||||
applicationId = item.value;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
return { preQuoteId, quoteId, navigatorType };
|
||||
return { preQuoteId, quoteId, navigatorType, applicationId };
|
||||
};
|
||||
|
||||
export const Router = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { QUOTE_ID } from "../constants";
|
||||
import { APPLICATION_ID, QUOTE_ID } from "../constants";
|
||||
import { CtaData } from "../interface";
|
||||
import { ScreenMetaData } from "../interface/widgets/screenData/ScreenMetaData";
|
||||
|
||||
@@ -15,3 +15,19 @@ export const getQuoteIdFromScreenMetaData = (
|
||||
);
|
||||
return quoteObj?.value;
|
||||
};
|
||||
|
||||
export const getApplicationIdFromCta = (ctaData?: CtaData) => {
|
||||
const quoteObj = ctaData?.parameters?.find(
|
||||
item => item.key === APPLICATION_ID,
|
||||
);
|
||||
return quoteObj?.value;
|
||||
};
|
||||
|
||||
export const getApplicationFromScreenMetaData = (
|
||||
screenMetaData?: ScreenMetaData,
|
||||
) => {
|
||||
const quoteObj = screenMetaData?.screenProperties?.find(
|
||||
item => item.key === APPLICATION_ID,
|
||||
);
|
||||
return quoteObj?.value;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,8 @@ import { FinalPatchCallRequestBody } from "../../interface/widgets/widgetData/Fo
|
||||
import { NativeDeeplinkNavigatorModule } from "../../native-module/NativeModules";
|
||||
import { ScreenState } from "../../screen/BaseScreen";
|
||||
import {
|
||||
getApplicationFromScreenMetaData,
|
||||
getApplicationIdFromCta,
|
||||
getQuoteIdFromCta,
|
||||
getQuoteIdFromScreenMetaData,
|
||||
} from "../../utilities/CtaParamsUtils";
|
||||
@@ -136,7 +138,11 @@ const WidgetActionHandler = {
|
||||
let quoteId =
|
||||
getQuoteIdFromCta(ctaData) ??
|
||||
getQuoteIdFromScreenMetaData(screenData?.screenMetaData);
|
||||
let applicationId =
|
||||
getApplicationIdFromCta(ctaData) ??
|
||||
getApplicationFromScreenMetaData(screenData?.screenMetaData);
|
||||
const requestData: SumInsuredRequestData = widgetMetaData.data;
|
||||
requestData.applicationId = applicationId;
|
||||
return updateSumInsuredData(requestData, quoteId!!)
|
||||
.then(response => {})
|
||||
.catch(error => {
|
||||
@@ -155,12 +161,16 @@ const WidgetActionHandler = {
|
||||
let quoteId =
|
||||
getQuoteIdFromCta(ctaData) ??
|
||||
getQuoteIdFromScreenMetaData(screenData?.screenMetaData);
|
||||
let applicationId =
|
||||
getApplicationIdFromCta(ctaData) ??
|
||||
getApplicationFromScreenMetaData(screenData?.screenMetaData);
|
||||
const requestData: SumInsuredRequestData = (
|
||||
widgetMetaData?.data as FinalPatchCallRequestBody
|
||||
).requestData;
|
||||
const nextPageCta: CtaData = (
|
||||
widgetMetaData?.data as FinalPatchCallRequestBody
|
||||
).nextPageCta;
|
||||
requestData.applicationId = applicationId;
|
||||
return updateSumInsuredData(requestData, quoteId!!)
|
||||
.then(response => {
|
||||
handleResponseData(nextPageCta, setScreenData, screenData);
|
||||
|
||||
@@ -63,6 +63,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
private val surveyVM by activityViewModels<SurveyVM>()
|
||||
private var applicationType: String? = null
|
||||
private var pageName: String? = null
|
||||
private var applicationId: String? = null
|
||||
private val errorTracker = CommonNaviAnalytics.naviAnalytics.GiError()
|
||||
private var quoteId: String? = null
|
||||
private var policyId: String? = null
|
||||
@@ -79,6 +80,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
arguments?.getString(QUOTE_ID_EXTRA)?.let { quoteId = it }
|
||||
arguments?.getString(POLICY_ID_EXTRA)?.let { policyId = it }
|
||||
arguments?.getString(FLOW_IDENTIFIER)?.let { flowIdentifier = it }
|
||||
arguments?.getString(ARG_APPLICATION_ID)?.let { applicationId = it }
|
||||
arguments?.getParcelable<SurveyBottomSheetContentData>(SURVEY_BOTTOMSHEET_DATA)?.let {
|
||||
setFeedbackItemListData(it.pillItems)
|
||||
initUi(it)
|
||||
@@ -153,6 +155,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
surveyVM.sendSurveyFeedbackData(
|
||||
pageName.orEmpty(),
|
||||
SurveyFeedbackRequest(
|
||||
applicationId = applicationId,
|
||||
action = SUBMIT_ACTION,
|
||||
applicationType = applicationType.orEmpty(),
|
||||
quoteId = quoteId.orEmpty(),
|
||||
@@ -180,6 +183,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
surveyVM.sendSurveyFeedbackData(
|
||||
pageName.orEmpty(),
|
||||
SurveyFeedbackRequest(
|
||||
applicationId = applicationId,
|
||||
action = SKIP_ACTION,
|
||||
applicationType = applicationType.orEmpty(),
|
||||
quoteId = quoteId.orEmpty(),
|
||||
@@ -193,6 +197,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
surveyVM.sendSurveyFeedbackData(
|
||||
pageName.orEmpty(),
|
||||
SurveyFeedbackRequest(
|
||||
applicationId = applicationId,
|
||||
action = INIT_ACTION,
|
||||
applicationType = applicationType.orEmpty(),
|
||||
quoteId = quoteId.orEmpty(),
|
||||
@@ -373,6 +378,7 @@ class GiSurveyBottomSheet : BaseBottomSheet() {
|
||||
surveyVM.sendSurveyFeedbackData(
|
||||
pageName.orEmpty(),
|
||||
SurveyFeedbackRequest(
|
||||
applicationId = applicationId,
|
||||
action = EXIT_ACTION,
|
||||
applicationType = applicationType.orEmpty(),
|
||||
quoteId = quoteId.orEmpty(),
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.navi.insurance.models.request.AadhaarVerificationData
|
||||
import com.navi.insurance.models.request.FormNextPageRequest
|
||||
import com.navi.insurance.navigator.NaviInsuranceDeeplinkNavigator
|
||||
import com.navi.insurance.util.APPLICATION_TYPE_EXTRA
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.ASSET_DETAILS_EXTRA
|
||||
import com.navi.insurance.util.INITIAL_PAGE_UI
|
||||
import com.navi.insurance.util.PAGE_TYPE
|
||||
@@ -104,6 +105,7 @@ class PolicyStatusFragment : GiBaseFragment() {
|
||||
?: FormNextPageRequest()
|
||||
|
||||
viewModel.pageType = arguments?.getString(PAGE_TYPE).orEmpty()
|
||||
viewModel.applicationId = arguments?.getString(ARG_APPLICATION_ID)
|
||||
applicationType = arguments?.getString(APPLICATION_TYPE_EXTRA)
|
||||
initialPageUI = arguments?.getString(INITIAL_PAGE_UI)
|
||||
parentActivity = activity as? InsuranceContainerActivity
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2022-2023 by Navi Technologies Limited
|
||||
* * Copyright © 2022-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
@@ -17,6 +17,7 @@ data class SurveyContentResponse(
|
||||
)
|
||||
|
||||
data class SurveyFeedbackRequest(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("action") var action: String? = null,
|
||||
@SerializedName("applicationType") var applicationType: String? = null,
|
||||
@SerializedName("quoteId") val quoteId: String? = null,
|
||||
|
||||
@@ -19,9 +19,12 @@ class PolicyStatusRepository @Inject constructor(private val retrofitService: Re
|
||||
|
||||
suspend fun fetchCurrentPolicyStatus(
|
||||
quoteId: String?,
|
||||
applicationType: String? = null
|
||||
applicationType: String? = null,
|
||||
applicationId: String? = null
|
||||
): RepoResult<PolicyStatusResponse> =
|
||||
apiResponseCallback(retrofitService.fetchPolicyStatusResponse(quoteId, applicationType))
|
||||
apiResponseCallback(
|
||||
retrofitService.fetchPolicyStatusResponse(quoteId, applicationType, applicationId)
|
||||
)
|
||||
|
||||
suspend fun generateQuoteID(quoteId: String?): RepoResult<PolicyStatusResponse> =
|
||||
apiResponseCallback(retrofitService.generateQuoteID(quoteId))
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.navi.insurance.common.util.ActionHandler
|
||||
import com.navi.insurance.models.request.AadhaarVerificationData
|
||||
import com.navi.insurance.models.request.FormNextPageRequest
|
||||
import com.navi.insurance.models.request.FormTypedKeyData
|
||||
import com.navi.insurance.models.response.FormMetaData
|
||||
import com.navi.insurance.network.ApiErrorTagType
|
||||
import com.navi.insurance.util.POST_PURCHASE_JOURNEY
|
||||
import com.navi.insurance.util.TRIAL_POLICY
|
||||
@@ -48,6 +49,7 @@ constructor(
|
||||
var requestBody: AadhaarVerificationData = AadhaarVerificationData()
|
||||
var assetDetails: FormNextPageRequest = FormNextPageRequest()
|
||||
var pageType: String = ""
|
||||
var applicationId: String? = null
|
||||
|
||||
private fun exceptionHandler(errorTag: String) = CoroutineExceptionHandler { _, exception ->
|
||||
viewModelScope.launch {
|
||||
@@ -71,9 +73,11 @@ constructor(
|
||||
private fun getFormRequestData(
|
||||
aadhaarVerificationData: AadhaarVerificationData,
|
||||
pageType: String?,
|
||||
assetDetails: FormNextPageRequest? = null
|
||||
assetDetails: FormNextPageRequest? = null,
|
||||
applicationId: String? = null
|
||||
): FormNextPageRequest {
|
||||
return FormNextPageRequest(
|
||||
applicationId = applicationId,
|
||||
pageType = pageType.orEmpty(),
|
||||
data =
|
||||
listOf(
|
||||
@@ -81,7 +85,8 @@ constructor(
|
||||
attributes = aadhaarVerificationData,
|
||||
assetDetails = assetDetails,
|
||||
)
|
||||
)
|
||||
),
|
||||
formMetaData = FormMetaData(applicationId = applicationId)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -103,11 +108,21 @@ constructor(
|
||||
repository.fetchPostPurchaseStatus(
|
||||
sourceType,
|
||||
formNextPageRequest =
|
||||
getFormRequestData(requestBody, pageType, assetDetails)
|
||||
getFormRequestData(
|
||||
requestBody,
|
||||
pageType,
|
||||
assetDetails,
|
||||
applicationId = applicationId
|
||||
)
|
||||
)
|
||||
} else if (applicationType == TRIAL_POLICY) {
|
||||
repository.generateQuoteID(quoteId)
|
||||
} else repository.fetchCurrentPolicyStatus(quoteId, applicationType)
|
||||
} else
|
||||
repository.fetchCurrentPolicyStatus(
|
||||
quoteId,
|
||||
applicationType,
|
||||
applicationId = applicationId
|
||||
)
|
||||
if (
|
||||
response.error.isNull() &&
|
||||
response.errors.isNullOrEmpty() &&
|
||||
|
||||
@@ -59,11 +59,13 @@ import com.navi.insurance.formbase.states.FormNextPageResponseState
|
||||
import com.navi.insurance.formbase.states.FormPageResponseState
|
||||
import com.navi.insurance.formbase.states.FormPreviousPageResponseState
|
||||
import com.navi.insurance.models.request.FormNextPageRequest
|
||||
import com.navi.insurance.models.response.FormMetaData
|
||||
import com.navi.insurance.navigator.NaviInsuranceDeeplinkNavigator
|
||||
import com.navi.insurance.network.ApiErrorTagType
|
||||
import com.navi.insurance.quoteredesign.fragments.KYCBottomSheetFragment
|
||||
import com.navi.insurance.sharedpref.NaviPreferenceManager
|
||||
import com.navi.insurance.util.APPLICATION_TYPE_EXTRA
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.ASSET_DETAILS_EXTRA
|
||||
import com.navi.insurance.util.Constants.PARAMS_EXTRA
|
||||
import com.navi.insurance.util.EMPTY
|
||||
@@ -96,6 +98,7 @@ import kotlinx.coroutines.launch
|
||||
class PostPurchaseFormBasedFragment : GiBaseFragment(), ActionHandler.ActionOwner {
|
||||
private val viewModel by viewModels<PostPurchaseFormFragmentVM>()
|
||||
private lateinit var binding: FormFragmentLayoutBinding
|
||||
private var applicationId: String? = null
|
||||
private var referenceId: String? = null
|
||||
private var journeyKey: String? = null
|
||||
private var formAdapter: GiFormAdapter? = null
|
||||
@@ -134,6 +137,7 @@ class PostPurchaseFormBasedFragment : GiBaseFragment(), ActionHandler.ActionOwne
|
||||
requestPageType = it.getString(PAGE_TYPE)
|
||||
journeyKey = it.getString(JOURNEY_KEY_EXTRA) ?: "quotes"
|
||||
referenceId = it.getString(QUOTE_ID_EXTRA)
|
||||
applicationId = it.getString(ARG_APPLICATION_ID)
|
||||
if (referenceId.isNullOrEmpty()) {
|
||||
referenceId = it.getString(POLICY_ID_EXTRA)
|
||||
}
|
||||
@@ -178,7 +182,12 @@ class PostPurchaseFormBasedFragment : GiBaseFragment(), ActionHandler.ActionOwne
|
||||
}
|
||||
else -> {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewModel.fetchFormPageResponse(referenceId, journeyKey, requestPageType)
|
||||
viewModel.fetchFormPageResponse(
|
||||
referenceId,
|
||||
journeyKey,
|
||||
requestPageType,
|
||||
applicationId = applicationId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +196,14 @@ class PostPurchaseFormBasedFragment : GiBaseFragment(), ActionHandler.ActionOwne
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenStarted {
|
||||
launch { viewModel.fetchFormPageResponse(referenceId, journeyKey, requestPageType) }
|
||||
launch {
|
||||
viewModel.fetchFormPageResponse(
|
||||
referenceId,
|
||||
journeyKey,
|
||||
requestPageType,
|
||||
applicationId
|
||||
)
|
||||
}
|
||||
launch { viewModel.formResponseStateFlow.collect { setViewState(it) } }
|
||||
|
||||
launch { viewModel.formNextPageStateFlow.collect { setNextPageViewState(it) } }
|
||||
@@ -496,7 +512,8 @@ class PostPurchaseFormBasedFragment : GiBaseFragment(), ActionHandler.ActionOwne
|
||||
referenceId,
|
||||
pageType,
|
||||
transitionKey,
|
||||
journeyKey
|
||||
journeyKey,
|
||||
FormMetaData(applicationId = applicationId)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,11 @@ import com.navi.insurance.formbase.states.FormPreviousPageResponseState
|
||||
import com.navi.insurance.models.request.FormNextPageRequest
|
||||
import com.navi.insurance.models.request.FormPreviousPageRequest
|
||||
import com.navi.insurance.models.request.FormTypedKeyData
|
||||
import com.navi.insurance.models.response.FormMetaData
|
||||
import com.navi.insurance.models.response.FormPageResponse
|
||||
import com.navi.insurance.navigator.NaviInsuranceDeeplinkNavigator.HOME
|
||||
import com.navi.insurance.network.ApiErrorTagType
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.ASSET_DETAILS_EXTRA
|
||||
import com.navi.insurance.util.Constants.POLICY_ACTIVATION_ERROR
|
||||
import com.navi.insurance.util.PAGE_SOURCE
|
||||
@@ -100,7 +102,8 @@ constructor(
|
||||
suspend fun fetchFormPageResponse(
|
||||
referenceId: String?,
|
||||
journeyKey: String?,
|
||||
requestPageType: String? = null
|
||||
requestPageType: String? = null,
|
||||
applicationId: String? = null
|
||||
) {
|
||||
if (referenceId.isNullOrEmpty()) {
|
||||
_formResponseStateFlow.emit(FormPageResponseState.Error)
|
||||
@@ -110,9 +113,13 @@ constructor(
|
||||
viewModelScope.launch(dispatcher.io + giExceptionHandler) {
|
||||
val response: RepoResult<FormPageResponse> =
|
||||
if (requestPageType == preKycPage) {
|
||||
formRepository.fetchPreKycPage()
|
||||
formRepository.fetchPreKycPage(applicationId)
|
||||
} else {
|
||||
formRepository.fetchFormWithReferenceId(referenceId, journeyKey.orEmpty())
|
||||
formRepository.fetchFormWithReferenceId(
|
||||
referenceId,
|
||||
journeyKey.orEmpty(),
|
||||
applicationId = applicationId
|
||||
)
|
||||
}
|
||||
if (response.error == null && response.errors.isNullOrEmpty()) {
|
||||
_pageTypeFlow.emit(response.data?.metaData?.pageType)
|
||||
@@ -146,7 +153,8 @@ constructor(
|
||||
referenceId: String?,
|
||||
pageType: String?,
|
||||
transitionKey: String?,
|
||||
journeyKey: String?
|
||||
journeyKey: String?,
|
||||
formMetaData: FormMetaData?,
|
||||
) {
|
||||
if (formKeyData.isNull() || referenceId.isNull() || pageType.isNull()) {
|
||||
viewModelScope.launch { _formNextPageStateFlow.emit(FormNextPageResponseState.Error) }
|
||||
@@ -154,7 +162,12 @@ constructor(
|
||||
}
|
||||
viewModelScope.launch {
|
||||
val formNextPageRequestData =
|
||||
FormNextPageRequest(pageType = pageType, data = formKeyData)
|
||||
FormNextPageRequest(
|
||||
applicationId = formMetaData?.applicationId,
|
||||
pageType = pageType,
|
||||
data = formKeyData,
|
||||
formMetaData = formMetaData
|
||||
)
|
||||
_formNextPageStateFlow.emit(FormNextPageResponseState.Loading)
|
||||
val response =
|
||||
if (transitionKey != null) {
|
||||
@@ -361,14 +374,18 @@ constructor(
|
||||
)
|
||||
val sourceType = cta.parameters?.firstOrNull { it.key == SOURCE_TYPE }?.value
|
||||
val pageSource = cta.parameters?.firstOrNull { it.key == PAGE_SOURCE }?.value
|
||||
val applicationId =
|
||||
cta.parameters?.firstOrNull { it.key == ARG_APPLICATION_ID }?.value
|
||||
val formNextPageRequest =
|
||||
FormNextPageRequest(
|
||||
applicationId = applicationId,
|
||||
data =
|
||||
listOf(
|
||||
FormTypedKeyData(
|
||||
assetDetails = assetDetails,
|
||||
)
|
||||
)
|
||||
),
|
||||
formMetaData = FormMetaData(applicationId = applicationId)
|
||||
)
|
||||
fetchPolicyCurrentStatus(sourceType, formNextPageRequest, pageSource)
|
||||
}
|
||||
|
||||
@@ -74,13 +74,16 @@ class PostPurchaseFormRepository @Inject constructor(private val retrofitService
|
||||
|
||||
suspend fun fetchFormWithReferenceId(
|
||||
quoteId: String,
|
||||
journeyKey: String
|
||||
journeyKey: String,
|
||||
applicationId: String? = null
|
||||
): RepoResult<FormPageResponse> {
|
||||
return apiResponseCallback(retrofitService.fetchFormWithReferenceId(quoteId, journeyKey))
|
||||
return apiResponseCallback(
|
||||
retrofitService.fetchFormWithReferenceId(quoteId, journeyKey, applicationId)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun fetchPreKycPage(): RepoResult<FormPageResponse> {
|
||||
return apiResponseCallback(retrofitService.fetchPreKycDetails())
|
||||
suspend fun fetchPreKycPage(applicationId: String? = null): RepoResult<FormPageResponse> {
|
||||
return apiResponseCallback(retrofitService.fetchPreKycDetails(applicationId))
|
||||
}
|
||||
|
||||
suspend fun postFormPageData(quoteId: String): RepoResult<FormPageResponse> {
|
||||
|
||||
@@ -67,6 +67,7 @@ class PaymentRepository @Inject constructor(private val retrofitService: Retrofi
|
||||
clientStatus: String?,
|
||||
pgClientStatus: String? = null,
|
||||
flowIdentifier: String?,
|
||||
applicationId: String?,
|
||||
policyId: String?
|
||||
) =
|
||||
apiResponseCallback(
|
||||
@@ -75,6 +76,7 @@ class PaymentRepository @Inject constructor(private val retrofitService: Retrofi
|
||||
clientStatus,
|
||||
pgClientStatus,
|
||||
flowIdentifier,
|
||||
applicationId,
|
||||
policyId
|
||||
)
|
||||
)
|
||||
|
||||
@@ -91,10 +91,11 @@ class QuoteRepository @Inject constructor(private val retrofitService: RetrofitS
|
||||
quoteId: String,
|
||||
planId: String,
|
||||
tabId: String?,
|
||||
flowName: String?
|
||||
flowName: String?,
|
||||
applicationId: String? = null
|
||||
): RepoResult<QuoteGenericResponse> {
|
||||
return apiResponseCallback(
|
||||
retrofitService.fetchBenefitDetails(quoteId, planId, tabId, flowName)
|
||||
retrofitService.fetchBenefitDetails(quoteId, planId, tabId, flowName, applicationId)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -395,10 +395,22 @@ constructor(private val repository: QuoteRepository, actionHandler: ActionHandle
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchBenefitsDetails(quoteId: String, planId: String, tabId: String?, flowName: String?) {
|
||||
fun fetchBenefitsDetails(
|
||||
quoteId: String,
|
||||
planId: String,
|
||||
tabId: String?,
|
||||
flowName: String?,
|
||||
applicationId: String? = null
|
||||
) {
|
||||
coroutineScope.launch {
|
||||
val response =
|
||||
repository.fetchBenefitDetails(quoteId = quoteId, planId = planId, tabId, flowName)
|
||||
repository.fetchBenefitDetails(
|
||||
quoteId = quoteId,
|
||||
planId = planId,
|
||||
tabId,
|
||||
flowName,
|
||||
applicationId = applicationId
|
||||
)
|
||||
if (response.error == null && response.errors.isNullOrEmpty()) {
|
||||
_benefitResponse.value = response.data
|
||||
} else {
|
||||
|
||||
@@ -21,8 +21,10 @@ import javax.inject.Inject
|
||||
class AadhaarVerificationRepository
|
||||
@Inject
|
||||
constructor(private val retrofitService: RetrofitService) : ResponseCallback() {
|
||||
suspend fun fetchAadhaarInitResponse(): RepoResult<AadhaarVerifyInitDetails> {
|
||||
return apiResponseCallback(retrofitService.fetchAadhaarInitResponse())
|
||||
suspend fun fetchAadhaarInitResponse(
|
||||
applicationId: String? = null
|
||||
): RepoResult<AadhaarVerifyInitDetails> {
|
||||
return apiResponseCallback(retrofitService.fetchAadhaarInitResponse(applicationId))
|
||||
}
|
||||
|
||||
suspend fun postAadhaarVerificationData(
|
||||
@@ -34,9 +36,12 @@ constructor(private val retrofitService: RetrofitService) : ResponseCallback() {
|
||||
}
|
||||
|
||||
suspend fun fetchAadhaarPollingResponse(
|
||||
kycReferenceId: String
|
||||
kycReferenceId: String,
|
||||
applicationId: String? = null
|
||||
): RepoResult<AadhaarPollingResponse> {
|
||||
return apiResponseCallback(retrofitService.fetchAadhaarPollingResponse(kycReferenceId))
|
||||
return apiResponseCallback(
|
||||
retrofitService.fetchAadhaarPollingResponse(kycReferenceId, applicationId)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun doNextPageFormRequest(
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.navi.insurance.models.response.AadhaarVerifyInitDetails
|
||||
import com.navi.insurance.navigator.NaviInsuranceDeeplinkNavigator
|
||||
import com.navi.insurance.network.ApiConstants
|
||||
import com.navi.insurance.network.ApiErrorTagType
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.Constants
|
||||
import com.navi.insurance.util.JOURNEY_KEY_EXTRA
|
||||
import com.navi.insurance.util.TRUE
|
||||
@@ -67,6 +68,7 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
private val viewModel by viewModels<AadhaarVerificationVM>()
|
||||
private val aadhaarVerificationHelper by lazy { GiAadhaarVerificationHelper() }
|
||||
private val analyticsEventTracker = NaviInsuranceAnalytics.instance.KycVerificationScreen()
|
||||
private var applicationId: String? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@@ -76,6 +78,7 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
super.onCreateView(inflater, container, savedInstanceState)
|
||||
binding = FragmentAadhaarVerificationBinding.inflate(inflater, container, false)
|
||||
viewModel.okycFormEnabled = false
|
||||
applicationId = arguments?.getString(ARG_APPLICATION_ID)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -96,21 +99,23 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
pageType = arguments?.getString(PAGE_TYPE),
|
||||
transitionKey = arguments?.getString(TRANSITION_KEY),
|
||||
okycFormEnabled = true,
|
||||
applicationId = arguments?.getString(APPLICATION_ID_KEY),
|
||||
applicationId = arguments?.getString(ARG_APPLICATION_ID),
|
||||
providerType = arguments?.getString(PROVIDER_KEY),
|
||||
identifier = arguments?.getString(CUSTOMER_IDENTIFIER_KEY),
|
||||
authToken = arguments?.getString(AUTH_TOKEN_KEY)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
lifecycleScope.launchWhenStarted { viewModel.fetchAadhaarInitResponse() }
|
||||
lifecycleScope.launchWhenStarted {
|
||||
viewModel.fetchAadhaarInitResponse(applicationId = applicationId)
|
||||
}
|
||||
}
|
||||
binding.errorView.setProperties(
|
||||
object : NaviErrorPageView.Callback {
|
||||
override fun onRetryClick(tag: String?) {
|
||||
when (tag) {
|
||||
ApiErrorTagType.AADHAAR_INIT_RESPONSE_ERROR.value -> {
|
||||
viewModel.fetchAadhaarInitResponse()
|
||||
viewModel.fetchAadhaarInitResponse(applicationId = applicationId)
|
||||
}
|
||||
ApiErrorTagType.AADHAAR_VERIFICATION_RESPONSE_ERROR.value -> {
|
||||
viewModel.aadhaarVerificationData.value?.let { aadhaarVerificationData
|
||||
@@ -120,7 +125,7 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
}
|
||||
ApiErrorTagType.AADHAAR_POLLING_RESPONSE_ERROR.value -> {
|
||||
viewModel.kycReferenceId.value?.let { kycRefId ->
|
||||
viewModel.fetchAadhaarPollingResponse(kycRefId)
|
||||
viewModel.fetchAadhaarPollingResponse(kycRefId, applicationId)
|
||||
}
|
||||
}
|
||||
ApiErrorTagType.OKYC_VERIFICATION_FORM_FETCH_NEXT_ERROR.value -> {
|
||||
@@ -352,7 +357,7 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
binding.loaderView.isVisible = true
|
||||
viewModel.pollingData.value?.let { pollingData ->
|
||||
binding.title.setTextFieldData(pollingData.pollingTitle)
|
||||
viewModel.startPolling(pollingData, viewModel.kycReferenceId.value)
|
||||
viewModel.startPolling(pollingData, viewModel.kycReferenceId.value, applicationId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,6 +413,7 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
}
|
||||
|
||||
override fun onResult(error: DTException?, data: JSONObject?) {
|
||||
applicationId = applicationId ?: arguments?.getString(ARG_APPLICATION_ID)
|
||||
var aadhaarVerificationData = AadhaarVerificationData()
|
||||
error?.let {
|
||||
if (it.errorCode == ApiConstants.AADHAAR_USER_CANCELLED) {
|
||||
@@ -426,7 +432,8 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
error.errorCode,
|
||||
error.message,
|
||||
FirebaseStatusType.FAILURE,
|
||||
AadhaarDetails("", "")
|
||||
AadhaarDetails("", ""),
|
||||
applicationId = applicationId,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -436,7 +443,8 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
ApiConstants.API_SUCCESS_CODE,
|
||||
FirebaseStatusType.SUCCESS,
|
||||
FirebaseStatusType.SUCCESS,
|
||||
AadhaarDetails(txnId = data?.optString("txnId"))
|
||||
AadhaarDetails(txnId = data?.optString("txnId")),
|
||||
applicationId = applicationId
|
||||
)
|
||||
analyticsEventTracker.okycSuccess(screenName)
|
||||
}
|
||||
@@ -468,7 +476,6 @@ class GiAadhaarVerificationFragment : GiBaseFragment(), OKYCListener {
|
||||
private const val AUTH_TOKEN_KEY = "authToken"
|
||||
private const val OKYC_FORM_ENABLED_KEY = "okycFormEnabled"
|
||||
private const val IS_NAVI_ONE_PROFILE_ENABLED = "isNaviOneProfileEnabled"
|
||||
private const val APPLICATION_ID_KEY = "applicationId"
|
||||
private const val TRANSITION_KEY = "transition"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,12 +128,15 @@ constructor(
|
||||
ctaData = cta
|
||||
}
|
||||
|
||||
fun fetchAadhaarInitResponse() {
|
||||
fun fetchAadhaarInitResponse(applicationId: String? = null) {
|
||||
viewModelScope.launch(
|
||||
coroutineExceptionHandler(ApiErrorTagType.AADHAAR_INIT_RESPONSE_ERROR.value)
|
||||
) {
|
||||
_aadhaarVerificationInitResponseStateFlow.value = AadhaarInitResponseState.Loading
|
||||
val response = aadhaarVerificationRepository.fetchAadhaarInitResponse()
|
||||
val response =
|
||||
aadhaarVerificationRepository.fetchAadhaarInitResponse(
|
||||
applicationId = applicationId
|
||||
)
|
||||
if (
|
||||
response.error == null && response.errors.isNullOrEmpty() && response.data != null
|
||||
) {
|
||||
@@ -246,12 +249,16 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
fun fetchAadhaarPollingResponse(kycReferenceId: String) {
|
||||
fun fetchAadhaarPollingResponse(kycReferenceId: String, applicationId: String? = null) {
|
||||
viewModelScope.launch(
|
||||
coroutineExceptionHandler(ApiErrorTagType.AADHAAR_POLLING_RESPONSE_ERROR.value)
|
||||
) {
|
||||
_aadhaarPollingResponseStateFlow.value = AadhaarPollingResponseState.Loading
|
||||
val response = aadhaarVerificationRepository.fetchAadhaarPollingResponse(kycReferenceId)
|
||||
val response =
|
||||
aadhaarVerificationRepository.fetchAadhaarPollingResponse(
|
||||
kycReferenceId,
|
||||
applicationId = applicationId
|
||||
)
|
||||
if (
|
||||
response.error == null && response.errors.isNullOrEmpty() && response.data != null
|
||||
) {
|
||||
@@ -287,12 +294,13 @@ constructor(
|
||||
|
||||
fun startPolling(
|
||||
pollingData: AadhaarVerificationResponse.PollingData,
|
||||
kycReferenceId: String?
|
||||
kycReferenceId: String?,
|
||||
applicationId: String?
|
||||
) {
|
||||
if (kycReferenceId != null) {
|
||||
viewModelScope.launch {
|
||||
delay(pollingData.pollingInterval ?: DEFAULT_POLLING_DURATION)
|
||||
fetchAadhaarPollingResponse(kycReferenceId)
|
||||
fetchAadhaarPollingResponse(kycReferenceId, applicationId = applicationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,11 @@ import javax.inject.Inject
|
||||
class MemberNameDobRepository @Inject constructor(private val retrofitService: RetrofitService) :
|
||||
ResponseCallback() {
|
||||
|
||||
suspend fun fetchMemberNameDobDetails(quoteId: String? = null): RepoResult<NameDobResponse> =
|
||||
apiResponseCallback(retrofitService.fetchMemberNameDob(quoteId))
|
||||
suspend fun fetchMemberNameDobDetails(
|
||||
quoteId: String? = null,
|
||||
applicationId: String? = null
|
||||
): RepoResult<NameDobResponse> =
|
||||
apiResponseCallback(retrofitService.fetchMemberNameDob(quoteId, applicationId))
|
||||
|
||||
suspend fun getNextPageResponse(
|
||||
quoteId: String? = null,
|
||||
|
||||
@@ -74,13 +74,13 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchMemberNameDobResponse(quoteId: String? = null) {
|
||||
fun fetchMemberNameDobResponse(quoteId: String? = null, applicationId: String? = null) {
|
||||
viewModelScope.launch(
|
||||
dispatcher.io +
|
||||
exceptionHandler(ApiErrorTagType.MEMBER_NAME_DOB_SCREEN_LOAD_ERROR.value)
|
||||
) {
|
||||
_memberNameDobFlow.value = ResponseState.Loading
|
||||
val response = repository.fetchMemberNameDobDetails(quoteId)
|
||||
val response = repository.fetchMemberNameDobDetails(quoteId, applicationId)
|
||||
if (
|
||||
response.error.isNull() &&
|
||||
response.errors.isNullOrEmpty() &&
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.navi.insurance.member_name_dob_details.data.MemberNameDobVM
|
||||
import com.navi.insurance.models.response.PolicyIncompleteMemberDetails
|
||||
import com.navi.insurance.navigator.NaviInsuranceDeeplinkNavigator
|
||||
import com.navi.insurance.network.ApiErrorTagType
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.Constants
|
||||
import com.navi.insurance.util.QUOTE_ID_EXTRA
|
||||
import com.navi.insurance.util.launchHelpCenter
|
||||
@@ -67,6 +68,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
private var rvAdapter: NaviAdapter<GenericWidgetDataInfo>? = null
|
||||
private var footerData: NaviWidgetData? = null
|
||||
private var quoteId: String? = null
|
||||
private var applicationId: String? = null
|
||||
private var paymentFlowIdentifier: String? = null
|
||||
private var applicationType: String? = null
|
||||
private var parentActivity: InsuranceContainerActivity? = null
|
||||
@@ -90,6 +92,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
parentActivity = activity as? InsuranceContainerActivity
|
||||
pageBinding.landingPageRv.adapter = rvAdapter
|
||||
quoteId = arguments?.getString(QUOTE_ID_EXTRA)
|
||||
applicationId = arguments?.getString(ARG_APPLICATION_ID)
|
||||
sendInitScreenEvent()
|
||||
containerActivityVM.hideKeyboardOnFocusChange(true)
|
||||
return pageBinding.root
|
||||
@@ -161,7 +164,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
}
|
||||
}
|
||||
.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId, applicationId)
|
||||
}
|
||||
|
||||
private fun initErrorView() {
|
||||
@@ -169,7 +172,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
object : NaviErrorPageView.Callback {
|
||||
override fun onRetryClick(tag: String?) {
|
||||
if (tag == ApiErrorTagType.MEMBER_NAME_DOB_SCREEN_LOAD_ERROR.value) {
|
||||
viewModel.fetchMemberNameDobResponse(quoteId)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId, applicationId)
|
||||
} else if (
|
||||
tag == ApiErrorTagType.MEMBER_NAME_DOB_SCREEN_NEXT_PAGE_ERROR.value
|
||||
) {
|
||||
@@ -212,7 +215,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
}
|
||||
}
|
||||
.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId, applicationId)
|
||||
}
|
||||
|
||||
private fun handleSuccessResponse() {
|
||||
@@ -310,7 +313,7 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
callbackHandler =
|
||||
object : RequestToCallbackHandler {
|
||||
override fun onCallbackRaised() {
|
||||
viewModel.fetchMemberNameDobResponse(quoteId)
|
||||
viewModel.fetchMemberNameDobResponse(quoteId, applicationId)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -336,7 +339,11 @@ class MemberNameDobFragment : GiBaseFragment(), WidgetCallback {
|
||||
}
|
||||
}
|
||||
}
|
||||
val data = PolicyIncompleteMemberDetails(memberDetailList = requestList.toList())
|
||||
val data =
|
||||
PolicyIncompleteMemberDetails(
|
||||
memberDetailList = requestList.toList(),
|
||||
applicationId = applicationId
|
||||
)
|
||||
viewModel.requestBody = data
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ data class TurboPaymentOrderDetail(
|
||||
@SerializedName("paymentSdkToken") val paymentSdkToken: String? = null,
|
||||
@SerializedName("pollingConfig") val pollingConfig: PollingConfig,
|
||||
@SerializedName("nextPageCta") val nextPageCta: CtaData? = null,
|
||||
@SerializedName("apiFailureCta") val apiFailureCta: CtaData? = null
|
||||
@SerializedName("apiFailureCta") val apiFailureCta: CtaData? = null,
|
||||
@SerializedName("applicationId") val applicationId: String? = null
|
||||
) : Parcelable {
|
||||
@Parcelize
|
||||
data class PollingConfig(
|
||||
|
||||
@@ -15,6 +15,7 @@ data class AadhaarVerificationData(
|
||||
@SerializedName("status") val status: String? = null,
|
||||
@SerializedName("aadhaarDetails") val details: AadhaarDetails? = null,
|
||||
@SerializedName("referenceId") var referenceId: String? = null,
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
)
|
||||
|
||||
data class AadhaarDetails(
|
||||
|
||||
@@ -9,7 +9,10 @@ package com.navi.insurance.models.request
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class AddonRequest(@SerializedName("addons") var addons: List<Addon> = listOf())
|
||||
data class AddonRequest(
|
||||
@SerializedName("addons") var addons: List<Addon> = listOf(),
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
)
|
||||
|
||||
data class Addon(
|
||||
@SerializedName("coverId") var coverId: String?,
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.google.gson.annotations.SerializedName
|
||||
import com.navi.insurance.models.response.FormMetaData
|
||||
|
||||
data class FormNextPageRequest(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("pageType") val pageType: String? = null,
|
||||
@SerializedName("data") val data: List<FormTypedKeyData>? = null,
|
||||
@SerializedName("metadata") val formMetaData: FormMetaData? = null
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.navi.insurance.models.request
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class InitiateInstallmentPaymentRequest(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("installmentNumber") val installmentNumber: Int?,
|
||||
@SerializedName("installmentDate") val installmentDate: String?,
|
||||
@SerializedName("source") val source: String = "MOBILE",
|
||||
|
||||
@@ -23,6 +23,7 @@ data class FormPageResponse(
|
||||
)
|
||||
|
||||
data class FormMetaData(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("preQuoteId") val preQuoteId: String? = null,
|
||||
@SerializedName("quoteId") val quoteId: String? = null,
|
||||
@SerializedName("policyId") val policyId: String? = null,
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.navi.insurance.models.response
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class PolicyIncompleteMemberDetails(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("selfDetailsRequired") var selfDetailsRequired: Boolean? = null,
|
||||
@SerializedName("memberDetailList") var memberDetailList: List<MemberDetail>?
|
||||
) {
|
||||
|
||||
@@ -127,6 +127,7 @@ interface RetrofitService {
|
||||
@Query("clientStatus") clientStatus: String?,
|
||||
@Query("pgClientStatus") pgClientStatus: String? = null,
|
||||
@Query("flowIdentifier") flowIdentifier: String?,
|
||||
@Query("applicationId") applicationId: String?,
|
||||
@Query("policyId") policyId: String?,
|
||||
): Response<GenericResponse<PaymentStateResponse>>
|
||||
|
||||
@@ -468,7 +469,8 @@ interface RetrofitService {
|
||||
@Path("quoteId") quoteId: String,
|
||||
@Path("planId") planId: String,
|
||||
@Query("tabId") tabId: String? = null,
|
||||
@Query("applicationType") applicationType: String?
|
||||
@Query("applicationType") applicationType: String?,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<QuoteGenericResponse>>
|
||||
|
||||
@GET("/quotes/{quoteId}/plans/compare")
|
||||
@@ -895,11 +897,14 @@ interface RetrofitService {
|
||||
@GET("/journeys/{journeyKey}/{referenceId}")
|
||||
suspend fun fetchFormWithReferenceId(
|
||||
@Path("referenceId") referenceId: String,
|
||||
@Path("journeyKey") journeyKey: String
|
||||
@Path("journeyKey") journeyKey: String,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<FormPageResponse>>
|
||||
|
||||
@GET("/customer-kyc/pre-kyc")
|
||||
suspend fun fetchPreKycDetails(): Response<GenericResponse<FormPageResponse>>
|
||||
suspend fun fetchPreKycDetails(
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<FormPageResponse>>
|
||||
|
||||
@PATCH("/journeys/{journeyKey}/{quoteId}/{transitionKey}")
|
||||
suspend fun transitionFormPageWithQuoteId(
|
||||
@@ -1128,7 +1133,9 @@ interface RetrofitService {
|
||||
): Response<GenericResponse<FeedbackFormResponse>>
|
||||
|
||||
@GET("/okyc/settings")
|
||||
suspend fun fetchAadhaarInitResponse(): Response<GenericResponse<AadhaarVerifyInitDetails>>
|
||||
suspend fun fetchAadhaarInitResponse(
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<AadhaarVerifyInitDetails>>
|
||||
|
||||
@POST("/okyc/verify")
|
||||
suspend fun postAadhaarVerificationData(
|
||||
@@ -1137,24 +1144,28 @@ interface RetrofitService {
|
||||
|
||||
@GET("/okyc/{kycReferenceId}")
|
||||
suspend fun fetchAadhaarPollingResponse(
|
||||
@Path("kycReferenceId") policyId: String? = null
|
||||
@Path("kycReferenceId") policyId: String? = null,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<AadhaarPollingResponse>>
|
||||
|
||||
@GET("/quotes/{quoteId}/status")
|
||||
suspend fun fetchPolicyStatusResponse(
|
||||
@Path("quoteId") quoteId: String? = null,
|
||||
@Query("applicationType") applicationType: String? = null
|
||||
@Query("applicationType") applicationType: String? = null,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<PolicyStatusResponse>>
|
||||
|
||||
@GET("/payment-screen")
|
||||
suspend fun fetchPAymentReviewInMR(
|
||||
@Query("id") id: String? = null,
|
||||
@Query("paymentFlowIdentifier") paymentFlowIdentifier: String? = null
|
||||
@Query("paymentFlowIdentifier") paymentFlowIdentifier: String? = null,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<PaymentReviewResponse>>
|
||||
|
||||
@GET("/quotes/{quoteId}/member-identity-details")
|
||||
suspend fun fetchMemberNameDob(
|
||||
@Path("quoteId") quoteId: String? = null
|
||||
@Path("quoteId") quoteId: String? = null,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<NameDobResponse>>
|
||||
|
||||
@PATCH("/quotes/{quoteId}/member-identity-details")
|
||||
@@ -1208,23 +1219,27 @@ interface RetrofitService {
|
||||
@GET("/pre-quotes/{preQuoteId}")
|
||||
suspend fun fetchFormPageWithPreQuoteId(
|
||||
@Path("preQuoteId") preQuoteId: String,
|
||||
@Query("applicationType") applicationType: String
|
||||
@Query("applicationType") applicationType: String,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@POST("/pre-quotes")
|
||||
suspend fun fetchPreQuoteFormWithApplicationType(
|
||||
@Query("applicationType") applicationType: String
|
||||
@Query("applicationType") applicationType: String,
|
||||
@Body formNextPageRequest: FormWidgetRequest,
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@GET("/pre-quotes")
|
||||
suspend fun fetchPreQuoteJourney(
|
||||
@Query("applicationType") applicationType: String
|
||||
@Query("applicationType") applicationType: String,
|
||||
@Query("applicationId") applicationId: String? = null
|
||||
): Response<GenericResponse<PreQuoteJourneyPageResponse>>
|
||||
|
||||
@POST("/quotes/{quoteId}/pages/{pageType}")
|
||||
suspend fun fetchFormPageWithQuoteId(
|
||||
@Path("quoteId") quoteId: String,
|
||||
@Path("pageType") pageType: String
|
||||
@Path("pageType") pageType: String,
|
||||
@Body formNextPageRequest: FormWidgetRequest,
|
||||
): Response<GenericResponse<PreQuotePatchResponse>>
|
||||
|
||||
@GET("/hospital/search")
|
||||
|
||||
@@ -18,7 +18,14 @@ class PaymentReviewRepository @Inject constructor(private val retrofitService: R
|
||||
|
||||
suspend fun fetchPaymentReviewInMR(
|
||||
id: String? = null,
|
||||
paymentFlowIdentifier: String?
|
||||
paymentFlowIdentifier: String?,
|
||||
applicationId: String? = null
|
||||
): RepoResult<PaymentReviewResponse> =
|
||||
apiResponseCallback(retrofitService.fetchPAymentReviewInMR(id = id, paymentFlowIdentifier))
|
||||
apiResponseCallback(
|
||||
retrofitService.fetchPAymentReviewInMR(
|
||||
id = id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId = applicationId
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
private var id: String? = null
|
||||
private var paymentFlowIdentifier: String? = null
|
||||
private var applicationType: String? = null
|
||||
private var applicationId: String? = null
|
||||
private var eventName: String? = null
|
||||
private var parentActivity: InsuranceContainerActivity? = null
|
||||
private val naviCheckoutVM by viewModels<NaviCheckoutViewModel>()
|
||||
@@ -138,6 +139,7 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
?: run { activity?.intent?.getStringExtra(EVENT_NAME_EXTRA) }
|
||||
sendInitScreenEvent()
|
||||
paymentFlowIdentifier = arguments?.getString(PAYMENT_FLOW_IDENTIFIER)
|
||||
applicationId = arguments?.getString(ARG_APPLICATION_ID)
|
||||
parentActivity = activity as? InsuranceContainerActivity
|
||||
binding.landingPageRv.adapter = rvAdapter
|
||||
return binding.root
|
||||
@@ -164,7 +166,7 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
object : NaviErrorPageView.Callback {
|
||||
override fun onRetryClick(tag: String?) {
|
||||
if (tag == ApiErrorTagType.BENEFIT_EXPLAINER_DETAILS.value) {
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier, applicationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +233,7 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
}
|
||||
}
|
||||
.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier, applicationId)
|
||||
}
|
||||
|
||||
private fun handleSuccessResponse() {
|
||||
@@ -275,14 +277,22 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
.toBoolean()
|
||||
.not()
|
||||
) {
|
||||
policyId = getParameterFromCta(it, Constants.POLICY_ID)
|
||||
policyId =
|
||||
getParameterFromCta(it, Constants.POLICY_ID)
|
||||
?: getParameterFromCta(it, ARG_APPLICATION_ID)
|
||||
applicationType = getParameterFromCta(it, Constants.APPLICATION_TYPE)
|
||||
val request =
|
||||
InitiateInstallmentPaymentRequest(
|
||||
applicationId = getParameterFromCta(it, ARG_APPLICATION_ID),
|
||||
installmentNumber =
|
||||
getParameterFromCta(it, Constants.INSTALMENT_NUMBER)
|
||||
?.toInt(),
|
||||
paymentType = getParameterFromCta(it, Constants.PAYMENT_TYPE),
|
||||
paymentType =
|
||||
getParameterFromCta(it, Constants.PAYMENT_TYPE)
|
||||
?: getParameterFromCta(
|
||||
it,
|
||||
Constants.PAYMENT_SCHEDULE_TYPE
|
||||
),
|
||||
installmentDate =
|
||||
getParameterFromCta(it, Constants.INSTALMENT_DATE),
|
||||
clientSuggestedPaymentProvider = null,
|
||||
@@ -298,7 +308,11 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
callbackHandler =
|
||||
object : RequestToCallbackHandler {
|
||||
override fun onCallbackRaised() {
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(
|
||||
id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -314,7 +328,11 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
callbackHandler =
|
||||
object : RequestToCallbackHandler {
|
||||
override fun onCallbackRaised() {
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(
|
||||
id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -390,7 +408,11 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
callbackHandler =
|
||||
object : RequestToCallbackHandler {
|
||||
override fun onCallbackRaised() {
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(
|
||||
id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -403,7 +425,11 @@ class PaymentReviewFragment : GiBaseFragment(), WidgetCallback {
|
||||
callbackHandler =
|
||||
object : RequestToCallbackHandler {
|
||||
override fun onCallbackRaised() {
|
||||
viewModel.fetchPaymentReview(id, paymentFlowIdentifier)
|
||||
viewModel.fetchPaymentReview(
|
||||
id,
|
||||
paymentFlowIdentifier,
|
||||
applicationId
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -90,6 +90,7 @@ class PaymentStatusActivity : GiBaseActivity() {
|
||||
pgClientStatus = null,
|
||||
flowIdentifier = intent?.getStringExtra(PAYMENT_FLOW_IDENTIFIER),
|
||||
pollingConfig = turboPaymentOrderDetail?.pollingConfig,
|
||||
applicationId = turboPaymentOrderDetail?.applicationId,
|
||||
policyId = intent?.getStringExtra(Constants.POLICY_ID)
|
||||
)
|
||||
lifecycleScope.launch {
|
||||
|
||||
@@ -70,6 +70,7 @@ open class HITurboCheckoutVM @Inject constructor(actionHandler: ActionHandler) :
|
||||
pgClientStatus: String? = null,
|
||||
flowIdentifier: String? = null,
|
||||
pollingConfig: TurboPaymentOrderDetail.PollingConfig? = null,
|
||||
applicationId: String? = null,
|
||||
policyId: String?
|
||||
) {
|
||||
_paymentStatus.value = PaymentInitState.Loading
|
||||
@@ -91,6 +92,7 @@ open class HITurboCheckoutVM @Inject constructor(actionHandler: ActionHandler) :
|
||||
clientStatus,
|
||||
pgClientStatus,
|
||||
flowIdentifier,
|
||||
applicationId,
|
||||
policyId
|
||||
)
|
||||
if (
|
||||
|
||||
@@ -61,12 +61,17 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchPaymentReview(id: String?, paymentFlowIdentifier: String?) {
|
||||
fun fetchPaymentReview(
|
||||
id: String?,
|
||||
paymentFlowIdentifier: String?,
|
||||
applicationId: String? = null
|
||||
) {
|
||||
viewModelScope.launch(
|
||||
dispatcher.io + exceptionHandler(ApiErrorTagType.PAYMENT_REVIEW_SCREEN_LOAD_ERROR.value)
|
||||
) {
|
||||
_paymentRequestFlow.value = ResponseState.Loading
|
||||
val response = repository.fetchPaymentReviewInMR(id, paymentFlowIdentifier)
|
||||
val response =
|
||||
repository.fetchPaymentReviewInMR(id, paymentFlowIdentifier, applicationId)
|
||||
if (
|
||||
response.error.isNull() &&
|
||||
response.errors.isNullOrEmpty() &&
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.navi.insurance.pre.purchase.journey
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
data class FormWidgetRequest(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("pageType") val pageType: String? = null,
|
||||
@SerializedName("data") val data: List<WidgetKey>? = null,
|
||||
@SerializedName("metadata") val metadata: PreQuoteMetaData? = null
|
||||
|
||||
@@ -25,6 +25,7 @@ data class PreQuoteJourneyPageResponse(
|
||||
)
|
||||
|
||||
data class PreQuoteMetaData(
|
||||
@SerializedName("applicationId") val applicationId: String? = null,
|
||||
@SerializedName("preQuoteId") val preQuoteId: String? = null,
|
||||
@SerializedName("quoteId") val quoteId: String? = null,
|
||||
@SerializedName("policyId") val policyId: String? = null,
|
||||
@@ -48,6 +49,8 @@ data class PreQuoteJourneyState(
|
||||
val isLoadingNextPage: Boolean = false
|
||||
)
|
||||
|
||||
data class PreQuoteRequestBody(@SerializedName("applicationId") val applicationId: String? = null)
|
||||
|
||||
data class PreQuoteNextPageRequest(
|
||||
@SerializedName("pageType") val pageType: String? = null,
|
||||
@SerializedName("data") val data: List<FormWidgetRequest>? = null,
|
||||
|
||||
@@ -17,34 +17,44 @@ class PreQuoteJourneyRespository @Inject constructor(private val apiService: Ret
|
||||
|
||||
suspend fun fetchFormPageDataWithPreQuoteId(
|
||||
preQuoteId: String,
|
||||
applicationType: String
|
||||
applicationType: String,
|
||||
applicationId: String? = null
|
||||
): RepoResult<PreQuoteJourneyPageResponse> {
|
||||
return apiResponseCallback(
|
||||
apiService.fetchFormPageWithPreQuoteId(preQuoteId, applicationType)
|
||||
apiService.fetchFormPageWithPreQuoteId(preQuoteId, applicationType, applicationId)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun fetchFormPageDataWithQuoteId(
|
||||
quoteId: String,
|
||||
pageType: String
|
||||
pageType: String,
|
||||
formRequest: FormWidgetRequest,
|
||||
): RepoResult<PreQuotePatchResponse> {
|
||||
return apiResponseCallback(apiService.fetchFormPageWithQuoteId(quoteId, pageType))
|
||||
return apiResponseCallback(
|
||||
apiService.fetchFormPageWithQuoteId(quoteId, pageType, formRequest)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun postFormPageData(applicationType: String): RepoResult<PreQuoteJourneyPageResponse> {
|
||||
return apiResponseCallback(apiService.fetchPreQuoteFormWithApplicationType(applicationType))
|
||||
suspend fun postFormPageData(
|
||||
applicationType: String,
|
||||
requestBody: FormWidgetRequest,
|
||||
): RepoResult<PreQuoteJourneyPageResponse> {
|
||||
return apiResponseCallback(
|
||||
apiService.fetchPreQuoteFormWithApplicationType(applicationType, requestBody)
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun fetchFormPageData(
|
||||
applicationType: String
|
||||
applicationType: String,
|
||||
applicationId: String? = null
|
||||
): RepoResult<PreQuoteJourneyPageResponse> {
|
||||
return apiResponseCallback(apiService.fetchPreQuoteJourney(applicationType))
|
||||
return apiResponseCallback(apiService.fetchPreQuoteJourney(applicationType, applicationId))
|
||||
}
|
||||
|
||||
suspend fun makeNextPageFormRequest(
|
||||
formRequest: FormWidgetRequest,
|
||||
preQuoteId: String,
|
||||
transitionName: String
|
||||
transitionName: String,
|
||||
): RepoResult<PreQuotePatchResponse> {
|
||||
return apiResponseCallback(
|
||||
apiService.nextPagePreQuote(
|
||||
|
||||
@@ -83,6 +83,7 @@ import com.navi.insurance.pre.purchase.journey.WidgetKey
|
||||
import com.navi.insurance.pre.purchase.journey.composables.ShowLoaderScreen
|
||||
import com.navi.insurance.pre.purchase.journey.factory.ComposableWidgetFactory
|
||||
import com.navi.insurance.quoteredesign.fragments.KYCBottomSheetFragment
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.ARG_APPLICATION_TYPE
|
||||
import com.navi.insurance.util.ARG_PRE_QUOTE_ID
|
||||
import com.navi.insurance.util.ApiConstants
|
||||
@@ -126,6 +127,7 @@ class PreQuoteJourneyFragment() : GiBaseFragment(), WidgetCallback, NewBottomShe
|
||||
viewModel.updateApplicationType(
|
||||
arguments?.getString(ARG_APPLICATION_TYPE) ?: ApiConstants.FRESH_POLICY
|
||||
)
|
||||
viewModel.updateApplicationId(arguments?.getString(ARG_APPLICATION_ID))
|
||||
view = NaviErrorPageView(requireContext())
|
||||
val composeView =
|
||||
ComposeView(requireContext()).apply {
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.navi.insurance.pre.purchase.journey.PreQuoteMetaData
|
||||
import com.navi.insurance.pre.purchase.journey.PreQuotePatchData
|
||||
import com.navi.insurance.pre.purchase.journey.PreQuotePatchResponse
|
||||
import com.navi.insurance.util.APPLICATION_TYPE_EXTRA
|
||||
import com.navi.insurance.util.ARG_APPLICATION_ID
|
||||
import com.navi.insurance.util.Constants
|
||||
import com.navi.insurance.util.Constants.DELAY_1000
|
||||
import com.navi.insurance.util.PRE_QUOTE_ID_EXTRA
|
||||
@@ -97,6 +98,7 @@ constructor(
|
||||
private var currentPageMetaData: PreQuoteMetaData? = null
|
||||
private var preQuoteId: String? = null
|
||||
private var applicationType: String? = null
|
||||
private var applicationId: String? = null
|
||||
private var requestPageType: String? = null
|
||||
private var quoteId: String? = null
|
||||
private var transitionName: String? = null
|
||||
@@ -140,12 +142,18 @@ constructor(
|
||||
response =
|
||||
repository.fetchFormPageDataWithPreQuoteId(
|
||||
preQuoteId.orEmpty(),
|
||||
applicationType = applicationType.orEmpty()
|
||||
applicationType = applicationType.orEmpty(),
|
||||
applicationId = applicationId
|
||||
)
|
||||
} else {
|
||||
response = repository.fetchFormPageData(applicationType.orEmpty())
|
||||
response =
|
||||
repository.fetchFormPageData(applicationType.orEmpty(), applicationId)
|
||||
if (response.data.isNull()) {
|
||||
response = repository.postFormPageData(applicationType.orEmpty())
|
||||
response =
|
||||
repository.postFormPageData(
|
||||
applicationType.orEmpty(),
|
||||
FormWidgetRequest(applicationId)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,6 +171,7 @@ constructor(
|
||||
)
|
||||
currentPageMetaData = this.metaData
|
||||
updatePreQuoteId(this.metaData?.preQuoteId.orEmpty())
|
||||
updateApplicationId(this.metaData?.applicationId.orEmpty())
|
||||
}
|
||||
} else {
|
||||
_preQuoteJourneyFlow.value =
|
||||
@@ -189,7 +198,8 @@ constructor(
|
||||
response =
|
||||
repository.fetchFormPageDataWithQuoteId(
|
||||
quoteId.orEmpty(),
|
||||
requestPageType.orEmpty()
|
||||
requestPageType.orEmpty(),
|
||||
FormWidgetRequest(applicationId)
|
||||
)
|
||||
if (response?.data?.cta.isNotNull()) {
|
||||
val bundle = Bundle()
|
||||
@@ -198,6 +208,8 @@ constructor(
|
||||
ctaData.parameters?.forEach { lineItem ->
|
||||
if (lineItem.key == PRE_QUOTE_ID_EXTRA) {
|
||||
updatePreQuoteId(lineItem.value)
|
||||
} else if (lineItem.key == ARG_APPLICATION_ID) {
|
||||
updateApplicationId(lineItem.value)
|
||||
}
|
||||
}
|
||||
ctaData.parameters?.forEach { lineItem ->
|
||||
@@ -281,12 +293,17 @@ constructor(
|
||||
response =
|
||||
repository.fetchFormPageDataWithPreQuoteId(
|
||||
preQuoteId.orEmpty(),
|
||||
applicationType = applicationType.orEmpty()
|
||||
applicationType = applicationType.orEmpty(),
|
||||
applicationId = applicationId
|
||||
)
|
||||
} else {
|
||||
response = repository.fetchFormPageData(applicationType.orEmpty())
|
||||
response = repository.fetchFormPageData(applicationType.orEmpty(), applicationId)
|
||||
if (response.data.isNull()) {
|
||||
response = repository.postFormPageData(applicationType.orEmpty())
|
||||
response =
|
||||
repository.postFormPageData(
|
||||
applicationType.orEmpty(),
|
||||
FormWidgetRequest(applicationId)
|
||||
)
|
||||
}
|
||||
}
|
||||
if (
|
||||
@@ -303,6 +320,7 @@ constructor(
|
||||
hasErrorOccurred = false
|
||||
)
|
||||
currentPageMetaData = this.metaData
|
||||
updateApplicationId(this.metaData?.applicationId.orEmpty())
|
||||
updatePreQuoteId(this.metaData?.preQuoteId.orEmpty())
|
||||
}
|
||||
_showOverLay.value = false
|
||||
@@ -451,9 +469,14 @@ constructor(
|
||||
this.applicationType = applicationType
|
||||
}
|
||||
|
||||
fun updateApplicationId(applicationId: String?) {
|
||||
this.applicationId = applicationId
|
||||
}
|
||||
|
||||
fun updatePatchRequestData(patchRequestData: PreQuotePatchData?) {
|
||||
this.patchRequestData =
|
||||
FormWidgetRequest(
|
||||
applicationId = applicationId,
|
||||
pageType = currentPageMetaData?.pageType,
|
||||
metadata = currentPageMetaData,
|
||||
data = patchRequestData?.data
|
||||
|
||||
@@ -59,6 +59,7 @@ class PolicyAddonFragment : BaseFragment(), WidgetCallback, View.OnClickListener
|
||||
private val sharedViewModel by lazy {
|
||||
ViewModelProvider(requireActivity()).get(QuoteVM::class.java)
|
||||
}
|
||||
private var applicationId: String? = null
|
||||
private var listener: FragmentCallbackListener? = null
|
||||
private var ADD_ONS = "ADD_ONS"
|
||||
private val FIRST_ITEM = 0
|
||||
@@ -79,12 +80,26 @@ class PolicyAddonFragment : BaseFragment(), WidgetCallback, View.OnClickListener
|
||||
startShimmerLoading()
|
||||
initObservers()
|
||||
initListeners()
|
||||
getApplicationId()
|
||||
fetchAddons()
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
private val fetchAddons = { fetchAddonsData(AddonRequest()) }
|
||||
private fun getApplicationId() {
|
||||
applicationId = activity?.intent?.getStringExtra(ARG_APPLICATION_ID)
|
||||
if (applicationId.isNullOrEmpty()) {
|
||||
arguments?.getParcelable<CtaData>(Constants.PARAMS_EXTRA)?.let { ctaData ->
|
||||
ctaData.parameters?.forEach { lineItem ->
|
||||
when (lineItem.key) {
|
||||
ARG_APPLICATION_ID -> applicationId = lineItem.value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val fetchAddons = { fetchAddonsData(AddonRequest(applicationId = applicationId)) }
|
||||
|
||||
private fun fetchAddonsData(addonRequest: AddonRequest) {
|
||||
var quoteId: String? = activity?.intent?.getStringExtra(QUOTE_ID_EXTRA)
|
||||
@@ -93,6 +108,7 @@ class PolicyAddonFragment : BaseFragment(), WidgetCallback, View.OnClickListener
|
||||
ctaData.parameters?.forEach { lineItem ->
|
||||
when (lineItem.key) {
|
||||
QUOTE_ID_EXTRA -> quoteId = lineItem.value ?: ""
|
||||
ARG_APPLICATION_ID -> applicationId = lineItem.value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -245,7 +261,7 @@ class PolicyAddonFragment : BaseFragment(), WidgetCallback, View.OnClickListener
|
||||
if (!quoteId.isNullOrEmpty()) {
|
||||
sharedViewModel.fetchAddOnDetails(
|
||||
quoteId!!,
|
||||
AddonRequest(listOf(Addon(planId, isOpted))),
|
||||
AddonRequest(listOf(Addon(planId, isOpted)), applicationId = applicationId),
|
||||
activity?.intent?.extras?.getString(APPLICATION_TYPE_EXTRA)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -136,7 +136,10 @@ class PolicyBenefitsFragment : BaseFragment(), WidgetCallback, View.OnClickListe
|
||||
planId!!,
|
||||
tabId,
|
||||
activity?.intent?.extras?.getString(APPLICATION_TYPE_EXTRA)
|
||||
?: arguments?.getString(APPLICATION_TYPE_EXTRA)
|
||||
?: arguments?.getString(APPLICATION_TYPE_EXTRA),
|
||||
applicationId =
|
||||
activity?.intent?.extras?.getString(ARG_APPLICATION_ID)
|
||||
?: arguments?.getString(ARG_APPLICATION_ID)
|
||||
)
|
||||
} else if (!benefitsType.isNullOrEmpty()) {
|
||||
sharedViewModel.fetchBenefitsUsingType(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2019-2023 by Navi Technologies Limited
|
||||
* * Copyright © 2019-2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ const val ERROR_MESSAGE = "errorMessage"
|
||||
const val RESULT_USER_CANCELLED = "userCancelled"
|
||||
const val QUOTE_ID_EXTRA = "quoteId"
|
||||
const val ARG_PRE_QUOTE_ID = "preQuoteId"
|
||||
const val ARG_APPLICATION_ID = "applicationId"
|
||||
const val ARG_APPLICATION_TYPE = "applicationType"
|
||||
const val PAGE_TYPE = "pageType"
|
||||
const val POLICY_ID_EXTRA = "policyId"
|
||||
|
||||
@@ -14,6 +14,7 @@ function newAbortSignal(timeoutMs: number): AbortSignal {
|
||||
export const get = async <T>(
|
||||
url: string,
|
||||
config?: AxiosRequestConfig,
|
||||
params?: Record<string, any>,
|
||||
): Promise<T> => {
|
||||
try {
|
||||
let requestConfig: AxiosRequestConfig = config || {};
|
||||
@@ -30,6 +31,10 @@ export const get = async <T>(
|
||||
|
||||
addBundleVersionToHeader(axiosInstance);
|
||||
|
||||
if (params) {
|
||||
requestConfig.params = params;
|
||||
}
|
||||
|
||||
const response = await axiosInstance.get<T>(baseUrl + url, requestConfig);
|
||||
return handleSuccess<T>(response);
|
||||
} catch (error) {
|
||||
|
||||
@@ -9,6 +9,7 @@ interface QuoteOfferRequest {
|
||||
preQuoteId?: string | null;
|
||||
policyToBeCopied?: string;
|
||||
applicationType?: string;
|
||||
applicationId?: string | null;
|
||||
}
|
||||
|
||||
interface Term {
|
||||
|
||||
Reference in New Issue
Block a user