NTP-19163 API changes (#1031)

This commit is contained in:
Shri Prakash Bajpai
2024-12-17 15:31:29 +05:30
committed by GitHub
parent eb78cd6b20
commit aca9c7762b
17 changed files with 94 additions and 38 deletions

View File

@@ -63,13 +63,16 @@ export const addAddress =
};
export const getUngroupedAddress =
(loanAccountNumber: string, includeFeedbacks = false) =>
(loanAccountNumber: string, caseReferenceId: string, caseBusinessVertical: string, includeFeedbacks = false) =>
(dispatch: AppDispatch) => {
dispatch(setUngroupedAddressesLoading({ loanAccountNumber, isLoading: true }));
const url = getApiUrl(
ApiKeys.GET_UNGROUPED_ADDRESSES,
{ loanAccountNumber },
{ includeFeedbacks }
{ },
{ includeFeedbacks,
caseReferenceId: caseReferenceId,
caseBusinessVertical: caseBusinessVertical
}
);
axiosInstance
.get(url)

View File

@@ -53,8 +53,9 @@ export const makeACallToCustomer =
} else {
dispatch(
fetchTelephoneNumber({
loanAccountNumber: payload?.loanAccountNumber,
caseId: details?.caseId,
caseBusinessVertical: details?.caseBusinessVertical,
loanAccountNumber: payload?.loanAccountNumber
})
);
}

View File

