From 5cdca88b29ecfe89940e8a7973235f2d99a01098 Mon Sep 17 00:00:00 2001 From: Podili Varshitha Date: Wed, 28 Aug 2024 16:55:51 +0530 Subject: [PATCH] TP-77512| digitalCommunitaion api migration (#1077) * TP-77512|api changes|varshitha * TP-77512|list to string|varshitha * TP-77512|name changes|varshitha * TP-77512|customer refId|varshitha * TP-77512|fix|varshitha --- .../CommunicationHistory/SystemInteractions.tsx | 17 +++++++++++++++-- .../CaseDetails/interfaces/CaseDetail.type.ts | 2 ++ src/utils/ApiHelper.ts | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/pages/CaseDetails/components/CommunicationHistory/SystemInteractions.tsx b/src/pages/CaseDetails/components/CommunicationHistory/SystemInteractions.tsx index 8afeb1d5..64c5899a 100644 --- a/src/pages/CaseDetails/components/CommunicationHistory/SystemInteractions.tsx +++ b/src/pages/CaseDetails/components/CommunicationHistory/SystemInteractions.tsx @@ -90,8 +90,7 @@ const SystemInteractions = (props: ISystemInteractionsProps) => { return { page_no: queryParams?.page || 0, page_size: queryParams?.size || defaultPageSize, - customer_reachable: queryParams?.contactable, - from: defaultPreviousLoanInteractionsFromDate + customer_reachable: queryParams?.contactable }; }; @@ -128,6 +127,7 @@ const SystemInteractions = (props: ISystemInteractionsProps) => { }; const createPayloadForSystemInteraction = () => { + const PrevCaseRefIds = pageData?.details?.data?.closedLoanAccountViews; if (isTypeFieldVisit && isPreviousLoanInteraction) { return createCommonPayload(previousLoanAccountParams?.previousLoanAccount); } else if (isTypeFieldVisit) { @@ -136,9 +136,22 @@ const SystemInteractions = (props: ISystemInteractionsProps) => { from: queryParams?.[FROM_TIME] || defaultLastMonthDate, to: queryParams?.[TO_TIME] || maxInputDate }; + } else if (isPreviousLoanInteraction) { + return { + ...defaultPayload(), + status: 'CLOSED', + case_reference_ids: + PrevCaseRefIds?.find( + item => item.accountNumber == previousLoanAccountParams?.previousLoanAccount + )?.caseReferenceId || '', + communication_type: type, + customer_reference_id: customerId + }; } return { ...defaultPayload(), + status: 'ACTIVE', + case_reference_ids: pageData?.details?.data?.caseReferenceId, communication_type: type, customer_reference_id: customerId }; diff --git a/src/pages/CaseDetails/interfaces/CaseDetail.type.ts b/src/pages/CaseDetails/interfaces/CaseDetail.type.ts index 8070194b..09953733 100644 --- a/src/pages/CaseDetails/interfaces/CaseDetail.type.ts +++ b/src/pages/CaseDetails/interfaces/CaseDetail.type.ts @@ -199,6 +199,7 @@ export interface MonthlyIncome { } export interface CustomerDetailApiResponse { + caseReferenceId: string; customerName: string; customerReferenceId: string; addresses: IAddress[]; @@ -486,6 +487,7 @@ export interface IRepaymentHistoryAPIResponse extends IApiData { } export interface IPreviousLoanAccount { + caseReferenceId: string; startDate: string; accountNumber: string; } diff --git a/src/utils/ApiHelper.ts b/src/utils/ApiHelper.ts index f039b4d8..b1f9114e 100644 --- a/src/utils/ApiHelper.ts +++ b/src/utils/ApiHelper.ts @@ -305,7 +305,7 @@ API_URLS[ApiKeys.GENERATE_PAYMENT_LINK] = '/payments/generate-payment-link'; API_URLS[ApiKeys.FETCH_SLASH_CRM_ID] = '/users/encryptedSlashCrmId'; API_URLS[ApiKeys.MONTHLTY_ENACH_REQUEST] = 'v2/monthly-enach-request'; API_URLS[ApiKeys.WA_INTERACTIONS] = '/agent-interactions/fetch/whatsapp'; -API_URLS[ApiKeys.DIGITAL_COMMUNICATION] = '/digital-communication'; +API_URLS[ApiKeys.DIGITAL_COMMUNICATION] = '/v1/digital-communication'; API_URLS[ApiKeys.GET_LEADERBOARD_DETAILS] = '/levels/agents/{agentReferenceId}/ranking'; API_URLS[ApiKeys.GET_FORECLOSURE_AMOUNT] = '/payments/{lan}/pre-closure-amount'; API_URLS[ApiKeys.FETCH_CUSTOMER_INFO] = '/customers/v1/{customerRefId}';