From 71d751cb7734a09dcb2cebbd2228d9f37c335f27 Mon Sep 17 00:00:00 2001 From: Herik Hiteshkumar Modi Date: Fri, 7 Apr 2023 21:33:20 +0530 Subject: [PATCH] TP-24515| Mocked responses (#157) Co-authored-by: Herik Modi --- __mocks__/addresses.json | 0 __mocks__/allocated-cases/v1.json | 410 ++++++++++++++++++ __mocks__/auth/user.json | 14 + __mocks__/details.json | 225 ++++++++++ __mocks__/levels/agents/CASE_ID/ranking.json | 9 + __mocks__/otps/send.json | 1 + __mocks__/otps/verify-v2.json | 1 + __mocks__/telephones.json | 13 + .../v2/interactions/feedback-history.json | 28 ++ __mocks__/v2/interactions/question-tree.json | 85 ++++ __mocks__/version.json | 1 + src/utils/ApiHelper.ts | 26 +- 12 files changed, 802 insertions(+), 11 deletions(-) create mode 100644 __mocks__/addresses.json create mode 100644 __mocks__/allocated-cases/v1.json create mode 100644 __mocks__/auth/user.json create mode 100644 __mocks__/details.json create mode 100644 __mocks__/levels/agents/CASE_ID/ranking.json create mode 100644 __mocks__/otps/send.json create mode 100644 __mocks__/otps/verify-v2.json create mode 100644 __mocks__/telephones.json create mode 100644 __mocks__/v2/interactions/feedback-history.json create mode 100644 __mocks__/v2/interactions/question-tree.json create mode 100644 __mocks__/version.json diff --git a/__mocks__/addresses.json b/__mocks__/addresses.json new file mode 100644 index 00000000..e69de29b diff --git a/__mocks__/allocated-cases/v1.json b/__mocks__/allocated-cases/v1.json new file mode 100644 index 00000000..a59eabbf --- /dev/null +++ b/__mocks__/allocated-cases/v1.json @@ -0,0 +1,410 @@ +{ + "caseSummaryPaginatedResponse": { + "data": [ + { + "customerId": "c786a9ec-02f7-4e86-ad10-1249a89b4418", + "customerName": "Akshay Kumar", + "phoneNumber": "6666625786", + "accountNumber": "111190259528", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 59845.62, + "currentDPD": 32, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "UNPAID", + "lastPaidDate": "2023-04-06", + "lastPaidEmiAmount": 6136.0, + "paymentStatus": "UNPAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-04-06", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 6, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-21T23:59:00", + "alertType": null, + "collectionCaseId": 260922, + "assignedAt": "2023-04-06T16:58:23.775", + "requestedCallback": null + }, + { + "customerId": "f09407ff-185d-4e28-b62c-c6eb5b0d4435", + "customerName": "Akshay Kumar", + "phoneNumber": "6666618321", + "accountNumber": "111937318029", + "feedbackType": "REQUESTED_CALLBACK", + "feedbackDate": "2023-04-03", + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 0.0, + "currentDPD": 0, + "dpdBucket": "1-15", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "PAID", + "lastPaidDate": null, + "lastPaidEmiAmount": null, + "paymentStatus": "PAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-03-20", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 20, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-18T23:59:00", + "alertType": null, + "collectionCaseId": 250399, + "assignedAt": "2023-04-03T15:17:30.257", + "requestedCallback": null + }, + { + "customerId": "b88f1dd7-23f5-4eeb-8519-15af12769a9b", + "customerName": "Akshay Kumar", + "phoneNumber": "6666612342", + "accountNumber": "112160144436", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 45688.0, + "currentDPD": 32, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "UNPAID", + "lastPaidDate": "2023-04-06", + "lastPaidEmiAmount": 6136.0, + "paymentStatus": "UNPAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-04-06", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 6, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-21T23:59:00", + "alertType": null, + "collectionCaseId": 261044, + "assignedAt": "2023-04-06T17:49:03.542", + "requestedCallback": null + }, + { + "customerId": "a921cabd-723b-4c8a-abee-c1e5218d8c23", + "customerName": "Akshay Kumar", + "phoneNumber": "6666629456", + "accountNumber": "112237890870", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 23339.01, + "currentDPD": 32, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "UNPAID", + "lastPaidDate": "2023-04-06", + "lastPaidEmiAmount": 3250.0, + "paymentStatus": "UNPAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-04-06", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 6, + "totalPaidAmount": 3250.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-21T23:59:00", + "alertType": null, + "collectionCaseId": 260583, + "assignedAt": "2023-04-06T12:02:59.836", + "requestedCallback": null + }, + { + "customerId": "52c05529-6d5f-4c52-9fcd-7b24fe597e90", + "customerName": "Akshay Kumar", + "phoneNumber": "6666668117", + "accountNumber": "112421074599", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 94384.0, + "currentDPD": 48, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "UNPAID", + "lastPaidDate": "2023-05-11", + "lastPaidEmiAmount": 100.0, + "paymentStatus": "UNPAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-03-20", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 20, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-18T23:59:00", + "alertType": null, + "collectionCaseId": 250402, + "assignedAt": "2023-04-03T15:17:30.246", + "requestedCallback": null + }, + { + "customerId": "2fd5d94b-eec9-4609-8705-9e4f2c648880", + "customerName": "Akshay Kumar", + "phoneNumber": "6666618320", + "accountNumber": "113152853110", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 0.0, + "currentDPD": 0, + "dpdBucket": "1-15", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "PAID", + "lastPaidDate": "2023-03-25", + "lastPaidEmiAmount": 5000.0, + "paymentStatus": "PAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-03-20", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 20, + "totalPaidAmount": 6136.0, + "posAmount": 124400.0, + "posPercent": 4.15, + "agentAllocationExpiry": "2023-04-18T23:59:00", + "alertType": null, + "collectionCaseId": 250394, + "assignedAt": "2023-04-03T15:17:30.227", + "requestedCallback": null + }, + { + "customerId": "bf9d27e7-e879-4a32-9e95-38e74ef94f34", + "customerName": "Akshay Kumar", + "phoneNumber": "6666678901", + "accountNumber": "113583085310", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 0.0, + "currentDPD": 0, + "dpdBucket": "1-15", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "PAID", + "lastPaidDate": null, + "lastPaidEmiAmount": null, + "paymentStatus": "PAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-03-22", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 22, + "totalPaidAmount": 3250.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-18T23:59:00", + "alertType": null, + "collectionCaseId": 255046, + "assignedAt": "2023-04-03T15:17:30.175", + "requestedCallback": null + }, + { + "customerId": "e0c63ff9-e614-4c0f-9f6c-ac41e4c1eaa5", + "customerName": "Akshay Kumar", + "phoneNumber": "6666611314", + "accountNumber": "114378413126", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 0.0, + "currentDPD": 32, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "PAID", + "lastPaidDate": null, + "lastPaidEmiAmount": null, + "paymentStatus": "PAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-04-06", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 6, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-21T23:59:00", + "alertType": null, + "collectionCaseId": 260817, + "assignedAt": "2023-04-06T16:20:38.191", + "requestedCallback": null + }, + { + "customerId": "98a4a5ea-eeb5-4b63-94d6-19163a0d7bc5", + "customerName": "Akshay Kumar", + "phoneNumber": "6666689622", + "accountNumber": "114653063942", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 0.0, + "currentDPD": 0, + "dpdBucket": "1-15", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "PAID", + "lastPaidDate": "2023-03-25", + "lastPaidEmiAmount": 45688.0, + "paymentStatus": "PAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-03-20", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 20, + "totalPaidAmount": 6136.0, + "posAmount": 130000.0, + "posPercent": 4.34, + "agentAllocationExpiry": "2023-04-18T23:59:00", + "alertType": null, + "collectionCaseId": 250400, + "assignedAt": "2023-04-03T15:17:30.249", + "requestedCallback": null + }, + { + "customerId": "b0ac87cb-729f-4953-98db-b18160183b0b", + "customerName": "Akshay Kumar", + "phoneNumber": "6666656789", + "accountNumber": "115166099745", + "feedbackType": "NOT_CONTACTED", + "feedbackDate": null, + "pinCode": "560034", + "city": "Bangalore", + "state": "Karnataka", + "outStandingAmount": 56988.0, + "currentDPD": 33, + "dpdBucket": "31-60", + "agencyName": "AllocationDeallocation", + "agentName": "abcd", + "agentPhoneNumber": "8632426173", + "agentType": "CALLING", + "lastMonthEmiStatus": "UNPAID", + "lastPaidDate": "2023-06-17", + "lastPaidEmiAmount": 50188.0, + "paymentStatus": "UNPAID", + "customerRiskTag": null, + "promiseAmount": null, + "ptpDate": null, + "loanStartDate": "2023-04-05", + "loanAmount": 130000.0, + "totalEmis": 0, + "totalPaidEmis": 0, + "cycleDate": 5, + "totalPaidAmount": 6136.0, + "posAmount": 87090.08, + "posPercent": 2.91, + "agentAllocationExpiry": "2023-04-21T23:59:00", + "alertType": null, + "collectionCaseId": 260472, + "assignedAt": "2023-04-06T14:08:27.944", + "requestedCallback": null + } + ], + "errors": null, + "pages": { + "pageNo": 0, + "totalPages": 3, + "pageSize": 10, + "totalElements": 26 + } + }, + "aggregation": { + "dpdBuckets": [ + "0-9", + "10-19", + "20-29", + "30-39", + "40-49" + ] + }, + "featuresInfo": [ + { + "featureName": "AUTO_SORTING", + "metadata": { + "enabled": false + } + } + ] +} \ No newline at end of file diff --git a/__mocks__/auth/user.json b/__mocks__/auth/user.json new file mode 100644 index 00000000..ab4ad86a --- /dev/null +++ b/__mocks__/auth/user.json @@ -0,0 +1,14 @@ +{ + "referenceId": "654615f9-8f88-46de-a1d8-707e87e82a2e", + "phoneNumber": "8632426173", + "name": "abcd", + "agencyCode": "TL369", + "agencyName": "AllocationDeallocation", + "active": true, + "roles": [ + "ROLE_CALLING_AGENT" + ], + "naviUser": false, + "agenciesReporting": [], + "email": "abcd@navi.com" +} \ No newline at end of file diff --git a/__mocks__/details.json b/__mocks__/details.json new file mode 100644 index 00000000..421d2e0b --- /dev/null +++ b/__mocks__/details.json @@ -0,0 +1,225 @@ +{ + "customerName": "Akshay Kumar", + "customerReferenceId": "c786a9ec-02f7-4e86-ad10-1249a89b4418", + "emails": [ + { + "emailAddress": "johndb@navi.com", + "source": null, + "collectionCaseId": 260922 + }, + { + "emailAddress": null, + "source": null, + "collectionCaseId": 260922 + } + ], + "addresses": [ + { + "referenceId": "ab5097fc-9fbc-4f0a-934a-cfeb69f43606", + "addressReferenceId": "4d09fbf5-a45e-4aae-ac30-656cc57259dc", + "lineOne": "A-314 Block-A, Salarpuria Business Centre", + "lineTwo": "Koramangala", + "city": "Bangalore", + "state": "Karnataka", + "pinCode": "560034", + "current": true, + "permanent": false, + "type": "CORRESPONDENCE", + "source": "PRIMARY", + "addressQualityStatus": null, + "collectionCaseId": 260922, + "signals": null, + "location": null + }, + { + "referenceId": "99e898f5-76fe-4b43-bcc3-32cdbdaaf085", + "addressReferenceId": "d9ef9db9-edd9-4516-b0de-6179b9d62ed7", + "lineOne": "A-314 Block-A, Salarpuria Business Centre", + "lineTwo": "Koramangala", + "city": "Bangalore", + "state": "Karnataka", + "pinCode": "560034", + "current": false, + "permanent": false, + "type": "PERMANENT", + "source": "PRIMARY", + "addressQualityStatus": null, + "collectionCaseId": 260922, + "signals": null, + "location": null + } + ], + "phoneNumber": "6666625786", + "dateOfBirth": null, + "loanAccountNumber": "111190259528", + "outstandingAmount": { + "amount": 59845.6200, + "currency": "INR" + }, + "currentDpd": 32, + "currentDpdBucket": "31-60", + "loanAmount": { + "amount": 130000.00, + "currency": "INR" + }, + "productType": "PERSONAL_LOAN", + "loanType": "Product To Be Used For GoLive", + "productSubType": null, + "loanTenureInMonths": 3, + "totalRemainingInstallments": 3, + "startDate": "2023-04-06", + "activationDate": "2023-04-06", + "closingDate": null, + "status": "ACTIVE", + "pendingEmiSchedules": [ + { + "referenceScheduleId": "S-00000090587694-V1-I1", + "totalAmount": 45688.00, + "principal": 42354.30, + "interest": 3333.70, + "startDate": "2023-04-06", + "endDate": "2023-05-06", + "dueDate": "2023-05-06", + "installmentType": "EMI" + }, + { + "referenceScheduleId": "S-00000090587694-V1-I2", + "totalAmount": 45225.00, + "principal": 43476.89, + "interest": 1748.11, + "startDate": "2023-05-06", + "endDate": "2023-06-06", + "dueDate": "2023-06-06", + "installmentType": "EMI" + }, + { + "referenceScheduleId": "S-00000090587694-V1-I3", + "totalAmount": 45144.15, + "principal": 44168.80, + "interest": 975.34, + "startDate": "2023-06-06", + "endDate": "2023-07-06", + "dueDate": "2023-07-06", + "installmentType": "EMI" + } + ], + "repaymentHistory": [ + { + "loanReferenceId": null, + "customerReferenceId": "c786a9ec-02f7-4e86-ad10-1249a89b4418", + "paymentReferenceId": "178502PC33333333333238", + "status": "SUCCESS", + "valueDate": "2023-04-06", + "businessDate": "2023-04-06", + "repaymentMode": null, + "amount": 6136.00, + "failed": false, + "success": true + } + ], + "promises": [], + "dues": [ + { + "referenceId": "fdc558ee-cc40-456b-90da-b873635b7147", + "dueDate": "2023-04-06", + "payByDate": "2023-04-06", + "generationDate": "2023-04-06", + "status": "PAID", + "totalDueAmount": 6136.00, + "unpaidDueAmount": 0.00, + "principal": 0.00, + "unpaidPrincipal": 0.00, + "interest": 0.00, + "unpaidInterest": 0.00, + "processingFee": 6136.00, + "totalPenalty": 0.00, + "unpaidPenalty": 0.00, + "totalLateFeeAmount": 0.00, + "totalLateFeeGst": 0.00, + "totalUnpaidLateFeeAmount": 0.00, + "totalUnpaidLateFeeGst": 0.00, + "totalBounceFeeAmount": 0.00, + "totalBounceFeeGst": 0.00, + "totalUnpaidBounceFeeAmount": 0.00, + "totalUnpaidBounceFeeGst": 0.00, + "totalOverdueInterest": 0.00, + "totalUnpaidOverdueInterest": 0.00, + "totalPenalInterest": 0.00, + "totalUnpaidPenalInterest": 0.00, + "totalPenaltyCharges": 0.00, + "totalUnpaidPenaltyCharges": 0.00, + "totalPenaltyChargesGst": 0.00, + "totalUnpaidPenaltyChargesGst": 0.00, + "penaltyPercent": null, + "campaignReferenceId": null, + "lastPaidDate": "2023-04-06", + "initialFoir": null, + "currentFoir": null, + "paid": true, + "unPaid": false, + "penaltyApplied": false + }, + { + "referenceId": "39328201-99c5-4022-a4d3-0aa49d42df63", + "dueDate": "2023-05-06", + "payByDate": "2023-05-09", + "generationDate": "2023-05-06", + "status": "UNPAID", + "totalDueAmount": 52388.00, + "unpaidDueAmount": 56116.81, + "principal": 42847.49, + "unpaidPrincipal": 42847.49, + "interest": 2840.51, + "unpaidInterest": 2840.51, + "processingFee": 0.00, + "totalPenalty": 6800.00, + "unpaidPenalty": 6700.00, + "totalLateFeeAmount": 0.00, + "totalLateFeeGst": 0.00, + "totalUnpaidLateFeeAmount": 0.00, + "totalUnpaidLateFeeGst": 0.00, + "totalBounceFeeAmount": 0.00, + "totalBounceFeeGst": 0.00, + "totalUnpaidBounceFeeAmount": 0.00, + "totalUnpaidBounceFeeGst": 0.00, + "totalOverdueInterest": 0.00, + "totalUnpaidOverdueInterest": 0.00, + "totalPenalInterest": 0.00, + "totalUnpaidPenalInterest": 0.00, + "totalPenaltyCharges": 5762.71, + "totalUnpaidPenaltyCharges": 9406.77, + "totalPenaltyChargesGst": 1037.29, + "totalUnpaidPenaltyChargesGst": 9406.77, + "penaltyPercent": null, + "campaignReferenceId": null, + "lastPaidDate": null, + "initialFoir": null, + "currentFoir": null, + "paid": false, + "unPaid": true, + "penaltyApplied": true + } + ], + "capturePtpDate": null, + "writeOffType": "", + "ptpStatuses": [], + "flashFeedback": null, + "flashAlerts": { + "cibilAlerts": [] + }, + "callBasedInteractions": [], + "mandateStatus": "SUCCESS", + "retryEnachEnable": false, + "branch": null, + "outstandingPrincipal": 130000.00, + "outstandingInterest": 2840.51, + "unpaidDues": 1, + "tags": [], + "currentFoir": null, + "initialFoir": null, + "ptpPerEmiCountMap": { + "1": 0, + "2": 0 + }, + "annualRateOfInterest": 26.00 +} \ No newline at end of file diff --git a/__mocks__/levels/agents/CASE_ID/ranking.json b/__mocks__/levels/agents/CASE_ID/ranking.json new file mode 100644 index 00000000..311482cc --- /dev/null +++ b/__mocks__/levels/agents/CASE_ID/ranking.json @@ -0,0 +1,9 @@ +{ + "agentReferenceId": null, + "agentLevelRanking": null, + "maxLevel": null, + "cashCollectedInLast30Days": null, + "firstAllocationDate": null, + "cashRequiredToReachNextLevel": null, + "levelConstructList": null +} \ No newline at end of file diff --git a/__mocks__/otps/send.json b/__mocks__/otps/send.json new file mode 100644 index 00000000..d30ab69a --- /dev/null +++ b/__mocks__/otps/send.json @@ -0,0 +1 @@ +{"otpToken":"45e83251-7c57-446b-b383-fc7a478d02eb"} \ No newline at end of file diff --git a/__mocks__/otps/verify-v2.json b/__mocks__/otps/verify-v2.json new file mode 100644 index 00000000..416ec96a --- /dev/null +++ b/__mocks__/otps/verify-v2.json @@ -0,0 +1 @@ +{"accessToken":"dd35eb89-462a-48e3-b3f9-fd48901e770c"} \ No newline at end of file diff --git a/__mocks__/telephones.json b/__mocks__/telephones.json new file mode 100644 index 00000000..1725babc --- /dev/null +++ b/__mocks__/telephones.json @@ -0,0 +1,13 @@ +[ + { + "source": "PRIMARY", + "sourceText": "Primary Contact", + "number": "6666625786", + "valid": true, + "telephoneScore": 7, + "havingMaximumScore": true, + "callHistory": [], + "createdAt": "2023-04-06T11:28:09.561002", + "new": true + } +] \ No newline at end of file diff --git a/__mocks__/v2/interactions/feedback-history.json b/__mocks__/v2/interactions/feedback-history.json new file mode 100644 index 00000000..2e2acd87 --- /dev/null +++ b/__mocks__/v2/interactions/feedback-history.json @@ -0,0 +1,28 @@ +{ + "content": [], + "pageable": { + "sort": { + "sorted": true, + "unsorted": false, + "empty": false + }, + "pageNumber": 0, + "pageSize": 10, + "offset": 0, + "paged": true, + "unpaged": false + }, + "last": true, + "totalPages": 0, + "totalElements": 0, + "first": true, + "sort": { + "sorted": true, + "unsorted": false, + "empty": false + }, + "numberOfElements": 0, + "size": 10, + "number": 0, + "empty": true +} \ No newline at end of file diff --git a/__mocks__/v2/interactions/question-tree.json b/__mocks__/v2/interactions/question-tree.json new file mode 100644 index 00000000..e14c1859 --- /dev/null +++ b/__mocks__/v2/interactions/question-tree.json @@ -0,0 +1,85 @@ +[ + { + "referenceId": "08e7fcc8-0f71-40d1-ad70-600b0256aacb", + "name": "Customer Interaction Status", + "text": "Customer Interaction Status", + "tag": "INTERACTION_STATUS", + "answerType": "OPTIONS", + "options": [ + { + "referenceId": "4b290e4c-2918-439f-af7f-cf418ab8ea3e", + "text": "Customer Expired", + "sortOrder": 11 + }, + { + "referenceId": "37ffc226-81eb-412d-84cc-1f51c5a8a67e", + "text": "Switched Off", + "sortOrder": 4 + }, + { + "referenceId": "4a831e90-d72b-4e21-8a37-d4a0cfb4be23", + "text": "Dispute", + "sortOrder": 2 + }, + { + "referenceId": "5e06c907-d2bf-4cac-887a-eccc221a80b1", + "text": "Message Left", + "sortOrder": 7 + }, + { + "referenceId": "8b98674b-b6cc-4e57-9815-18292445c0b7", + "text": "Paid", + "sortOrder": 12 + }, + { + "referenceId": "e23f97af-312f-42d4-9a9e-3c28dd79c216", + "text": "Ringing no Response", + "sortOrder": 3 + }, + { + "referenceId": "4da23c0e-5b8d-4ec3-9bce-ea7e78fc4de6", + "text": "Refused to Pay", + "sortOrder": 8 + }, + { + "referenceId": "727a2d07-f25e-403b-aff4-29bc89340144", + "text": "Requested Call Back", + "sortOrder": 1 + }, + { + "referenceId": "55b9e202-ccd4-4e4d-a47d-7900ab884e73", + "text": "Call Disconnected RPC", + "sortOrder": 9 + }, + { + "referenceId": "cbea232e-12a6-455b-8d40-9811e53dd2d4", + "text": "Promise to Pay", + "sortOrder": 0 + }, + { + "referenceId": "9505becd-5ab5-4062-8543-38ccad06b74e", + "text": "Call Disconnected Non RPC", + "sortOrder": 10 + }, + { + "referenceId": "7fb127a4-e8bd-4e5c-9612-801d5adfbb46", + "text": "Busy", + "sortOrder": 5 + }, + { + "referenceId": "5d470f9d-fc27-4702-82e9-95156b5676ae", + "text": "Invalid Number", + "sortOrder": 6 + }, + { + "referenceId": "0f140dc5-3571-438b-8471-9d3dc48b58d3", + "text": "Third Party Contact", + "sortOrder": 13 + } + ], + "defaultValue": null, + "mandatory": true, + "supportedDateType": null, + "defaultOptionReferenceId": null + } +] \ No newline at end of file diff --git a/__mocks__/version.json b/__mocks__/version.json new file mode 100644 index 00000000..4d4e48ca --- /dev/null +++ b/__mocks__/version.json @@ -0,0 +1 @@ +{"buildTime": 1680845381969} \ No newline at end of file diff --git a/src/utils/ApiHelper.ts b/src/utils/ApiHelper.ts index 0dc50471..ca1ee8a0 100644 --- a/src/utils/ApiHelper.ts +++ b/src/utils/ApiHelper.ts @@ -107,17 +107,17 @@ API_URLS[ApiKeys.GET_FORECLOSURE_AMOUNT] = '/loan/request/{lan}/pre-closure-amou // TODO: try to get rid of `as` const MOCK_API_URLS: Record = {} as Record; MOCK_API_URLS[ApiKeys.PEOPLE] = 'people.json'; -MOCK_API_URLS[ApiKeys.SEND_OTP] = '/otps/send'; -MOCK_API_URLS[ApiKeys.VERIFY_OTP] = '/otps/verify-v2'; -MOCK_API_URLS[ApiKeys.DETAILS] = '/details'; -MOCK_API_URLS[ApiKeys.FETCH_ALL_CASES] = '/allocated-cases/v1?'; -MOCK_API_URLS[ApiKeys.VERIFY_USER_SESSION] = '/auth/user'; -MOCK_API_URLS[ApiKeys.FETCH_NOTIFICATIONS] = '/notification/fetch'; -MOCK_API_URLS[ApiKeys.NOTIFICATION_ACTION] = '/notification/action'; -MOCK_API_URLS[ApiKeys.FETCH_FEEDBACK_HISTORY] = '/v2/interactions/feedback-history'; -MOCK_API_URLS[ApiKeys.LOAN_DETAILS] = '/loan-details/'; -API_URLS[ApiKeys.ADDRESSES] = '/addresses'; -API_URLS[ApiKeys.BUILD_TIMESTAMP] = '/version'; +MOCK_API_URLS[ApiKeys.SEND_OTP] = 'otps/send.json'; +MOCK_API_URLS[ApiKeys.VERIFY_OTP] = 'otps/verify-v2.json'; +MOCK_API_URLS[ApiKeys.DETAILS] = 'details.json'; +MOCK_API_URLS[ApiKeys.FETCH_ALL_CASES] = 'allocated-cases/v1.json'; +MOCK_API_URLS[ApiKeys.VERIFY_USER_SESSION] = 'auth/user.json'; +MOCK_API_URLS[ApiKeys.FETCH_NOTIFICATIONS] = 'notification/fetch.json'; +MOCK_API_URLS[ApiKeys.NOTIFICATION_ACTION] = 'notification/action.json'; +MOCK_API_URLS[ApiKeys.FETCH_FEEDBACK_HISTORY] = 'v2/interactions/feedback-history.json'; +MOCK_API_URLS[ApiKeys.LOAN_DETAILS] = 'loan-details.json'; +API_URLS[ApiKeys.ADDRESSES] = 'addresses.json'; +API_URLS[ApiKeys.BUILD_TIMESTAMP] = 'version.json'; let navigate: NavigateFunction; let dispatch: Dispatch; @@ -220,6 +220,10 @@ axiosInstance.interceptors.response.use( axiosInstance.defaults.headers.common['Content-Type'] = 'application/json'; axiosInstance.defaults.baseURL = `${window?.config?.BFF_SERVICE_BASE_URL || '/api'}`; +if (USE_MOCK && !import.meta.env.PROD) { + axiosInstance.defaults.baseURL = '/'; +} + // TODO:: Ideally should happen through middlewares. export const registerNavigateAndDispatch = ( navigateParam: NavigateFunction,