@@ -11,9 +11,13 @@ import { addClickstreamEvent } from '@services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '@common/Constants';
import { PAST_FEEDBACK_PAGE_SIZE } from '@screens/caseDetails/feedback/pastFeedbackCommon';
export const getRepaymentsData = (loanAccountNumber: string) => (dispatch: AppDispatch) => {
export const getRepaymentsData = (loanAccountNumber: string, caseId: string, caseBusinessVertical: string) => (dispatch: AppDispatch) => {
dispatch(setRepaymentsLoading({ loanAccountNumber, isLoading: true }));
const url = getApiUrl(ApiKeys.GET_REPAYMENTS, { loanAccountNumber });
const url = getApiUrl(ApiKeys.GET_REPAYMENTS, {},
{
caseReferenceId: caseId,
caseBusinessVertical: caseBusinessVertical
});
axiosInstance
.get(url)
.then((res) => {
@@ -27,9 +31,13 @@ export const getRepaymentsData = (loanAccountNumber: string) => (dispatch: AppDi
});
};
export const getEmiScheduleData = (loanAccountNumber: string) => (dispatch: AppDispatch) => {
export const getEmiScheduleData = (loanAccountNumber: string, caseId: string, caseBusinessVertical: string) => (dispatch: AppDispatch) => {
dispatch(setEmiScheduleLoading({ loanAccountNumber, isLoading: true }));
const url = getApiUrl(ApiKeys.GET_EMI_SCHEDULE, { loanAccountNumber });
const url = getApiUrl(ApiKeys.GET_EMI_SCHEDULE, {},
{
caseReferenceId: caseId,
caseBusinessVertical: caseBusinessVertical
});
axiosInstance
.get(url)
.then((res) => {
@@ -44,13 +52,16 @@ export const getEmiScheduleData = (loanAccountNumber: string) => (dispatch: AppD
};
export const getAddressesAndGeolocations =
(loanAccountNumber: string, includeFeedbacks: boolean = false) =>
(loanAccountNumber: string, caseReferenceId: string, caseBusinessVertical: string, includeFeedbacks: boolean = false) =>
(dispatch: AppDispatch) => {
dispatch(setAddressLoading({ loanAccountNumber, isLoading: true }));
const url = getApiUrl(
ApiKeys.GET_GROUPED_ADDRESSES_AND_GEOLOCATIONS,
{ loanAccountNumber },
{ includeFeedbacks }
{ },
{ includeFeedbacks,
caseReferenceId: caseReferenceId,
caseBusinessVertical: caseBusinessVertical,
}
);
axiosInstance
.get(url)

View File

@@ -9,15 +9,26 @@ import {
import { isFunction } from '@components/utlis/commonFunctions';
type FetchTelephoneNumbersParams = {
caseId: string;
caseBusinessVertical: string;
loanAccountNumber: string;
setLoading?: (value: boolean) => void;
};
type FetchCallHistoryParams = {
caseId: string;
loanAccountNumber: string;
setLoading?: (value: boolean) => void;
};
export const fetchTelephoneNumber =
({ caseId, loanAccountNumber, setLoading }: FetchTelephoneNumbersParams) =>
({ caseId, caseBusinessVertical, loanAccountNumber, setLoading }: FetchTelephoneNumbersParams) =>
(dispatch: AppDispatch) => {
const url = getApiUrl(ApiKeys.GET_TELEPHONE_NUMBERS_V2, { loanAccountNumber });
const url = getApiUrl(ApiKeys.GET_TELEPHONE_NUMBERS_V2, { },
{
caseReferenceId: caseId,
caseBusinessVertical: caseBusinessVertical
});
const isSetLoadingFunction = isFunction(setLoading);
if (isSetLoadingFunction) setLoading(true);
axiosInstance
@@ -34,7 +45,7 @@ export const fetchTelephoneNumber =
};
export const fetchCallHistory =
({ caseId, loanAccountNumber, setLoading }: FetchTelephoneNumbersParams) =>
({ caseId, loanAccountNumber, setLoading }: FetchCallHistoryParams) =>
(dispatch: AppDispatch) => {
const caseDetail = store?.getState()?.allCases?.caseDetails?.[caseId] || {};
const url = getApiUrl(

View File

@@ -59,6 +59,9 @@ const AddressSelection: React.FC<IAddressSelection> = (props) => {
const ungroupedAddresses = useAppSelector(
(state: RootState) => state.ungroupedAddresses[loanAccountNumber]?.ungroupedAddresses || []
);
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const groupedAndUngroupedAddresses = useMemo(() => {
let addressesList = [];
@@ -103,7 +106,7 @@ const AddressSelection: React.FC<IAddressSelection> = (props) => {
const controllerName = `widgetContext.${widgetId}.sectionContext.${sectionId}.questionContext.${questionId}`;
const reloadGeolocations = () => {
dispatch(getAddressesAndGeolocations(loanAccountNumber));
dispatch(getAddressesAndGeolocations(loanAccountNumber, caseId, caseBusinessVertical));
};
if (isGeolocation) {

View File

@@ -165,7 +165,7 @@ API_URLS[ApiKeys.GET_CASH_COLLECTED] = '/allocation-cycle/cash-collected-split';
API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS] =
'/v2/collection-cases/telephones-view/{loanAccountNumber}';
API_URLS[ApiKeys.GET_TELEPHONE_NUMBERS_V2] =
'/collections/{loanAccountNumber}/telephones-agent-call-activity-view';
'/collections/telephones-agent-call-activity-view';
API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO] = '/cases/sync-status';
API_URLS[ApiKeys.FIRESTORE_INCONSISTENCY_INFO_V2] = '/cases/v2/sync-status';
API_URLS[ApiKeys.GET_CASE_DETAILS_FROM_API] =
@@ -209,11 +209,11 @@ API_URLS[ApiKeys.GENERATE_DYNAMIC_DOCUMENT] = '/documents/generate/{loanAccountN
API_URLS[ApiKeys.ALL_ESCALATIONS] = '/customer-escalation';
API_URLS[ApiKeys.DOWNLOAD_LATEST_APP] = 'https://longhorn.navi.com/api/app/download';
API_URLS[ApiKeys.GET_UNGROUPED_ADDRESSES] =
'/collection-cases/{loanAccountNumber}/ungrouped/addresses';
'/collection-cases/ungrouped/addresses';
API_URLS[ApiKeys.GET_GROUPED_ADDRESSES_AND_GEOLOCATIONS] =
'/collection-cases/{loanAccountNumber}/grouped/addresses-geo-locations';
API_URLS[ApiKeys.GET_EMI_SCHEDULE] = '/collection-cases/{loanAccountNumber}/emiSchedule';
API_URLS[ApiKeys.GET_REPAYMENTS] = '/collection-cases/{loanAccountNumber}/repayments';
'/collection-cases/grouped/addresses-geo-locations';
API_URLS[ApiKeys.GET_EMI_SCHEDULE] = '/collection-cases/emiSchedule';
API_URLS[ApiKeys.GET_REPAYMENTS] = '/collection-cases/repayments';
API_URLS[ApiKeys.GET_FEEDBACK_HISTORY] = '/feedback/filters';
API_URLS[ApiKeys.GET_PRIORTIY_FEEDBACK] = 'feedback/case-status';

View File

@@ -8,16 +8,17 @@ const useMobileNumbers = (caseId: string) => {
);
const mobileNumbers =
useAppSelector((state) => state?.telephoneNumbers?.telephoneNumbers?.[caseId]) || [];
const caseBusinessVertical = useAppSelector((state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical);
const [loading, setLoading] = useState(false);
const dispatch = useAppDispatch();
useEffect(() => {
if (!caseId || !loanAccountNumber) return;
dispatch(fetchTelephoneNumber({ loanAccountNumber, caseId, setLoading }));
dispatch(fetchTelephoneNumber({ caseId, caseBusinessVertical, loanAccountNumber, setLoading}));
}, []);
const refetchMobileNumbers = (setRefreshing?: (val: boolean) => void) => {
dispatch(fetchTelephoneNumber({ loanAccountNumber, caseId, setLoading: setRefreshing }));
dispatch(fetchTelephoneNumber({ caseId, caseBusinessVertical, loanAccountNumber, setLoading: setRefreshing }));
};
return { loading, mobileNumbers, refetchMobileNumbers };

View File

@@ -38,6 +38,9 @@ const AddNewNumber: React.FC<IAddNewNumber> = (props) => {
const { customerReferenceId, loanAccountNumber } = useAppSelector(
(state) => state.allCases.caseDetails[caseId] || {}
);
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const dispatch = useAppDispatch();
const {
control,
@@ -77,7 +80,7 @@ const AddNewNumber: React.FC<IAddNewNumber> = (props) => {
() => {
setLoading(false);
},
() => dispatch(fetchTelephoneNumber({ loanAccountNumber, caseId }))
() => dispatch(fetchTelephoneNumber({ caseId, caseBusinessVertical, loanAccountNumber }))
);
};

View File

@@ -53,6 +53,9 @@ const UngroupedAddressContainer: React.FC<IUngroupedAddress> = ({ route: routePa
const { isLoading = false } =
useAppSelector((state) => state.ungroupedAddresses?.[loanAccountNumber]) || {};
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const { additionalAddresses = [], additionalAddressFeedbackList = [] } =
useAddresses(loanAccountNumber);
const dispatch = useAppDispatch();
@@ -61,7 +64,7 @@ const UngroupedAddressContainer: React.FC<IUngroupedAddress> = ({ route: routePa
const fetchUngroupedAddress = () => {
// fetch ungrouped address
dispatch(getUngroupedAddress(loanAccountNumber, true));
dispatch(getUngroupedAddress(loanAccountNumber, caseId, caseBusinessVertical, true));
};
if (!isOnline) {

View File

@@ -45,6 +45,9 @@ const AddressGeolocation: React.FC<IAddressGeolocation> = ({ route: routeParams
addressGeolocation: state.address?.[loanAccountNumber]?.addressesAndGeoLocations || {},
isLoading: state.address?.[loanAccountNumber]?.isLoading || false,
}));
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const [selectedTab, setSelectedTab] = useState<string>(AddressGeolocationTabEnum.ADDRESS);
const [retryBtnToggle, setRetryBtnToggle] = useState(false);
const dispatch = useAppDispatch();
@@ -71,7 +74,7 @@ const AddressGeolocation: React.FC<IAddressGeolocation> = ({ route: routeParams
};
const getGroupedAddresses = () => {
dispatch(getAddressesAndGeolocations(loanAccountNumber, true));
dispatch(getAddressesAndGeolocations(loanAccountNumber, caseId, caseBusinessVertical, true));
dispatch(sendCurrentGeolocationAndBuffer(AppState.currentState));
};
@@ -83,7 +86,7 @@ const AddressGeolocation: React.FC<IAddressGeolocation> = ({ route: routeParams
useEffect(() => {
addClickstreamEvent(CLICKSTREAM_EVENT_NAMES.FA_ALL_ADDRESSES_LANDED, commonParams);
dispatch(getUngroupedAddress(loanAccountNumber, true));
dispatch(getUngroupedAddress(loanAccountNumber, caseId, caseBusinessVertical, true));
}, []);
useEffect(() => {

View File

@@ -43,6 +43,9 @@ const CollectionCaseDetails: React.FC<ICaseDetails> = (props) => {
const isCallActive = useAppSelector(
(state: RootState) => state?.activeCall?.activeCallDetails?.callActive
);
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const { loanAccountNumber } = caseDetail;
const opacityAnimation = useRef(new Animated.Value(0.8)).current;
@@ -68,8 +71,8 @@ const CollectionCaseDetails: React.FC<ICaseDetails> = (props) => {
useFocusEffect(
React.useCallback(() => {
if (loanAccountNumber) {
dispatch(getAddressesAndGeolocations(loanAccountNumber));
dispatch(getUngroupedAddress(loanAccountNumber));
dispatch(getAddressesAndGeolocations(loanAccountNumber, caseId, caseBusinessVertical));
dispatch(getUngroupedAddress(loanAccountNumber, caseId, caseBusinessVertical));
dispatch(getFeedbackHistory(loanAccountNumber));
}
}, [loanAccountNumber])

View File

@@ -20,7 +20,7 @@ import { addClickstreamEvent } from '@services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '@common/Constants';
const EmiScheduleTab: React.FC<IEmiScheduleTab> = (props) => {
const { loanAccountNumber, tabId } = props;
const { loanAccountNumber, tabId, caseReferenceId } = props;
const [selectedTab, setSelectedTab] = useState<EmiSelectedTab>(tabId || EmiSelectedTab.UNPAID);
const [openBottomSheet, setOpenBottomSheet] = React.useState(false);
const [emiBreakupItem, setEmiBreakupItem] = React.useState<IEmiItem | null>(null);
@@ -55,6 +55,7 @@ const EmiScheduleTab: React.FC<IEmiScheduleTab> = (props) => {
return;
}
navigateToScreen(CaseDetailStackEnum.FEE_WAIVER, {
caseReferenceId,
emiItem,
loanAccountNumber,
});
@@ -132,6 +133,7 @@ const EmiScheduleTab: React.FC<IEmiScheduleTab> = (props) => {
closeBottomSheet={closeWaiveBottomSheet}
waivableFeeDue={waivableFeeDue}
loanAccountNumber={loanAccountNumber}
caseReferenceId={caseReferenceId}
/>
)}
</SuspenseLoader>

View File

@@ -18,7 +18,7 @@ import PartialPaidFeeAdjusmentModal from './PartialPaidFeeAdjusmentModal';
import { addClickstreamEvent } from '@services/clickstreamEventService';
import { CLICKSTREAM_EVENT_NAMES } from '@common/Constants';
import { postFeeWaiver } from '@actions/emiActions';
import { useAppDispatch } from '@hooks';
import { useAppDispatch, useAppSelector } from '@hooks';
import { getEmiScheduleData } from '@actions/caseApiActions';
import FullScreenLoader from '@rn-ui-lib/components/FullScreenLoader';
import { feeWaiveTransformedEmiData, getFeeWaiveBtnLabel } from './utils';
@@ -29,12 +29,13 @@ interface IFeeWaiver {
params: {
emiItem: IEmiItem;
loanAccountNumber: string;
caseReferenceId: string;
};
};
}
const FeeWaiver: React.FC<IFeeWaiver> = (props) => {
const { emiItem, loanAccountNumber } = props.route.params || {};
const { emiItem, loanAccountNumber, caseReferenceId } = props.route.params || {};
const [emiData, setEmiData] = React.useState<IEmiItem>(emiItem);
const [isSubmitting, setIsSubmitting] = React.useState(false);
const {
@@ -52,6 +53,7 @@ const FeeWaiver: React.FC<IFeeWaiver> = (props) => {
const canShowAdjustmentModal =
action === EmiFeeActions.ADJUST && Number(waivedValue) > totalDueAmountUnpaid;
const buttonTitle = getFeeWaiveBtnLabel(action, Number(waivedValue), totalDueAmountUnpaid);
const caseBusinessVertical = useAppSelector((state) => state?.allCases?.caseDetails?.[caseReferenceId]?.businessVertical);
const dispatch = useAppDispatch();
@@ -77,7 +79,7 @@ const FeeWaiver: React.FC<IFeeWaiver> = (props) => {
Number(waivedValue) >= totalDueAmountUnpaid ? 'waived' : 'held'
} for EMI ${emiNumber}`,
});
dispatch(getEmiScheduleData(loanAccountNumber));
dispatch(getEmiScheduleData(loanAccountNumber, caseReferenceId, caseBusinessVertical));
setIsSubmitting(false);
} catch (err) {
toast({ type: 'error', text1: err as string });

View File

@@ -17,7 +17,7 @@ import InfoOutlineIcon from '@rn-ui-lib/icons/InfoOutlineIcon';
import { EmiFeeActionLabelMap } from './constants';
const WaiveFeePreviousEmiBottomSheet: React.FC<IWaiveFeePreviousEmiBottomSheet> = (props) => {
const { openBottomSheet, emiData, waivableFeeDue, loanAccountNumber, closeBottomSheet } = props;
const { openBottomSheet, emiData, waivableFeeDue, loanAccountNumber, closeBottomSheet, caseReferenceId } = props;
const {
emiNumber: waivableEmiNumber,
dueDate: waivableEmiDueDate,
@@ -35,7 +35,7 @@ const WaiveFeePreviousEmiBottomSheet: React.FC<IWaiveFeePreviousEmiBottomSheet>
const handleWaivableEmiNavigator = () => {
// Navigate to waivable EMI
navigateToScreen(CaseDetailStackEnum.FEE_WAIVER, { emiItem: waivableFeeDue, loanAccountNumber });
navigateToScreen(CaseDetailStackEnum.FEE_WAIVER, { emiItem: waivableFeeDue, loanAccountNumber, caseReferenceId });
};
const height = getDynamicBottomSheetHeightPercentageFn();

View File

@@ -47,6 +47,9 @@ const EmiSchedule: React.FC<IEmiSchedule> = (props) => {
emiData: state.emiSchedule?.[loanAccountNumber]?.data,
};
});
const caseBusinessVertical = useAppSelector(
(state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical
);
const dispatch = useAppDispatch();
const isOnline = useIsOnline();
@@ -69,8 +72,8 @@ const EmiSchedule: React.FC<IEmiSchedule> = (props) => {
const { refreshing, onRefresh } = useRefresh(() => {
if (isOnline) {
dispatch(getRepaymentsData(loanAccountNumber));
dispatch(getEmiScheduleData(loanAccountNumber));
dispatch(getRepaymentsData(loanAccountNumber, caseId, caseBusinessVertical));
dispatch(getEmiScheduleData(loanAccountNumber, caseId, caseBusinessVertical));
} else {
toast({
type: 'info',
@@ -128,7 +131,11 @@ const EmiSchedule: React.FC<IEmiSchedule> = (props) => {
</View>
<View style={[GenericStyles.fill, GenericStyles.pt24]}>
{currentTab === TABS[0].key ? (
<EmiScheduleTab loanAccountNumber={loanAccountNumber} tabId={scheduleTabId} />
<EmiScheduleTab
loanAccountNumber={loanAccountNumber}
tabId={scheduleTabId}
caseReferenceId={caseId}
/>
) : (
<RepaymentsTab loanAccountNumber={loanAccountNumber} />
)}

View File

@@ -14,6 +14,7 @@ export enum EmiSelectedTab {
export interface IEmiScheduleTab {
loanAccountNumber: string;
tabId?: EmiSelectedTab;
caseReferenceId: string;
}
export interface IEmiScheduleItem {
@@ -111,6 +112,7 @@ export interface IWaiveFeePreviousEmiBottomSheet {
waivableFeeDue?: IEmiItem | null;
loanAccountNumber: string;
closeBottomSheet: () => void;
caseReferenceId: string;
}
export interface FeeWaiverHistoryProps {

View File

@@ -22,6 +22,7 @@ const CallInfo = () => {
);
const caseId = useAppSelector((state: RootState) => state?.activeCall?.activeCallDetails?.caseId);
const caseDetail = useAppSelector((state: RootState) => state.allCases.caseDetails[caseId]) || {};
const caseBusinessVertical = useAppSelector((state) => state?.allCases?.caseDetails?.[caseId]?.businessVertical);
const dispatch = useAppDispatch();
@@ -35,7 +36,7 @@ const CallInfo = () => {
caseId &&
getCurrentScreen()?.name === CaseDetailStackEnum.CALL_CUSTOMER
) {
dispatch(fetchTelephoneNumber({ loanAccountNumber, caseId }));
dispatch(fetchTelephoneNumber({ caseId, caseBusinessVertical, loanAccountNumber }));
dispatch(
fetchCallHistory({
loanAccountNumber,